wip
This commit is contained in:
parent
d2e7024eda
commit
cffa7bb98a
|
@ -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<nestedLevel;i++) {
|
||||
delim += "=";
|
||||
}
|
||||
std::cout << delim << " Going into " << name << std::endl;
|
||||
std::cout << " " << delim << name << std::endl;
|
||||
}
|
||||
|
||||
void ProfilerState::printNestedStuff(ExprVar& name) {
|
||||
|
@ -2059,7 +2061,15 @@ void ProfilerState::printNestedStuff(ExprVar& name) {
|
|||
for(int i=0;i<nestedLevel;i++) {
|
||||
delim += "=";
|
||||
}
|
||||
std::cout << delim << " Going into " << name << std::endl;
|
||||
std::cout << delim << " " << name << " (var)" << std::endl;
|
||||
}
|
||||
|
||||
void ProfilerState::printNestedStuff(ExprSelect& name) {
|
||||
string delim = "";
|
||||
for(int i=0;i<nestedLevel;i++) {
|
||||
delim += "=";
|
||||
}
|
||||
std::cout << delim << " " << name << " (select)" << std::endl;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -59,6 +59,7 @@ public:
|
|||
void saveCost(ProfCostOcc& occCost);
|
||||
void printNestedStuff(Symbol& name);
|
||||
void printNestedStuff(ExprVar& name);
|
||||
void printNestedStuff(ExprSelect& name);
|
||||
|
||||
public:
|
||||
std::vector<ProfCostOcc> 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<ProfFuncCall> calledFunctions;
|
||||
};
|
||||
|
||||
class ProfilerState {
|
||||
|
||||
public:
|
||||
ProfCostOcc& getFuncOcc(FileName& fName, FunctionName& fnName);
|
||||
void saveCost(ProfCostOcc& occCost);
|
||||
|
||||
private:
|
||||
std::vector<ProfCostOcc> stackedMeasurements;
|
||||
string funcName;
|
||||
int currentNestedLevel;
|
||||
/* We index every func and file to leverage Callgrind's string compression.
|
||||
See section "3.1.6.<2E>Subposition Compression" section from [callgrindSpec]. */
|
||||
std::map<CompressedFuncId,FunctionName> funcMap;
|
||||
std::map<CompressedFileId,FileName> fileMap;
|
||||
CompressedFuncId currentFuncId;
|
||||
CompressedFileId currentFileId;
|
||||
};
|
||||
|
||||
/* Return a string representing the type of the value `v'. */
|
||||
string showType(const Value & v);
|
||||
|
||||
|
|
Loading…
Reference in New Issue