diff --git a/utils.hpp b/utils.hpp index 6d010e2..6db340d 100644 --- a/utils.hpp +++ b/utils.hpp @@ -236,7 +236,7 @@ class Profiler { protected: std::string file_name; ///< File name to be displayed in the report. - int line_times[UTILS_PROFILER_NMAX]; ///< Line times in nanoseconds. The values are stored like so : line_times[__LINE__] = time_for_the_line. + int64_t line_times[UTILS_PROFILER_NMAX]; ///< Line times in nanoseconds. The values are stored like so : line_times[__LINE__] = time_for_the_line. std::chrono::high_resolution_clock::time_point t0; ///< Time point storing the time when Reset() is called. public: @@ -261,7 +261,7 @@ class Profiler void DisplayData() { // compute sum of times - int sumOfTimes = 0; + int64_t sumOfTimes = 0; for (size_t i = 0; i < UTILS_PROFILER_NMAX; i++) { sumOfTimes += line_times[i]; } @@ -279,13 +279,13 @@ class Profiler // Display the list sorted by descending line time { // convert the map to a vector of pairs... - std::vector> line_times_vec; + std::vector> line_times_vec; for (size_t i = 0; i < UTILS_PROFILER_NMAX; i++) if(line_times[i] != 0) line_times_vec.push_back(std::make_pair(i, line_times[i])); // sort the vector of pairs - std::sort(line_times_vec.begin(), line_times_vec.end(), [](const std::pair & a, const std::pair & b) { + std::sort(line_times_vec.begin(), line_times_vec.end(), [](const std::pair & a, const std::pair & b) { return a.second > b.second;// Descending order using the second entry of the pair });