Skip to content

Commit

Permalink
Use a 10ms sampling frequency to filter tracing dumps
Browse files Browse the repository at this point in the history
Currently hard-wired to 10ms, can be made configurable if needed later.
  • Loading branch information
elibarzilay committed Feb 8, 2021
1 parent f462576 commit fe2899c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/compiler/tracing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,15 @@ namespace ts.tracingEnabled { // eslint-disable-line one-namespace-per-file
}
eventStack.length = 0;
}
// sample every 10ms
const sampleInterval = 1000 * 10;
function writeStackEvent(index: number, endTime: number) {
const { phase, name, args, time, separateBeginAndEnd } = eventStack[index];
if (separateBeginAndEnd) {
writeEvent("E", phase, name, args, /*extras*/ undefined, endTime);
}
else {
// test if [time,endTime) straddles a sampling point
else if (sampleInterval - (time % sampleInterval) <= endTime - time) {
writeEvent("X", phase, name, args, `"dur":${endTime - time}`, time);
}
}
Expand Down

0 comments on commit fe2899c

Please sign in to comment.