diff --git a/sample/profiles/stackprof/stackprof-last-frame-no-name.json b/sample/profiles/stackprof/stackprof-last-frame-no-name.json new file mode 100644 index 0000000..3f73ce2 --- /dev/null +++ b/sample/profiles/stackprof/stackprof-last-frame-no-name.json @@ -0,0 +1 @@ +{"version":1.2,"mode":"object","interval":1,"samples":103,"gc_samples":0,"missed_samples":0,"metadata":{},"frames":{"4317464320":{"name":"block in
","file":"/Users/alex/src/github.com/alexcoco/speedscope/sample/programs/ruby/object.rb","line":21,"total_samples":103,"samples":1,"edges":{"4379033920":102},"lines":{"23":[1,1],"22":[102,0]}},"4379035920":{"name":"StackProf.run","file":"","line":null,"total_samples":103,"samples":0,"edges":{"4317464320":103}},"4376547240":{"name":"
","file":"/Users/alex/src/github.com/alexcoco/speedscope/sample/programs/ruby/object.rb","total_samples":103,"samples":0,"edges":{"4379035920":103},"lines":{"21":[103,0]}},"4317728280":{"name":"
","file":"../../alexcoco/speedscope/sample/programs/ruby/object.rb","total_samples":103,"samples":0,"edges":{"4376547240":103}},"4379033920":{"name":"Object#a","file":"/Users/alex/src/github.com/alexcoco/speedscope/sample/programs/ruby/object.rb","line":4,"total_samples":102,"samples":2,"edges":{"4317869400":102,"4379033880":5,"4379033840":95},"lines":{"6":[6,1],"5":[102,0],"8":[1,1],"7":[95,0]}},"4317869400":{"name":"Range#each","file":"","line":null,"total_samples":102,"samples":0,"edges":{"4379033920":102,"4379033840":95}},"4379033880":{"name":"Object#b","file":"/Users/alex/src/github.com/alexcoco/speedscope/sample/programs/ruby/object.rb","line":11,"total_samples":5,"samples":1,"edges":{"4318054440":4},"lines":{"12":[5,1]}},"4318054440":{"name":"Class#new","file":"","line":null,"total_samples":4,"samples":4},"4379033840":{"name":"Object#c","file":"/Users/alex/src/github.com/alexcoco/speedscope/sample/programs/ruby/object.rb","line":15,"total_samples":95,"samples":2,"edges":{"4317869400":95,"4317868920":37,"4317563560":20,"4317922760":36},"lines":{"17":[95,2],"16":[95,0]}},"4317868920":{"name":"Range#to_a","file":"","line":null,"total_samples":37,"samples":1,"edges":{"4379016640":36}},"4379016640":{"name":"Enumerable#to_a","file":"","line":null,"total_samples":36,"samples":36},"4317563560":{"name":"Array#sample","file":"","line":60,"total_samples":20,"samples":20,"lines":{"60":[1,1],"68":[19,19]}},"4317922760":{"file":"","line":null,"total_samples":36,"samples":36}},"raw":[4,4317728280,4376547240,4379035920,4317464320,1,7,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,1,8,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033880,1,9,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033880,4318054440,2,7,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,1,10,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,1,11,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317868920,1,12,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317868920,4379016640,2,10,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,1,11,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317563560,3,11,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317922760,2,12,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317868920,4379016640,2,11,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317563560,1,11,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317922760,2,12,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317868920,4379016640,2,11,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317563560,1,11,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317922760,2,12,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317868920,4379016640,2,11,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317563560,1,11,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317922760,2,12,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317868920,4379016640,2,11,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317563560,1,11,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317922760,2,12,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317868920,4379016640,2,11,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317563560,1,11,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317922760,2,9,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033880,4318054440,1,12,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317868920,4379016640,2,11,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317563560,1,11,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317922760,2,12,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317868920,4379016640,2,11,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317563560,1,11,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317922760,2,12,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317868920,4379016640,2,11,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317563560,1,11,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317922760,2,12,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317868920,4379016640,2,11,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317563560,1,11,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317922760,2,12,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317868920,4379016640,2,11,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317563560,1,11,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317922760,2,12,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317868920,4379016640,2,11,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317563560,1,11,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317922760,2,9,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033880,4318054440,1,12,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317868920,4379016640,2,11,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317563560,1,11,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317922760,2,12,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317868920,4379016640,2,11,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317563560,1,11,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317922760,2,12,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317868920,4379016640,2,11,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317563560,1,11,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317922760,2,12,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317868920,4379016640,2,11,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317563560,1,11,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317922760,2,12,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317868920,4379016640,2,11,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317563560,1,11,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317922760,2,12,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317868920,4379016640,2,11,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317563560,1,11,4317728280,4376547240,4379035920,4317464320,4379033920,4317869400,4379033920,4379033840,4317869400,4379033840,4317922760,2],"raw_sample_timestamps":[3215395537054,3215395537057,3215395537058,3215395537059,3215395537060,3215395537060,3215395537061,3215395537063,3215395537064,3215395537064,3215395537066,3215395537068,3215395537082,3215395537090,3215395537091,3215395537091,3215395537092,3215395537093,3215395537094,3215395537094,3215395537094,3215395537095,3215395537095,3215395537096,3215395537096,3215395537096,3215395537097,3215395537097,3215395537097,3215395537098,3215395537098,3215395537099,3215395537099,3215395537099,3215395537100,3215395537100,3215395537100,3215395537101,3215395537101,3215395537102,3215395537102,3215395537102,3215395537103,3215395537103,3215395537104,3215395537104,3215395537104,3215395537105,3215395537105,3215395537106,3215395537106,3215395537107,3215395537107,3215395537107,3215395537108,3215395537108,3215395537108,3215395537109,3215395537109,3215395537110,3215395537110,3215395537110,3215395537111,3215395537111,3215395537112,3215395537112,3215395537112,3215395537113,3215395537113,3215395537113,3215395537114,3215395537114,3215395537114,3215395537115,3215395537115,3215395537116,3215395537116,3215395537116,3215395537117,3215395537117,3215395537117,3215395537118,3215395537118,3215395537118,3215395537119,3215395537119,3215395537119,3215395537120,3215395537120,3215395537120,3215395537121,3215395537121,3215395537122,3215395537122,3215395537122,3215395537123,3215395537123,3215395537123,3215395537124,3215395537124,3215395537125,3215395537125,3215395537126],"raw_timestamp_deltas":[4,2,0,0,1,0,0,1,1,0,1,2,14,8,0,0,0,0,1,0,0,1,0,1,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]} diff --git a/src/import/__snapshots__/stackprof.test.ts.snap b/src/import/__snapshots__/stackprof.test.ts.snap index 3888a1b..319f73a 100644 --- a/src/import/__snapshots__/stackprof.test.ts.snap +++ b/src/import/__snapshots__/stackprof.test.ts.snap @@ -1046,6 +1046,201 @@ exports[`importFromStackprof object mode: indexToView 1`] = `0`; exports[`importFromStackprof object mode: profileGroup.name 1`] = `"object-stackprof.json"`; +exports[`importFromStackprof when a profile has a frame with no name 1`] = ` +Object { + "frames": Array [ + Frame { + "col": undefined, + "file": "../../alexcoco/speedscope/sample/programs/ruby/object.rb", + "key": 4317728280, + "line": undefined, + "name": "
", + "selfWeight": 0, + "totalWeight": 103, + }, + Frame { + "col": undefined, + "file": "/Users/alex/src/github.com/alexcoco/speedscope/sample/programs/ruby/object.rb", + "key": 4376547240, + "line": undefined, + "name": "
", + "selfWeight": 0, + "totalWeight": 103, + }, + Frame { + "col": undefined, + "file": "", + "key": 4379035920, + "line": null, + "name": "StackProf.run", + "selfWeight": 0, + "totalWeight": 103, + }, + Frame { + "col": undefined, + "file": "/Users/alex/src/github.com/alexcoco/speedscope/sample/programs/ruby/object.rb", + "key": 4317464320, + "line": 21, + "name": "block in
", + "selfWeight": 1, + "totalWeight": 103, + }, + Frame { + "col": undefined, + "file": "/Users/alex/src/github.com/alexcoco/speedscope/sample/programs/ruby/object.rb", + "key": 4379033920, + "line": 4, + "name": "Object#a", + "selfWeight": 2, + "totalWeight": 102, + }, + Frame { + "col": undefined, + "file": "", + "key": 4317869400, + "line": null, + "name": "Range#each", + "selfWeight": 0, + "totalWeight": 102, + }, + Frame { + "col": undefined, + "file": "/Users/alex/src/github.com/alexcoco/speedscope/sample/programs/ruby/object.rb", + "key": 4379033880, + "line": 11, + "name": "Object#b", + "selfWeight": 1, + "totalWeight": 5, + }, + Frame { + "col": undefined, + "file": "", + "key": 4318054440, + "line": null, + "name": "Class#new", + "selfWeight": 4, + "totalWeight": 4, + }, + Frame { + "col": undefined, + "file": "/Users/alex/src/github.com/alexcoco/speedscope/sample/programs/ruby/object.rb", + "key": 4379033840, + "line": 15, + "name": "Object#c", + "selfWeight": 2, + "totalWeight": 95, + }, + Frame { + "col": undefined, + "file": "", + "key": 4317868920, + "line": null, + "name": "Range#to_a", + "selfWeight": 1, + "totalWeight": 37, + }, + Frame { + "col": undefined, + "file": "", + "key": 4379016640, + "line": null, + "name": "Enumerable#to_a", + "selfWeight": 36, + "totalWeight": 36, + }, + Frame { + "col": undefined, + "file": "", + "key": 4317563560, + "line": 60, + "name": "Array#sample", + "selfWeight": 20, + "totalWeight": 20, + }, + Frame { + "col": undefined, + "file": "", + "key": 4317922760, + "line": null, + "name": "(unknown)", + "selfWeight": 36, + "totalWeight": 36, + }, + ], + "name": "stackprof-last-frame-no-name.json", + "stacks": Array [ + "
;
;StackProf.run;block in
1", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a 1", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#b 1", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#b;Class#new 2", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a 1", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c 1", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;Range#to_a 1", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;Range#to_a;Enumerable#to_a 2", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c 1", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;Array#sample 3", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;(unknown) 2", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;Range#to_a;Enumerable#to_a 2", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;Array#sample 1", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;(unknown) 2", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;Range#to_a;Enumerable#to_a 2", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;Array#sample 1", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;(unknown) 2", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;Range#to_a;Enumerable#to_a 2", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;Array#sample 1", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;(unknown) 2", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;Range#to_a;Enumerable#to_a 2", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;Array#sample 1", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;(unknown) 2", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;Range#to_a;Enumerable#to_a 2", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;Array#sample 1", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;(unknown) 2", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#b;Class#new 1", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;Range#to_a;Enumerable#to_a 2", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;Array#sample 1", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;(unknown) 2", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;Range#to_a;Enumerable#to_a 2", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;Array#sample 1", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;(unknown) 2", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;Range#to_a;Enumerable#to_a 2", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;Array#sample 1", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;(unknown) 2", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;Range#to_a;Enumerable#to_a 2", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;Array#sample 1", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;(unknown) 2", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;Range#to_a;Enumerable#to_a 2", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;Array#sample 1", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;(unknown) 2", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;Range#to_a;Enumerable#to_a 2", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;Array#sample 1", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;(unknown) 2", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#b;Class#new 1", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;Range#to_a;Enumerable#to_a 2", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;Array#sample 1", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;(unknown) 2", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;Range#to_a;Enumerable#to_a 2", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;Array#sample 1", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;(unknown) 2", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;Range#to_a;Enumerable#to_a 2", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;Array#sample 1", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;(unknown) 2", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;Range#to_a;Enumerable#to_a 2", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;Array#sample 1", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;(unknown) 2", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;Range#to_a;Enumerable#to_a 2", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;Array#sample 1", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;(unknown) 2", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;Range#to_a;Enumerable#to_a 2", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;Array#sample 1", + "
;
;StackProf.run;block in
;Object#a;Range#each;Object#a;Object#c;Range#each;Object#c;(unknown) 2", + ], +} +`; + +exports[`importFromStackprof when a profile has a frame with no name: indexToView 1`] = `0`; + +exports[`importFromStackprof when a profile has a frame with no name: profileGroup.name 1`] = `"stackprof-last-frame-no-name.json"`; + exports[`importFromStackprof: indexToView 1`] = `0`; exports[`importFromStackprof: profileGroup.name 1`] = `"simple-stackprof.json"`; diff --git a/src/import/stackprof.test.ts b/src/import/stackprof.test.ts index a5f5b20..32624ba 100644 --- a/src/import/stackprof.test.ts +++ b/src/import/stackprof.test.ts @@ -7,3 +7,7 @@ test('importFromStackprof', async () => { test('importFromStackprof object mode', async () => { await checkProfileSnapshot('./sample/profiles/stackprof/object-stackprof.json') }) + +test('importFromStackprof when a profile has a frame with no name', async () => { + await checkProfileSnapshot('./sample/profiles/stackprof/stackprof-last-frame-no-name.json') +}) diff --git a/src/import/stackprof.ts b/src/import/stackprof.ts index bbc62fa..0ace853 100644 --- a/src/import/stackprof.ts +++ b/src/import/stackprof.ts @@ -4,7 +4,7 @@ import {Profile, FrameInfo, StackListProfileBuilder} from '../lib/profile' import {TimeFormatter} from '../lib/value-formatters' interface StackprofFrame { - name: string + name?: string file?: string line?: number } @@ -34,10 +34,16 @@ export function importFromStackprof(stackprofProfile: StackprofProfile): Profile let stack: FrameInfo[] = [] for (let j = 0; j < stackHeight; j++) { const id = raw[i++] - stack.push({ + let frameName = frames[id].name; + if (frameName == null) { + frameName = '(unknown)'; + } + const frame = { key: id, ...frames[id], - }) + name: frameName, + } + stack.push(frame) } if (stack.length === 1 && stack[0].name === '(garbage collection)') { stack = prevStack.concat(stack)