(1) class MetaClass_Profiling_exampleProg: public MetaFile{ |
(2) public: |
(3) MetaClass_Profiling_exampleProg(string name); |
(4) virtual bool OFExtendDefinition(); |
(5) }; |
(6) bool MetaClass_Profiling_exampleProg::OFExtendDefinition(){ |
(7) for(int i=0; i<functionList.size(); i++){ |
(8) pushScopeStack(functionList[i]->getFunctionBodyScope()); |
(9) functionList[i]->addUsingModuleStatement(“profiling_mod”); |
(9) functionList[i]->functionNormalization(); |
(10) vector<SgFunctionCallExp*> funCallList = functionList[i]->getFunctionCallList(); |
(11) for(int j=0; j<funCallList.size(); j++){ |
(12) string callerName = functionList[i]->getName(); |
(13) string calleeName = get_name(funCallList[j]); |
(14) SgStatement* targetStmt = functionList[i]->getStmtsContainFunctionCall(funCallList[j]); |
(15) string identifier = callerName + ":" + calleeName; |
(16) insertStatementBefore(targetStmt, buildFunctionCallStmt("profiling", new SgTypeVoid(),∖ |
buildParaList(identifier))); |
(17) insertStatementAfter(targetStmt, buildFunctionCallStmt("profiling", new SgTypeVoid(),∖ |
buildParaList(identifier))); |
(18) } |
(19) popScopeStack(); |
(20) } |
(21) } |