Skip to content

Commit

Permalink
correct termination reason from timer_thread
Browse files Browse the repository at this point in the history
  • Loading branch information
quickbeam123 committed Jan 7, 2025
1 parent 1dc0e45 commit ec0d8cf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Lib/Timer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ static std::chrono::time_point<std::chrono::steady_clock> START_TIME;
unsigned limit = env.options->timeLimitInDeciseconds();
while(true) {
if(limit && Timer::elapsedDeciseconds() >= limit) {
// in principle could have a race on terminationReason, seems unlikely/harmless in practice
env.statistics->terminationReason = Shell::Statistics::TIME_LIMIT;
limitReached(TIME_LIMIT);
}

Expand All @@ -123,7 +125,7 @@ static std::chrono::time_point<std::chrono::steady_clock> START_TIME;
Timer::updateInstructionCount();
if (env.options->instructionLimit() && LAST_INSTRUCTION_COUNT_READ >= MEGA*(long long)env.options->instructionLimit()) {
// in principle could have a race on terminationReason, seems unlikely/harmless in practice
env.statistics->terminationReason = Shell::Statistics::TIME_LIMIT;
env.statistics->terminationReason = Shell::Statistics::INSTUCTION_LIMIT;
limitReached(INSTRUCTION_LIMIT);
}
}
Expand Down
4 changes: 4 additions & 0 deletions Shell/Statistics.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,8 @@ class Statistics {
UNKNOWN,
/** time limit reached */
TIME_LIMIT,
/** instruction limit reached */
INSTRUCTION_LIMIT,
/** memory limit reached */
MEMORY_LIMIT,
/** activation limit reached */
Expand All @@ -314,6 +316,8 @@ class Statistics {
return out << "UNKNOWN";
case TIME_LIMIT:
return out << "TIME_LIMIT";
case INSTRUCTION_LIMIT:
return out << "INSTRUCTION_LIMIT";
case MEMORY_LIMIT:
return out << "MEMORY_LIMIT";
case ACTIVATION_LIMIT:
Expand Down

0 comments on commit ec0d8cf

Please sign in to comment.