From c5f3d9ba3b805d16c44cca020eeeec8abcee443f Mon Sep 17 00:00:00 2001 From: Brett Laptop Date: Thu, 11 Jul 2024 19:09:41 -0400 Subject: [PATCH] we need to make a profiler_v3 --- CMakeLists.txt | 2 +- include/blt/profiling/profiler_v2.h | 6 +++--- libraries/parallel-hashmap | 2 +- src/blt/profiling/profiler_v2.cpp | 14 +++++++------- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a2fef08..a29bb6c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.20) include(cmake/color.cmake) -set(BLT_VERSION 0.18.5) +set(BLT_VERSION 0.18.6) set(BLT_TEST_VERSION 0.0.1) set(BLT_TARGET BLT) diff --git a/include/blt/profiling/profiler_v2.h b/include/blt/profiling/profiler_v2.h index bfebbd1..3b62e1c 100644 --- a/include/blt/profiling/profiler_v2.h +++ b/include/blt/profiling/profiler_v2.h @@ -16,7 +16,7 @@ namespace blt { // use the historical values (average) instead of the latest values - static inline constexpr std::uint32_t PRINT_HISTORY = 0x1; + static inline constexpr std::uint32_t AVERAGE_HISTORY = 0x1; // print out the cycles static inline constexpr std::uint32_t PRINT_CYCLES = 0x2; // print out the wall time @@ -96,7 +96,7 @@ namespace blt void endInterval(interval_t* interval); - void printProfile(profile_t& profiler, std::uint32_t flags = PRINT_HISTORY | PRINT_CYCLES | PRINT_THREAD | PRINT_WALL, + void printProfile(profile_t& profiler, std::uint32_t flags = AVERAGE_HISTORY | PRINT_CYCLES | PRINT_THREAD | PRINT_WALL, sort_by sort = sort_by::CYCLES, blt::logging::log_level log_level = blt::logging::log_level::NONE); void writeProfile(std::ifstream& stream, const profile_t& profiler); @@ -109,7 +109,7 @@ namespace blt void endInterval(const std::string& profile_name, const std::string& interval_name); - void printProfile(const std::string& profile_name, std::uint32_t flags = PRINT_HISTORY | PRINT_CYCLES | PRINT_THREAD | PRINT_WALL, + void printProfile(const std::string& profile_name, std::uint32_t flags = AVERAGE_HISTORY | PRINT_CYCLES | PRINT_THREAD | PRINT_WALL, sort_by sort = sort_by::CYCLES, blt::logging::log_level log_level = blt::logging::log_level::NONE); void writeProfile(std::ifstream& stream, const std::string& profile_name); diff --git a/libraries/parallel-hashmap b/libraries/parallel-hashmap index 8a889d3..d88c5e1 160000 --- a/libraries/parallel-hashmap +++ b/libraries/parallel-hashmap @@ -1 +1 @@ -Subproject commit 8a889d3699b3c09ade435641fb034427f3fd12b6 +Subproject commit d88c5e15079047777b418132ece5879e7c9aaa2b diff --git a/src/blt/profiling/profiler_v2.cpp b/src/blt/profiling/profiler_v2.cpp index f3063b0..1c8c2b1 100644 --- a/src/blt/profiling/profiler_v2.cpp +++ b/src/blt/profiling/profiler_v2.cpp @@ -21,27 +21,27 @@ namespace blt #define SORT_INTERVALS_FUNC_MACRO(use_history, TYPE_END, TYPE_START, TYPE_TOTAL) \ [&use_history](const interval_t* a, const interval_t* b) -> bool { \ - if (!use_history){ \ + /*if (!use_history){ \ auto a_diff = a->TYPE_END - a->TYPE_START; \ auto b_diff = b->TYPE_END - b->TYPE_START; \ return a_diff > b_diff; \ } else { \ - return a->TYPE_TOTAL < b->TYPE_TOTAL; \ - } \ + */return a->TYPE_TOTAL < b->TYPE_TOTAL; \ + /*}*/ \ } #define INTERVAL_DIFFERENCE_MACRO(printHistory, interval) \ auto wall = printHistory \ ? (static_cast(interval->wall_total) / static_cast(interval->count)) \ - : static_cast(interval->wall_end - interval->wall_start); \ + : static_cast(interval->wall_total); \ \ auto thread = printHistory \ ? (static_cast(interval->thread_total) / static_cast(interval->count)) \ - : static_cast(interval->thread_end - interval->thread_start); \ + : (static_cast(interval->thread_total)); \ \ auto cycles = printHistory \ ? ((interval->cycles_total) / (interval->count)) \ - : (interval->cycles_end - interval->cycles_start); + : (interval->cycles_total); enum class unit { @@ -150,7 +150,7 @@ namespace blt void printProfile(profile_t& profiler, std::uint32_t flags, sort_by sort, blt::logging::log_level log_level) { - bool printHistory = flags & PRINT_HISTORY; + bool printHistory = flags & AVERAGE_HISTORY; bool printCycles = flags & PRINT_CYCLES; bool printThread = flags & PRINT_THREAD; bool printWall = flags & PRINT_WALL;