From cffa7bb98ac2df5d1146318fe19e039bf05aa3a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Baylac-Jacqu=C3=A9?= Date: Mon, 21 Oct 2019 20:54:42 +0200 Subject: [PATCH] wip --- src/libexpr/eval.cc | 16 +++++++++++++--- src/libexpr/eval.hh | 38 +------------------------------------- 2 files changed, 14 insertions(+), 40 deletions(-) diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index 6210c654..a4ddc108 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -1017,8 +1017,10 @@ void ExprSelect::eval(EvalState & state, Env & env, Value & v) pos2 = j->pos; if (state.countCalls && pos2) state.attrSelects[*pos2]++; } - + state.profState.nestedLevel++; + state.profState.printNestedStuff(*this); state.forceValue(*vAttrs, ( pos2 != NULL ? *pos2 : this->pos ) ); + state.profState.nestedLevel--; } catch (Error & e) { if (pos2 && pos2->file != state.sDerivationNix) @@ -2051,7 +2053,7 @@ void ProfilerState::printNestedStuff(Symbol& name) { for(int i=0;i stackedMeasurements; @@ -332,7 +333,6 @@ public: void printStats(); void realiseContext(const PathSet & context); - ProfilerState profState; private: @@ -380,42 +380,6 @@ typedef int CompressedFuncId; typedef int CompressedFileId; typedef int LineNumber; -struct ProfFuncOcc { - CompressedFuncId funcId; - CompressedFileId fileId; -}; - -struct ProfFuncCall { - CompressedFuncId calledFunc; - CompressedFileId calledFile; - LineNumber calledFuncLineNb; - int cost; -}; - -struct ProfCostOcc { - ProfFuncOcc funcOcc; - int selfCost; - std::vector calledFunctions; -}; - -class ProfilerState { - -public: - ProfCostOcc& getFuncOcc(FileName& fName, FunctionName& fnName); - void saveCost(ProfCostOcc& occCost); - -private: - std::vector stackedMeasurements; - string funcName; - int currentNestedLevel; - /* We index every func and file to leverage Callgrind's string compression. - See section "3.1.6.�Subposition Compression" section from [callgrindSpec]. */ - std::map funcMap; - std::map fileMap; - CompressedFuncId currentFuncId; - CompressedFileId currentFileId; -}; - /* Return a string representing the type of the value `v'. */ string showType(const Value & v);