Skip to content

Commit

Permalink
Add an arch field to libs. perf.html doesn't use this but it's going …
Browse files Browse the repository at this point in the history
…to be part of the profile format.
  • Loading branch information
mstange committed Mar 12, 2017
1 parent c464bba commit 9f85b90
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 6 deletions.
10 changes: 9 additions & 1 deletion src/content/preprocessed-profile-versioning.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ export function upgradePreprocessedProfileToCurrentVersion(profile: Object) {
profile.meta.preprocessedProfileVersion = CURRENT_VERSION;
}

function _archFromAbi(abi) {
if (abi === 'x86_64-gcc3') {
return 'x86_64';
}
return abi;
}

// _upgraders[i] converts from version i - 1 to version i.
// Every "upgrader" takes the profile as its single argument and mutates it.
const _upgraders = {
Expand All @@ -88,13 +95,14 @@ const _upgraders = {
}
},
[2]: profile => {
// pdbName -> debugName
// pdbName -> debugName, add arch
for (const thread of profile.threads) {
for (const lib of thread.libs) {
if (!('debugName' in lib)) {
lib.debugName = lib.pdbName;
lib.path = lib.name;
lib.name = lib.debugName.endsWith('.pdb') ? lib.debugName.substr(0, lib.debugName.length - 4) : lib.debugName;
lib.arch = _archFromAbi(profile.meta.abi);
delete lib.pdbName;
delete lib.pdbAge;
delete lib.pdbSignature;
Expand Down
8 changes: 8 additions & 0 deletions src/content/raw-profile-versioning.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ export function upgradeRawProfileToCurrentVersion(profile: Object) {
profile.meta.version = CURRENT_VERSION;
}

function _archFromAbi(abi) {
if (abi === 'x86_64-gcc3') {
return 'x86_64';
}
return abi;
}

// _upgraders[i] converts from version i - 1 to version i.
// Every "upgrader" takes the profile as its single argument and mutates it.
const _upgraders = {
Expand Down Expand Up @@ -85,6 +92,7 @@ const _upgraders = {
delete lib.pdbSignature;
lib.path = lib.name;
lib.name = lib.debugName.endsWith('.pdb') ? lib.debugName.substr(0, lib.debugName.length - 4) : lib.debugName;
lib.arch = _archFromAbi(p.meta.abi);
return lib;
})
.sort((a, b) => a.start - b.start);
Expand Down
12 changes: 8 additions & 4 deletions test/example-profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ const parentProcessBinary = {
name: 'firefox',
path: '/Applications/FirefoxNightly.app/Contents/MacOS/firefox',
start: 0x100000000,
end: 0x100000000 + 10000
end: 0x100000000 + 10000,
arch: 'x86_64',
};

const contentProcessBinary = {
Expand All @@ -18,7 +19,8 @@ const contentProcessBinary = {
name: 'firefox-webcontent',
path: '/Applications/FirefoxNightly.app/Contents/MacOS/firefox-webcontent.app/Contents/MacOS/firefox-webcontent',
start: 0x100000000,
end: 0x100000000 + 10000
end: 0x100000000 + 10000,
arch: 'x86_64',
};

const extraBinaries = [
Expand All @@ -28,15 +30,17 @@ const extraBinaries = [
name: 'examplebinary',
path: '/tmp/examplebinary',
start: 0x200000000,
end: 0x200000000 + 20
end: 0x200000000 + 20,
arch: 'x86_64',
},
{
breakpadId: '100000000000000000000000000000A27',
debugName: 'examplebinary2.pdb',
name: 'examplebinary2',
path: 'C:\\examplebinary2',
start: 0x200000000 + 20,
end: 0x200000000 + 40
end: 0x200000000 + 40,
arch: 'x86_64',
},
];

Expand Down
2 changes: 1 addition & 1 deletion test/upgrades/raw-4.sps.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"meta":{"abi":"x86_64-gcc3","interval":1,"misc":"rv:48.0","oscpu":"Intel Mac OS X 10.11","platform":"Macintosh","processType":0,"product":"Firefox","stackwalk":1,"startTime":1460221352723.438,"toolkit":"cocoa","version":4},"libs":[{"breakpadId":"F1D957D30B413D55A539BBA06F90DD8F0","debugName":"firefox","name":"firefox","path":"/Applications/FirefoxNightly.app/Contents/MacOS/firefox","start":4294967296,"end":4294977296},{"breakpadId":"1000000000000000000000000000000A1","debugName":"examplebinary","name":"examplebinary","path":"/tmp/examplebinary","start":8589934592,"end":8589934612},{"breakpadId":"100000000000000000000000000000A27","debugName":"examplebinary2.pdb","name":"examplebinary2","path":"C:\\examplebinary2","start":8589934612,"end":8589934632}],"threads":[{"name":"GeckoMain","processType":"default","samples":{"schema":{"stack":0,"time":1,"responsiveness":2,"rss":3,"uss":4,"frameNumber":5,"power":6},"data":[[1,0,0],[2,1,0],[2,2,0],[3,3,0],[0,4,0],[1,5,0],[4,6,0]]},"stackTable":{"schema":{"prefix":0,"frame":1},"data":[[null,0],[0,1],[1,2],[1,3],[1,4]]},"frameTable":{"schema":{"location":0,"implementation":1,"optimizations":2,"line":3,"category":4},"data":[[0],[1],[2],[3,null,null,4391,16],[7,6,null,34]]},"markers":{"schema":{"name":0,"time":1,"data":2},"data":[[4,0,{"category":"VsyncTimestamp","vsync":0}],[5,2,{"category":"Paint","interval":"start","stack":{"markers":{"schema":{"name":0,"time":1,"data":2},"data":[]},"name":"SyncProfile","samples":{"schema":{"stack":0,"time":1,"responsiveness":2,"rss":3,"uss":4,"frameNumber":5,"power":6},"data":[[2,1]]}},"type":"tracing"}],[10,4,{"category":"Paint","interval":"start","type":"tracing"}],[10,5,{"category":"Paint","interval":"end","type":"tracing"}],[5,8,{"category":"Paint","interval":"end","type":"tracing"}],[9,11,{"startTime":11,"endTime":12}],[8,9,{"startTime":9,"endTime":10,"type":"mouseout","phase":3}]]},"stringTable":["(root)","0x100000f84","0x100001a45","Startup::XRE_Main","VsyncTimestamp","Reflow","baseline","frobnicate (chrome://blargh:34)","DOMEvent","MinorGC","Rasterize"]},{"name":"Compositor","processType":"default","samples":{"schema":{"stack":0,"time":1,"responsiveness":2,"rss":3,"uss":4,"frameNumber":5,"power":6},"data":[[1,0,0],[2,1,0],[2,2,0],[3,3,0],[0,4,0],[1,5,0],[4,6,0]]},"stackTable":{"schema":{"prefix":0,"frame":1},"data":[[null,0],[0,1],[1,2],[1,3],[1,4]]},"frameTable":{"schema":{"location":0,"implementation":1,"optimizations":2,"line":3,"category":4},"data":[[0],[1],[2],[3,null,null,4391,16],[7,6,null,34]]},"markers":{"schema":{"name":0,"time":1,"data":2},"data":[[4,0,{"category":"VsyncTimestamp","vsync":0}],[5,2,{"category":"Paint","interval":"start","stack":{"markers":{"schema":{"name":0,"time":1,"data":2},"data":[]},"name":"SyncProfile","samples":{"schema":{"stack":0,"time":1,"responsiveness":2,"rss":3,"uss":4,"frameNumber":5,"power":6},"data":[[2,1]]}},"type":"tracing"}],[10,4,{"category":"Paint","interval":"start","type":"tracing"}],[10,5,{"category":"Paint","interval":"end","type":"tracing"}],[5,8,{"category":"Paint","interval":"end","type":"tracing"}],[9,11,{"startTime":11,"endTime":12}],[8,9,{"startTime":9,"endTime":10,"type":"mouseout","phase":3}]]},"stringTable":["(root)","0x100000f84","0x100001a45","Startup::XRE_Main","VsyncTimestamp","Reflow","baseline","frobnicate (chrome://blargh:34)","DOMEvent","MinorGC","Rasterize"]},"{\"meta\":{\"abi\":\"x86_64-gcc3\",\"interval\":1,\"misc\":\"rv:48.0\",\"oscpu\":\"Intel Mac OS X 10.11\",\"platform\":\"Macintosh\",\"processType\":2,\"product\":\"Firefox\",\"stackwalk\":1,\"startTime\":1460221353723.438,\"toolkit\":\"cocoa\",\"version\":4},\"libs\":[{\"breakpadId\":\"9F950E2CE3CD3E1ABD06D80788B606E60\",\"debugName\":\"firefox-webcontent\",\"name\":\"firefox-webcontent\",\"path\":\"/Applications/FirefoxNightly.app/Contents/MacOS/firefox-webcontent.app/Contents/MacOS/firefox-webcontent\",\"start\":4294967296,\"end\":4294977296},{\"breakpadId\":\"1000000000000000000000000000000A1\",\"debugName\":\"examplebinary\",\"name\":\"examplebinary\",\"path\":\"/tmp/examplebinary\",\"start\":8589934592,\"end\":8589934612},{\"breakpadId\":\"100000000000000000000000000000A27\",\"debugName\":\"examplebinary2.pdb\",\"name\":\"examplebinary2\",\"path\":\"C:\\\\examplebinary2\",\"start\":8589934612,\"end\":8589934632}],\"threads\":[{\"name\":\"GeckoMain\",\"processType\":\"tab\",\"samples\":{\"schema\":{\"stack\":0,\"time\":1,\"responsiveness\":2,\"rss\":3,\"uss\":4,\"frameNumber\":5,\"power\":6},\"data\":[[1,0,0],[2,1,0],[2,2,0],[3,3,0],[0,4,0],[1,5,0],[4,6,0]]},\"stackTable\":{\"schema\":{\"prefix\":0,\"frame\":1},\"data\":[[null,0],[0,1],[1,2],[1,3],[1,4]]},\"frameTable\":{\"schema\":{\"location\":0,\"implementation\":1,\"optimizations\":2,\"line\":3,\"category\":4},\"data\":[[0],[1],[2],[3,null,null,4391,16],[7,6,null,34]]},\"markers\":{\"schema\":{\"name\":0,\"time\":1,\"data\":2},\"data\":[[4,0,{\"category\":\"VsyncTimestamp\",\"vsync\":0}],[5,2,{\"category\":\"Paint\",\"interval\":\"start\",\"stack\":{\"markers\":{\"schema\":{\"name\":0,\"time\":1,\"data\":2},\"data\":[]},\"name\":\"SyncProfile\",\"samples\":{\"schema\":{\"stack\":0,\"time\":1,\"responsiveness\":2,\"rss\":3,\"uss\":4,\"frameNumber\":5,\"power\":6},\"data\":[[2,1]]}},\"type\":\"tracing\"}],[10,4,{\"category\":\"Paint\",\"interval\":\"start\",\"type\":\"tracing\"}],[10,5,{\"category\":\"Paint\",\"interval\":\"end\",\"type\":\"tracing\"}],[5,8,{\"category\":\"Paint\",\"interval\":\"end\",\"type\":\"tracing\"}],[9,11,{\"startTime\":11,\"endTime\":12}],[8,9,{\"startTime\":9,\"endTime\":10,\"type\":\"mouseout\",\"phase\":3}]]},\"stringTable\":[\"(root)\",\"0x100000f84\",\"0x100001a45\",\"Startup::XRE_Main\",\"VsyncTimestamp\",\"Reflow\",\"baseline\",\"frobnicate (chrome://blargh:34)\",\"DOMEvent\",\"MinorGC\",\"Rasterize\"]}]}"]}
{"meta":{"abi":"x86_64-gcc3","interval":1,"misc":"rv:48.0","oscpu":"Intel Mac OS X 10.11","platform":"Macintosh","processType":0,"product":"Firefox","stackwalk":1,"startTime":1460221352723.438,"toolkit":"cocoa","version":4},"libs":[{"breakpadId":"F1D957D30B413D55A539BBA06F90DD8F0","debugName":"firefox","name":"firefox","path":"/Applications/FirefoxNightly.app/Contents/MacOS/firefox","start":4294967296,"end":4294977296,"arch":"x86_64"},{"breakpadId":"1000000000000000000000000000000A1","debugName":"examplebinary","name":"examplebinary","path":"/tmp/examplebinary","start":8589934592,"end":8589934612,"arch":"x86_64"},{"breakpadId":"100000000000000000000000000000A27","debugName":"examplebinary2.pdb","name":"examplebinary2","path":"C:\\examplebinary2","start":8589934612,"end":8589934632,"arch":"x86_64"}],"threads":[{"name":"GeckoMain","processType":"default","samples":{"schema":{"stack":0,"time":1,"responsiveness":2,"rss":3,"uss":4,"frameNumber":5,"power":6},"data":[[1,0,0],[2,1,0],[2,2,0],[3,3,0],[0,4,0],[1,5,0],[4,6,0]]},"stackTable":{"schema":{"prefix":0,"frame":1},"data":[[null,0],[0,1],[1,2],[1,3],[1,4]]},"frameTable":{"schema":{"location":0,"implementation":1,"optimizations":2,"line":3,"category":4},"data":[[0],[1],[2],[3,null,null,4391,16],[7,6,null,34]]},"markers":{"schema":{"name":0,"time":1,"data":2},"data":[[4,0,{"category":"VsyncTimestamp","vsync":0}],[5,2,{"category":"Paint","interval":"start","stack":{"markers":{"schema":{"name":0,"time":1,"data":2},"data":[]},"name":"SyncProfile","samples":{"schema":{"stack":0,"time":1,"responsiveness":2,"rss":3,"uss":4,"frameNumber":5,"power":6},"data":[[2,1]]}},"type":"tracing"}],[10,4,{"category":"Paint","interval":"start","type":"tracing"}],[10,5,{"category":"Paint","interval":"end","type":"tracing"}],[5,8,{"category":"Paint","interval":"end","type":"tracing"}],[9,11,{"startTime":11,"endTime":12}],[8,9,{"startTime":9,"endTime":10,"type":"mouseout","phase":3}]]},"stringTable":["(root)","0x100000f84","0x100001a45","Startup::XRE_Main","VsyncTimestamp","Reflow","baseline","frobnicate (chrome://blargh:34)","DOMEvent","MinorGC","Rasterize"]},{"name":"Compositor","processType":"default","samples":{"schema":{"stack":0,"time":1,"responsiveness":2,"rss":3,"uss":4,"frameNumber":5,"power":6},"data":[[1,0,0],[2,1,0],[2,2,0],[3,3,0],[0,4,0],[1,5,0],[4,6,0]]},"stackTable":{"schema":{"prefix":0,"frame":1},"data":[[null,0],[0,1],[1,2],[1,3],[1,4]]},"frameTable":{"schema":{"location":0,"implementation":1,"optimizations":2,"line":3,"category":4},"data":[[0],[1],[2],[3,null,null,4391,16],[7,6,null,34]]},"markers":{"schema":{"name":0,"time":1,"data":2},"data":[[4,0,{"category":"VsyncTimestamp","vsync":0}],[5,2,{"category":"Paint","interval":"start","stack":{"markers":{"schema":{"name":0,"time":1,"data":2},"data":[]},"name":"SyncProfile","samples":{"schema":{"stack":0,"time":1,"responsiveness":2,"rss":3,"uss":4,"frameNumber":5,"power":6},"data":[[2,1]]}},"type":"tracing"}],[10,4,{"category":"Paint","interval":"start","type":"tracing"}],[10,5,{"category":"Paint","interval":"end","type":"tracing"}],[5,8,{"category":"Paint","interval":"end","type":"tracing"}],[9,11,{"startTime":11,"endTime":12}],[8,9,{"startTime":9,"endTime":10,"type":"mouseout","phase":3}]]},"stringTable":["(root)","0x100000f84","0x100001a45","Startup::XRE_Main","VsyncTimestamp","Reflow","baseline","frobnicate (chrome://blargh:34)","DOMEvent","MinorGC","Rasterize"]},"{\"meta\":{\"abi\":\"x86_64-gcc3\",\"interval\":1,\"misc\":\"rv:48.0\",\"oscpu\":\"Intel Mac OS X 10.11\",\"platform\":\"Macintosh\",\"processType\":2,\"product\":\"Firefox\",\"stackwalk\":1,\"startTime\":1460221353723.438,\"toolkit\":\"cocoa\",\"version\":4},\"libs\":[{\"breakpadId\":\"9F950E2CE3CD3E1ABD06D80788B606E60\",\"debugName\":\"firefox-webcontent\",\"name\":\"firefox-webcontent\",\"path\":\"/Applications/FirefoxNightly.app/Contents/MacOS/firefox-webcontent.app/Contents/MacOS/firefox-webcontent\",\"start\":4294967296,\"end\":4294977296,\"arch\":\"x86_64\"},{\"breakpadId\":\"1000000000000000000000000000000A1\",\"debugName\":\"examplebinary\",\"name\":\"examplebinary\",\"path\":\"/tmp/examplebinary\",\"start\":8589934592,\"end\":8589934612,\"arch\":\"x86_64\"},{\"breakpadId\":\"100000000000000000000000000000A27\",\"debugName\":\"examplebinary2.pdb\",\"name\":\"examplebinary2\",\"path\":\"C:\\\\examplebinary2\",\"start\":8589934612,\"end\":8589934632,\"arch\":\"x86_64\"}],\"threads\":[{\"name\":\"GeckoMain\",\"processType\":\"tab\",\"samples\":{\"schema\":{\"stack\":0,\"time\":1,\"responsiveness\":2,\"rss\":3,\"uss\":4,\"frameNumber\":5,\"power\":6},\"data\":[[1,0,0],[2,1,0],[2,2,0],[3,3,0],[0,4,0],[1,5,0],[4,6,0]]},\"stackTable\":{\"schema\":{\"prefix\":0,\"frame\":1},\"data\":[[null,0],[0,1],[1,2],[1,3],[1,4]]},\"frameTable\":{\"schema\":{\"location\":0,\"implementation\":1,\"optimizations\":2,\"line\":3,\"category\":4},\"data\":[[0],[1],[2],[3,null,null,4391,16],[7,6,null,34]]},\"markers\":{\"schema\":{\"name\":0,\"time\":1,\"data\":2},\"data\":[[4,0,{\"category\":\"VsyncTimestamp\",\"vsync\":0}],[5,2,{\"category\":\"Paint\",\"interval\":\"start\",\"stack\":{\"markers\":{\"schema\":{\"name\":0,\"time\":1,\"data\":2},\"data\":[]},\"name\":\"SyncProfile\",\"samples\":{\"schema\":{\"stack\":0,\"time\":1,\"responsiveness\":2,\"rss\":3,\"uss\":4,\"frameNumber\":5,\"power\":6},\"data\":[[2,1]]}},\"type\":\"tracing\"}],[10,4,{\"category\":\"Paint\",\"interval\":\"start\",\"type\":\"tracing\"}],[10,5,{\"category\":\"Paint\",\"interval\":\"end\",\"type\":\"tracing\"}],[5,8,{\"category\":\"Paint\",\"interval\":\"end\",\"type\":\"tracing\"}],[9,11,{\"startTime\":11,\"endTime\":12}],[8,9,{\"startTime\":9,\"endTime\":10,\"type\":\"mouseout\",\"phase\":3}]]},\"stringTable\":[\"(root)\",\"0x100000f84\",\"0x100001a45\",\"Startup::XRE_Main\",\"VsyncTimestamp\",\"Reflow\",\"baseline\",\"frobnicate (chrome://blargh:34)\",\"DOMEvent\",\"MinorGC\",\"Rasterize\"]}]}"]}

0 comments on commit 9f85b90

Please sign in to comment.