зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1741355 - GeckoProfiler.CPUUsage: Force some busy work in otherwise idle thread, to ensure there are non-zero CPU values - r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D132433
This commit is contained in:
Родитель
ca46c4a669
Коммит
70e9daefeb
|
@ -4098,6 +4098,13 @@ TEST(GeckoProfiler, CPUUsage)
|
|||
// Sleep for multiple profiler intervals, so the profiler should have
|
||||
// samples with zero CPU utilization.
|
||||
PR_Sleep(PR_MillisecondsToInterval(PROFILER_DEFAULT_INTERVAL * 10));
|
||||
|
||||
// Do a busy wait for more than 1ms, to ensure that there are non-zero CPU
|
||||
// utilization periods.
|
||||
const TimeStamp target =
|
||||
TimeStamp::Now() + TimeDuration::FromMilliseconds(2);
|
||||
while (TimeStamp::Now() < target) {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче