Skip to content
Draft
Show file tree
Hide file tree
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
30 changes: 29 additions & 1 deletion src/libexpr/eval.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2955,7 +2955,35 @@ void EvalState::printStatistics()
{"elements", memstats.nrValuesInEnvs.load()},
{"bytes", bEnvs},
};
topObj["nrExprs"] = Expr::nrExprs.load();
topObj["nrExprs"] = {
{"total", Expr::nrCreated.load()},
{"ExprInt", ExprInt::nrCreated.load()},
{"ExprFloat", ExprFloat::nrCreated.load()},
{"ExprString", ExprString::nrCreated.load()},
{"ExprPath", ExprPath::nrCreated.load()},
{"ExprVar", ExprVar::nrCreated.load()},
{"ExprInheritFrom", ExprInheritFrom::nrCreated.load()},
{"ExprSelect", ExprSelect::nrCreated.load()},
{"ExprOpHasAttr", ExprOpHasAttr::nrCreated.load()},
{"ExprAttr", ExprAttrs::nrCreated.load()},
{"ExprList", ExprList::nrCreated.load()},
{"ExprLambda", ExprLambda::nrCreated.load()},
{"ExprCall", ExprCall::nrCreated.load()},
{"ExprLet", ExprLet::nrCreated.load()},
{"ExprWith", ExprWith::nrCreated.load()},
{"ExprIf", ExprIf::nrCreated.load()},
{"ExprAssert", ExprAssert::nrCreated.load()},
{"ExprOpNot", ExprOpNot::nrCreated.load()},
{"ExprConcatStrings", ExprConcatStrings::nrCreated.load()},
{"ExprPos", ExprPos::nrCreated.load()},
{"ExprOpEq", ExprOpEq::nrCreated.load()},
{"ExprOpNEq", ExprOpNEq::nrCreated.load()},
{"ExprOpAnd", ExprOpAnd::nrCreated.load()},
{"ExprOpOr", ExprOpOr::nrCreated.load()},
{"ExprOpImpl", ExprOpImpl::nrCreated.load()},
{"ExprOpConcatLists", ExprOpConcatLists::nrCreated.load()},
{"ExprOpUpdate", ExprOpUpdate::nrCreated.load()},
Comment on lines +2959 to +2985
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds like this could really benefit from some macro like NIX_VALUE_STORAGE_FOR_EACH_FIELD to make listing all the expr types less error-prone.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose... although there's only 2 places where this happens and macros are error-prone in their own ways.

};
topObj["list"] = {
{"elements", memstats.nrListElems.load()},
{"bytes", bLists},
Expand Down
Loading
Loading