Skip to content

Commit 3c7da68

Browse files
committed
Bug 1880373 - make ProcInfo use the high precision code path in automation even without constant tsc, r=gerard-majax.
Depends on D201883 Differential Revision: https://phabricator.services.mozilla.com/D201884
1 parent ab55e0b commit 3c7da68

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

toolkit/components/processtools/ProcInfo_win.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <windows.h>
1414
#include <psapi.h>
1515
#include <winternl.h>
16+
#include <xpcpublic.h>
1617

1718
#ifndef STATUS_INFO_LENGTH_MISMATCH
1819
# define STATUS_INFO_LENGTH_MISMATCH ((NTSTATUS)0xC0000004L)
@@ -34,7 +35,10 @@ static uint64_t ToNanoSeconds(const FILETIME& aFileTime) {
3435
int GetCycleTimeFrequencyMHz() {
3536
static const int frequency = []() {
3637
// Having a constant TSC is required to convert cycle time to actual time.
37-
if (!mozilla::has_constant_tsc()) {
38+
// In automation, having short CPU times reported as 0 is more of a problem
39+
// than having an imprecise value. The fallback method can't report CPU
40+
// times < 1/64s.
41+
if (!mozilla::has_constant_tsc() && !xpc::IsInAutomation()) {
3842
return 0;
3943
}
4044

0 commit comments

Comments
 (0)