Skip to content

Commit 6009fcf

Browse files
committed
Idle samples should be kept to correctly estimate sampling period
1 parent 0633e88 commit 6009fcf

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

bindings/profilers/wall.cc

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -301,15 +301,6 @@ class ProfileTranslator {
301301
}
302302
};
303303

304-
bool isIdleSample(const CpuProfileNode* sample) {
305-
return
306-
#if NODE_MODULE_VERSION > NODE_12_0_MODULE_VERSION
307-
sample->GetParent() == nullptr &&
308-
#endif
309-
sample->GetChildrenCount() == 0 &&
310-
strncmp("(idle)", sample->GetFunctionNameStr(), 7) == 0;
311-
}
312-
313304
LabelSetsByNode WallProfiler::GetLabelSetsByNode(CpuProfile* profile,
314305
ContextBuffer& contexts) {
315306
LabelSetsByNode labelSetsByNode;
@@ -350,10 +341,6 @@ LabelSetsByNode WallProfiler::GetLabelSetsByNode(CpuProfile* profile,
350341
auto sampleIdx = i + deltaIdx;
351342
auto sample = profile->GetSample(sampleIdx);
352343

353-
if (isIdleSample(sample)) {
354-
continue;
355-
}
356-
357344
auto sampleTimestamp = profile->GetSampleTimestamp(sampleIdx);
358345

359346
// This loop will drop all contexts that are too old to be associated with

ts/test/test-time-profiler.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ describe('Time Profiler', () => {
120120
stringTable.dedup(x)
121121
);
122122

123+
assert(profile.period >= intervalNanos);
124+
assert(profile.period < 2 * intervalNanos);
123125
function labelIs(l: Label, str: number) {
124126
return l.key === labelIdx && l.str === str;
125127
}

0 commit comments

Comments
 (0)