Compare commits

...

2 Commits

2 changed files with 49 additions and 0 deletions

View File

@ -1002,7 +1002,10 @@ void ExprSelect::eval(EvalState & state, Env & env, Value & v)
if (vAttrs->type != tAttrs ||
(j = vAttrs->attrs->find(name)) == vAttrs->attrs->end())
{
std::cout << "Going into " << name << std::endl;
state.profState
def->eval(state, env, v);
std::cout << " " << name << std::endl;
return;
}
} else {

View File

@ -329,6 +329,7 @@ public:
void printStats();
void realiseContext(const PathSet & context);
ProfilerState profState;
private:
@ -367,6 +368,51 @@ private:
};
/* Profiler-related operations.
[callGrindSpec]: TODO: add URL */
typedef string FunctionName;
typedef string FileName;
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);