fix(benchpress): support `tdur` in events

This commit is contained in:
Tobias Bosch 2015-02-24 16:37:45 -08:00
parent cde8ffd6d9
commit b0c6db1efb
2 changed files with 16 additions and 1 deletions

View File

@ -116,7 +116,11 @@ function normalizeEvent(chromeEvent, data) {
'ts': chromeEvent['ts'] / 1000 'ts': chromeEvent['ts'] / 1000
}; };
if (chromeEvent['ph'] === 'X') { if (chromeEvent['ph'] === 'X') {
result['dur'] = chromeEvent['dur'] / 1000; var dur = chromeEvent['dur'];
if (isBlank(dur)) {
dur = chromeEvent['tdur'];
}
result['dur'] = isBlank(dur) ? 0.0 : dur / 1000;
} }
StringMapWrapper.forEach(data, (value, prop) => { StringMapWrapper.forEach(data, (value, prop) => {
result[prop] = value; result[prop] = value;

View File

@ -83,6 +83,17 @@ export function main() {
}); });
}); });
it('should normalize "tdur" to "dur"', (done) => {
var event = chromeTimelineEvents.create('X', 'FunctionCall', 1100, null);
event['tdur'] = 5500;
createExtension([event]).readPerfLog().then( (events) => {
expect(events).toEqual([
normEvents.complete('script', 1.1, 5.5, null),
]);
done();
});
});
it('should report FunctionCall events as "script"', (done) => { it('should report FunctionCall events as "script"', (done) => {
createExtension([ createExtension([
chromeTimelineEvents.start('FunctionCall', 0) chromeTimelineEvents.start('FunctionCall', 0)