Skip to content

Commit

Permalink
nix search: Restore output
Browse files Browse the repository at this point in the history
  • Loading branch information
edolstra committed Jun 13, 2024
1 parent 5c6eb1a commit 3353f9a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
10 changes: 6 additions & 4 deletions src/libexpr/eval.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2671,10 +2671,12 @@ void EvalState::maybePrintStats()
printStatistics();
}

printError("THUNKS AWAITED: %d", nrThunksAwaited);
printError("THUNKS AWAITED SLOW: %d", nrThunksAwaitedSlow);
printError("WAITING TIME: %d μs", usWaiting);
printError("MAX WAITING: %d", maxWaiting);
if (getEnv("NIX_SHOW_THREAD_STATS").value_or("0") != "0") {
printError("THUNKS AWAITED: %d", nrThunksAwaited);
printError("THUNKS AWAITED SLOW: %d", nrThunksAwaitedSlow);
printError("WAITING TIME: %d μs", usWaiting);
printError("MAX WAITING: %d", maxWaiting);
}
}

void EvalState::printStatistics()
Expand Down
5 changes: 2 additions & 3 deletions src/libexpr/parallel-eval.hh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct Executor
Executor()
{
auto nrCores = string2Int<size_t>(getEnv("NR_CORES").value_or("1")).value_or(1);
printError("USING %d THREADS", nrCores);
debug("executor using %d threads", nrCores);
auto state(state_.lock());
for (size_t n = 0; n < nrCores; ++n)
state->threads.push_back(std::thread([&]()
Expand All @@ -66,7 +66,7 @@ struct Executor
auto state(state_.lock());
state->quit = true;
std::swap(threads, state->threads);
printError("%d ITEMS LEFT", state->queue.size());
debug("executor shutting down with %d items left", state->queue.size());
}

wakeup.notify_all();
Expand All @@ -91,7 +91,6 @@ struct Executor
state.wait(wakeup);
}

//printError("EXEC");
try {
item.work();
item.promise.set_value();
Expand Down
14 changes: 6 additions & 8 deletions src/nix/search.cc
Original file line number Diff line number Diff line change
Expand Up @@ -190,16 +190,14 @@ struct CmdSearch : InstallableValueCommand, MixJSON
};
} else {
auto name2 = hiliteMatches(name.name, nameMatches, ANSI_GREEN, "\e[0;2m");
#if 0
if (results > 1) logger->cout("");
logger->cout(
"* %s%s",
auto out = fmt(
"%s* %s%s",
results > 1 ? "\n" : "",
wrap("\e[0;1m", hiliteMatches(attrPath2, attrPathMatches, ANSI_GREEN, "\e[0;1m")),
name.version != "" ? " (" + name.version + ")" : "");
if (description != "")
logger->cout(
" %s", hiliteMatches(description, descriptionMatches, ANSI_GREEN, ANSI_NORMAL));
#endif
out += fmt("\n %s", hiliteMatches(description, descriptionMatches, ANSI_GREEN, ANSI_NORMAL));
logger->cout(out);
}
}
}
Expand Down Expand Up @@ -242,7 +240,7 @@ struct CmdSearch : InstallableValueCommand, MixJSON
auto state(state_.lock());
std::swap(futures, state->futures);
}
printError("GOT %d FUTURES", futures.size());
debug("got %d futures", futures.size());
if (futures.empty())
break;
for (auto & future : futures)
Expand Down

0 comments on commit 3353f9a

Please sign in to comment.