Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HPCC-32951 System may crash at startup on debug builds on Mac #19277

Merged
merged 1 commit into from
Nov 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 7 additions & 12 deletions system/jlib/jdebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ static __int64 numScaleTicks;
static bool useRDTSC = _USE_RDTSC;
static double cycleToNanoScale;

static void calibrate_timing()
static bool calibrate_timing()
{
#ifndef _AMD64_
if (useRDTSC)
Expand Down Expand Up @@ -234,7 +234,7 @@ static void calibrate_timing()
if (numPerUS>0)
{
cycleToNanoScale = 1000.0 / numPerUS;
return;
return true;
}
}
DBGLOG("calibrate_timing failed using RDTSC");
Expand All @@ -257,6 +257,7 @@ static void calibrate_timing()
cycle_t a2 = getTSC();
numCyclesNTicks = (a2 - a1);
cycleToNanoScale = ((double)numScaleTicks * 1000000000.0) / ((double)numCyclesNTicks * ticksPerSec);
return true;
}

__int64 cycle_to_nanosec(cycle_t cycles)
Expand Down Expand Up @@ -304,7 +305,7 @@ static double cycleToNanoScale;
static double cycleToMicroScale;
static double cycleToMilliScale;

void calibrate_timing()
static bool calibrate_timing()
{
#if defined(_ARCH_X86_) || defined(_ARCH_X86_64_)
if (useRDTSC) {
Expand Down Expand Up @@ -347,7 +348,7 @@ void calibrate_timing()
cycleToNanoScale = 1000.0 / numPerUS;
cycleToMicroScale = 1.0 / numPerUS;
cycleToMilliScale = 0.001 / numPerUS;
return;
return true;
}
}
IERRLOG("calibrate_timing failed using RDTSC");
Expand All @@ -364,6 +365,7 @@ void calibrate_timing()
cycleToMicroScale = cycleToNanoScale/1000.0;
cycleToMilliScale = cycleToNanoScale/1000000.0;
#endif
return true;
}


Expand Down Expand Up @@ -647,14 +649,7 @@ ITimeReporter * queryActiveTimer()

ITimeReporter *createStdTimeReporter() { return new DefaultTimeReporter(); }

cycle_t oneSecInCycles;
MODULE_INIT(INIT_PRIORITY_JDEBUG1)
{
// perform v. early in process startup, ideally this would grab process exclusively for the 2 100ths of a sec it performs calc.
calibrate_timing();
oneSecInCycles = nanosec_to_cycle(1000000000);
return 1;
}
cycle_t oneSecInCycles = calibrate_timing() ? nanosec_to_cycle(1000000000) : 0;

MODULE_INIT(INIT_PRIORITY_JDEBUG2)
{
Expand Down
Loading