mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1154115 - Fix nsIProfiler xpcshell tests to use the new profiler JSON format. (r=me)
This commit is contained in:
parent
eb738eaf89
commit
a3a11f635f
@ -6,3 +6,26 @@ const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
const Cu = Components.utils;
|
||||
|
||||
function getInflatedStackLocations(thread, sample) {
|
||||
let stackTable = thread.stackTable;
|
||||
let frameTable = thread.frameTable;
|
||||
let stringTable = thread.stringTable;
|
||||
let SAMPLE_STACK_SLOT = thread.samples.schema.stack;
|
||||
let STACK_PREFIX_SLOT = stackTable.schema.prefix;
|
||||
let STACK_FRAME_SLOT = stackTable.schema.frame;
|
||||
let FRAME_LOCATION_SLOT = frameTable.schema.location;
|
||||
|
||||
// Build the stack from the raw data and accumulate the locations in
|
||||
// an array.
|
||||
let stackIndex = sample[SAMPLE_STACK_SLOT];
|
||||
let locations = [];
|
||||
while (stackIndex !== null) {
|
||||
let stackEntry = stackTable.data[stackIndex];
|
||||
let frame = frameTable.data[stackEntry[STACK_FRAME_SLOT]];
|
||||
locations.push(stringTable[frame[FRAME_LOCATION_SLOT]]);
|
||||
stackIndex = stackEntry[STACK_PREFIX_SLOT];
|
||||
}
|
||||
|
||||
// The profiler tree is inverted, so reverse the array.
|
||||
return locations.reverse();
|
||||
}
|
||||
|
@ -28,17 +28,18 @@ function run_test() {
|
||||
let then = Date.now();
|
||||
do {} while (Date.now() - then < delayMS);
|
||||
|
||||
var profile = p.getProfileData().threads[0].samples;
|
||||
var thread0 = p.getProfileData().threads[0];
|
||||
|
||||
if (delayMS > 30000)
|
||||
return;
|
||||
|
||||
delayMS *= 2;
|
||||
|
||||
if (profile.length == 0)
|
||||
if (thread0.samples.data.length == 0)
|
||||
continue;
|
||||
|
||||
stack = String(profile[profile.length - 1].frames.map(f => f.location));
|
||||
var lastSample = thread0.samples.data[thread0.samples.data.length - 1];
|
||||
stack = String(getInflatedStackLocations(thread0, lastSample));
|
||||
if (stack.indexOf("trampoline") !== -1)
|
||||
return;
|
||||
}
|
||||
|
@ -30,8 +30,8 @@ function run_test() {
|
||||
while (--n); // OSR happens here
|
||||
// Spin in the hope of getting a sample.
|
||||
} while (Date.now() - then < delayMS);
|
||||
let pr = p.getProfileData().threads[0].samples;
|
||||
if (pr.length > 0 || delayMS > 30000)
|
||||
let pr = p.getProfileData().threads[0];
|
||||
if (pr.samples.data.length > 0 || delayMS > 30000)
|
||||
return pr;
|
||||
delayMS *= 2;
|
||||
}
|
||||
@ -39,8 +39,9 @@ function run_test() {
|
||||
|
||||
var profile = arbitrary_name();
|
||||
|
||||
do_check_neq(profile.length, 0);
|
||||
let stack = profile[profile.length - 1].frames.map(f => f.location);
|
||||
do_check_neq(profile.samples.data.length, 0);
|
||||
var lastSample = profile.samples.data[profile.samples.data.length - 1];
|
||||
var stack = getInflatedStackLocations(profile, lastSample);
|
||||
do_print(stack);
|
||||
|
||||
// All we can really check here is ensure that there is exactly
|
||||
|
Loading…
Reference in New Issue
Block a user