Skip to content

Commit 5ff1d9d

Browse files
committed
fix logging
1 parent 7c5bf53 commit 5ff1d9d

File tree

2 files changed

+23
-20
lines changed

2 files changed

+23
-20
lines changed

webdriver-ts/src/forkedBenchmarkRunnerPuppeteer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ async function runCPUBenchmark(framework: FrameworkData, benchmark: CPUBenchmark
143143
console.log("**** resultScript = ", resultScript);
144144
if (m2.Timestamp == m1.Timestamp) throw new Error("Page metrics timestamp didn't change");
145145
results.push({total:result.duration, script: resultScript});
146-
console.log(`duration for ${framework.name} and ${benchmark.benchmarkInfo.id}: ${result}`);
146+
console.log(`duration for ${framework.name} and ${benchmark.benchmarkInfo.id}: ${JSON.stringify(result)}`);
147147
if (result.duration < 0)
148148
throw new Error(`duration ${result} < 0`);
149149
}

webdriver-ts/src/timeline.ts

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -154,32 +154,29 @@ interface Timingresult {
154154
// The PID for the click event. We're dropping all events from other processes.
155155
let pid = click.pid;
156156
let eventsDuringBenchmark = R.filter((e: Timingresult) => (e.ts > click.end || e.type === 'click'))(events);
157+
if (config.LOG_DETAILS) logEvents(eventsDuringBenchmark, click);
157158

158159
let droppedNonMainProcessCommitEvents = false;
159160
let droppedNonMainProcessOtherEvents = false;
160161
let eventsOnMainThreadDuringBenchmark = R.filter((e: Timingresult) => e.pid === pid)(eventsDuringBenchmark);
161162
if (eventsOnMainThreadDuringBenchmark.length !== eventsDuringBenchmark.length) {
162163
let droppedEvents = R.filter((e: Timingresult) => e.pid !== pid)(events);
163-
console.log("droppedEvents:")
164-
logEvents(droppedEvents, click);
165164
if (R.any((e: Timingresult) => e.type === 'commit')(droppedEvents)) {
166165
console.log("INFO: Dropping commit events from other processes", fileName);
166+
logEvents(droppedEvents, click);
167167
droppedNonMainProcessCommitEvents = true
168168
}
169169
if (R.any((e: Timingresult) => e.type !== 'commit')(droppedEvents)) {
170170
console.log("INFO: Dropping non-commit events from other processes", fileName);
171+
logEvents(droppedEvents, click);
171172
droppedNonMainProcessOtherEvents = true;
172173
}
173174
}
174175

175176
let startFrom = (R.filter(type_eq('click','fireAnimationFrame', 'timerFire', 'layout','functioncall'))(eventsOnMainThreadDuringBenchmark));
176177
// we're looking for the commit after this event
177178
let startFromEvent = startFrom[startFrom.length-1];
178-
console.log("DEBUG: searching for commit event after", startFromEvent,"for", fileName);
179-
if (startFromEvent.type == 'functioncall') {
180-
console.log("INFO: Commit event is searched after a functioncall event ",fileName);
181-
logEvents(eventsOnMainThreadDuringBenchmark, click);
182-
}
179+
if (config.LOG_DETAILS) console.log("DEBUG: searching for commit event after", startFromEvent,"for", fileName);
183180
let commit = R.find((e: Timingresult) => e.ts > startFromEvent.end)(R.filter(type_eq('commit'))(eventsOnMainThreadDuringBenchmark));
184181
let allCommitsAfterClick = (R.filter(type_eq('commit'))(eventsOnMainThreadDuringBenchmark));
185182

@@ -277,21 +274,27 @@ interface Timingresult {
277274

278275
print() {
279276
console.log("\n==== Results of PlausibilityCheck:");
280-
console.log("Info: The following implementation had a unnecessary layout event for select row:");
281-
for (let [impl,maxDelay] of this.maxDeltaBetweenCommits.entries()) {
282-
if (maxDelay>0) console.log(` ${impl}: ${maxDelay}`);
277+
if (this.maxDeltaBetweenCommits.size>0) {
278+
console.log("Info: The following implementation had a unnecessary layout event for select row:");
279+
for (let [impl,maxDelay] of this.maxDeltaBetweenCommits.entries()) {
280+
if (maxDelay>0) console.log(` ${impl}: ${maxDelay}`);
281+
}
282+
console.log(" Interpretation: Just an information. Could be optimized, but not a bug in the implementation.");
283283
}
284-
console.log(" Interpretation: Just an information. Could be optimized, but not a bug in the implementation.");
285-
console.log("Info: Some frameworks have a delay between raf and fire animation frame longer than 16 msecs. The correction was:");
286-
for (let [impl,maxDelay] of this.raf_long_delays.entries()) {
287-
if (maxDelay>0) console.log(` ${impl}: ${maxDelay}`);
284+
if (this.raf_long_delays.size>0) {
285+
console.log("Info: Some frameworks have a delay between raf and fire animation frame longer than 16 msecs. The correction was:");
286+
for (let [impl,maxDelay] of this.raf_long_delays.entries()) {
287+
if (maxDelay>0) console.log(` ${impl}: ${maxDelay}`);
288+
}
289+
console.log(" Interpretation: If the list contains more than just a few entries or large numbers the results should be checked");
288290
}
289-
console.log(" Interpretation: If the list contains more than just a few entries or large numbers the results should be checked");
290-
console.log("Warning: Implemenations with multiple commit events:");
291-
for (let [impl,maxDelay] of this.maxDeltaBetweenCommits.entries()) {
292-
if (maxDelay>0) console.log(` ${impl}: ${maxDelay}`);
291+
if (this.maxDeltaBetweenCommits.size>0) {
292+
console.log("Info: Implemenations with multiple commit events and max delay between both:");
293+
for (let [impl,maxDelay] of this.maxDeltaBetweenCommits.entries()) {
294+
if (maxDelay>0) console.log(` ${impl}: ${maxDelay}`);
295+
}
296+
console.log(" Interpretation: Those frameworks make measuring the duration of the benchmark difficult. The results should be checked occasionally for correctness.");
293297
}
294-
console.log(" Interpretation: Those frameworks make measuring the duration of the benchmark difficult. The results should be checked occasionally for correctness.");
295298
}
296299
}
297300

0 commit comments

Comments
 (0)