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

Tracy-based expr evaluation profiler #9967

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Tracing EvalState members
Two expressions evaluations seem to be contained in the EvalState
class. Tracing them as well through a new macro.
  • Loading branch information
picnoir committed Feb 8, 2024
commit b35cc131af64be9d705c141a81ee41fde5123302
7 changes: 7 additions & 0 deletions src/libexpr/eval.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@
tracyss << evalstate.positions[(expr)->getPos()] << " " << (expr)->showExprType(); \
ZoneTransientN(nix, tracyss.str().c_str(), true);

#define TRACY_TRACE_TYPE_STR(evalstate, expr, typestr) \
std::ostringstream tracyss; \
tracyss << (evalstate).positions[(expr)->getPos()] << " " << typestr; \
ZoneTransientN(nix, tracyss.str().c_str(), true);

using json = nlohmann::json;

namespace nix {
Expand Down Expand Up @@ -1169,6 +1174,7 @@ void EvalState::eval(Expr * e, Value & v)

inline bool EvalState::evalBool(Env & env, Expr * e, const PosIdx pos, std::string_view errorCtx)
{
TRACY_TRACE_TYPE_STR(*this, e, "bool")
try {
Value v;
e->eval(*this, env, v);
Expand All @@ -1187,6 +1193,7 @@ inline bool EvalState::evalBool(Env & env, Expr * e, const PosIdx pos, std::stri

inline void EvalState::evalAttrs(Env & env, Expr * e, Value & v, const PosIdx pos, std::string_view errorCtx)
{
TRACY_TRACE_TYPE_STR(*this, e, "attrs")
try {
e->eval(*this, env, v);
if (v.type() != nAttrs)
Expand Down