printStats -> maybePrintStats

This commit is contained in:
Robert Hensing 2023-10-09 16:25:53 +02:00
parent f95364a803
commit c32084a12c
6 changed files with 6 additions and 6 deletions

View file

@ -98,7 +98,7 @@ EvalCommand::EvalCommand()
EvalCommand::~EvalCommand() EvalCommand::~EvalCommand()
{ {
if (evalState) if (evalState)
evalState->printStats(); evalState->maybePrintStats();
} }
ref<Store> EvalCommand::getEvalStore() ref<Store> EvalCommand::getEvalStore()

View file

@ -2491,7 +2491,7 @@ bool EvalState::fullGC() {
#endif #endif
} }
void EvalState::printStats() void EvalState::maybePrintStats()
{ {
bool showStats = getEnv("NIX_SHOW_STATS").value_or("0") != "0"; bool showStats = getEnv("NIX_SHOW_STATS").value_or("0") != "0";

View file

@ -714,7 +714,7 @@ public:
* Performs a full memory GC before printing the statistics, so that the * Performs a full memory GC before printing the statistics, so that the
* GC statistics are more accurate. * GC statistics are more accurate.
*/ */
void printStats(); void maybePrintStats();
/** /**
* Print statistics, unconditionally, cheaply, without performing a GC first. * Print statistics, unconditionally, cheaply, without performing a GC first.

View file

@ -344,7 +344,7 @@ static void main_nix_build(int argc, char * * argv)
} }
} }
state->printStats(); state->maybePrintStats();
auto buildPaths = [&](const std::vector<DerivedPath> & paths) { auto buildPaths = [&](const std::vector<DerivedPath> & paths) {
/* Note: we do this even when !printMissing to efficiently /* Note: we do this even when !printMissing to efficiently

View file

@ -1531,7 +1531,7 @@ static int main_nix_env(int argc, char * * argv)
op(globals, std::move(opFlags), std::move(opArgs)); op(globals, std::move(opFlags), std::move(opArgs));
globals.state->printStats(); globals.state->maybePrintStats();
return 0; return 0;
} }

View file

@ -189,7 +189,7 @@ static int main_nix_instantiate(int argc, char * * argv)
evalOnly, outputKind, xmlOutputSourceLocation, e); evalOnly, outputKind, xmlOutputSourceLocation, e);
} }
state->printStats(); state->maybePrintStats();
return 0; return 0;
} }