forked from lix-project/lix
Add some more evaluations stats
This commit is contained in:
parent
e82767910c
commit
62f72eb9e1
|
@ -144,6 +144,7 @@ EvalState::EvalState()
|
||||||
{
|
{
|
||||||
nrEnvs = nrValuesInEnvs = nrValues = nrListElems = 0;
|
nrEnvs = nrValuesInEnvs = nrValues = nrListElems = 0;
|
||||||
nrAttrsets = nrOpUpdates = nrOpUpdateValuesCopied = 0;
|
nrAttrsets = nrOpUpdates = nrOpUpdateValuesCopied = 0;
|
||||||
|
nrListConcats = nrPrimOpCalls = nrFunctionCalls = 0;
|
||||||
countCalls = getEnv("NIX_COUNT_CALLS", "0") != "0";
|
countCalls = getEnv("NIX_COUNT_CALLS", "0") != "0";
|
||||||
|
|
||||||
#if HAVE_BOEHMGC
|
#if HAVE_BOEHMGC
|
||||||
|
@ -705,6 +706,7 @@ void EvalState::callFunction(Value & fun, Value & arg, Value & v)
|
||||||
vArgs[n--] = arg->primOpApp.right;
|
vArgs[n--] = arg->primOpApp.right;
|
||||||
|
|
||||||
/* And call the primop. */
|
/* And call the primop. */
|
||||||
|
nrPrimOpCalls++;
|
||||||
if (countCalls) primOpCalls[primOp->primOp->name]++;
|
if (countCalls) primOpCalls[primOp->primOp->name]++;
|
||||||
try {
|
try {
|
||||||
primOp->primOp->fun(*this, vArgs, v);
|
primOp->primOp->fun(*this, vArgs, v);
|
||||||
|
@ -766,6 +768,7 @@ void EvalState::callFunction(Value & fun, Value & arg, Value & v)
|
||||||
throwTypeError("function at %1% called with unexpected argument", fun.lambda.fun->pos);
|
throwTypeError("function at %1% called with unexpected argument", fun.lambda.fun->pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nrFunctionCalls++;
|
||||||
if (countCalls) functionCalls[fun.lambda.fun->pos]++;
|
if (countCalls) functionCalls[fun.lambda.fun->pos]++;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -909,6 +912,7 @@ void ExprOpUpdate::eval(EvalState & state, Env & env, Value & v)
|
||||||
|
|
||||||
void ExprOpConcatLists::eval(EvalState & state, Env & env, Value & v)
|
void ExprOpConcatLists::eval(EvalState & state, Env & env, Value & v)
|
||||||
{
|
{
|
||||||
|
state.nrListConcats++;
|
||||||
Value v1; e1->eval(state, env, v1);
|
Value v1; e1->eval(state, env, v1);
|
||||||
state.forceList(v1);
|
state.forceList(v1);
|
||||||
Value v2; e2->eval(state, env, v2);
|
Value v2; e2->eval(state, env, v2);
|
||||||
|
@ -1215,6 +1219,7 @@ void EvalState::printStats()
|
||||||
% nrEnvs % (nrEnvs * sizeof(Env) + nrValuesInEnvs * sizeof(Value *)));
|
% nrEnvs % (nrEnvs * sizeof(Env) + nrValuesInEnvs * sizeof(Value *)));
|
||||||
printMsg(v, format(" list elements: %1% (%2% bytes)")
|
printMsg(v, format(" list elements: %1% (%2% bytes)")
|
||||||
% nrListElems % (nrListElems * sizeof(Value *)));
|
% nrListElems % (nrListElems * sizeof(Value *)));
|
||||||
|
printMsg(v, format(" list concatenations: %1%") % nrListConcats);
|
||||||
printMsg(v, format(" values allocated: %1% (%2% bytes)")
|
printMsg(v, format(" values allocated: %1% (%2% bytes)")
|
||||||
% nrValues % (nrValues * sizeof(Value)));
|
% nrValues % (nrValues * sizeof(Value)));
|
||||||
printMsg(v, format(" attribute sets allocated: %1%") % nrAttrsets);
|
printMsg(v, format(" attribute sets allocated: %1%") % nrAttrsets);
|
||||||
|
@ -1224,6 +1229,8 @@ void EvalState::printStats()
|
||||||
printMsg(v, format(" number of thunks: %1%") % nrThunks);
|
printMsg(v, format(" number of thunks: %1%") % nrThunks);
|
||||||
printMsg(v, format(" number of thunks avoided: %1%") % nrAvoided);
|
printMsg(v, format(" number of thunks avoided: %1%") % nrAvoided);
|
||||||
printMsg(v, format(" number of attr lookups: %1%") % nrLookups);
|
printMsg(v, format(" number of attr lookups: %1%") % nrLookups);
|
||||||
|
printMsg(v, format(" number of primop calls: %1%") % nrPrimOpCalls);
|
||||||
|
printMsg(v, format(" number of function calls: %1%") % nrFunctionCalls);
|
||||||
|
|
||||||
if (countCalls) {
|
if (countCalls) {
|
||||||
|
|
||||||
|
|
|
@ -236,7 +236,7 @@ public:
|
||||||
void printStats();
|
void printStats();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
unsigned long nrEnvs;
|
unsigned long nrEnvs;
|
||||||
unsigned long nrValuesInEnvs;
|
unsigned long nrValuesInEnvs;
|
||||||
unsigned long nrValues;
|
unsigned long nrValues;
|
||||||
|
@ -244,6 +244,9 @@ private:
|
||||||
unsigned long nrAttrsets;
|
unsigned long nrAttrsets;
|
||||||
unsigned long nrOpUpdates;
|
unsigned long nrOpUpdates;
|
||||||
unsigned long nrOpUpdateValuesCopied;
|
unsigned long nrOpUpdateValuesCopied;
|
||||||
|
unsigned long nrListConcats;
|
||||||
|
unsigned long nrPrimOpCalls;
|
||||||
|
unsigned long nrFunctionCalls;
|
||||||
|
|
||||||
bool countCalls;
|
bool countCalls;
|
||||||
|
|
||||||
|
@ -257,6 +260,7 @@ private:
|
||||||
AttrSelects attrSelects;
|
AttrSelects attrSelects;
|
||||||
|
|
||||||
friend class ExprOpUpdate;
|
friend class ExprOpUpdate;
|
||||||
|
friend class ExprOpConcatLists;
|
||||||
friend class ExprSelect;
|
friend class ExprSelect;
|
||||||
friend void prim_getAttr(EvalState & state, Value * * args, Value & v);
|
friend void prim_getAttr(EvalState & state, Value * * args, Value & v);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue