#pragma once #include #include #include #include #include #include "dvm.h" #include "../GraphLoop/graph_loops_func.h" struct SpfInterval { int userIntervalLine; int tag = 0; long long calls_count = 0; bool ifInclude = true; bool isRegion; bool isNested; SgStatement *begin; std::pair lineFile; SpfInterval *parent; std::vector ends; std::vector exit_levels; std::vector nested; //TODO: to be delete or rewrite with new predictor //from statistic after execution int exec_count = 0; double exec_time = 0; std::vector predictedTimes; std::vector predictedRemoteTimes; SpfInterval(int line) { userIntervalLine = line; begin = NULL; parent = NULL; } int getBestTimeIdx() { int idx = -1; double best = 0; for (int z = 0; z < predictedTimes.size(); ++z) { if (idx == -1 || best > predictedTimes[z]) { best = predictedTimes[z]; idx = z; } } return idx; } }; void saveIntervals(const std::string &fileName, std::map> &intervals); void createInterTree(SgFile*, std::vector&, bool, std::vector&); void assignCallsToFile(const std::string&, std::vector&); void removeNodes(int, std::vector&, std::vector&); void insertIntervals(SgFile*, const std::vector&); void createMapOfinterval(std::map &mapIntervals, const std::vector &intervals); void initTimeForIntervalTree(const int numOfTopologies, std::vector &intervals); void aggregatePredictedTimes(std::vector &itervals); SpfInterval* getMainInterval(SgProject *project, const std::map> &intervals, std::map>& SPF_messages); void uniteIntervalsBetweenProcCalls(std::map> &intervals, const std::map> &allFuncInfo); SpfInterval* findNearestUp(const std::map &intervals, SgStatement *st); SpfInterval* findNearestDown(const std::map &intervals, SgStatement *st);