15 #ifndef GEOS_PROFILER_H 16 #define GEOS_PROFILER_H 33 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class 59 starttime = std::chrono::high_resolution_clock::now();
66 stoptime = std::chrono::high_resolution_clock::now();
67 auto elapsed = std::chrono::duration_cast<
timeunit>(stoptime - starttime);
69 timings.push_back(elapsed);
72 if(timings.size() == 1) {
84 avg =
static_cast<double>(totaltime.count()) / static_cast<double>(timings.size());
88 double getMax()
const;
91 double getMin()
const;
94 double getTot()
const;
97 std::string getTotFormatted()
const;
100 double getAvg()
const;
103 size_t getNumTimings()
const;
112 std::chrono::high_resolution_clock::time_point starttime,
stoptime;
158 void start(std::string name);
165 void stop(std::string name);
168 Profile*
get(std::string name);
170 std::map<std::string, std::unique_ptr<Profile>>
profs;
187 #endif // ndef GEOS_PROFILER_H std::chrono::high_resolution_clock::time_point stoptime
std::map< std::string, std::unique_ptr< Profile > > profs
std::string name
Profile name.
void stop()
stop current timer
std::chrono::microseconds timeunit
void start()
start a new timer
Basic namespace for all GEOS functionalities.
std::vector< timeunit > timings
std::ostream & operator<<(std::ostream &os, const Profile &)
Return a string representing the Profile.