diff --git a/CMakeLists.txt b/CMakeLists.txt index c11bf9d..d6e96ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,6 @@ cmake_minimum_required(VERSION 3.24) -project(BLT) +project(BLT VERSION 0.3.1) -set(CMAKE_PROJECT_VERSION 0.3a) set(CMAKE_CXX_STANDARD 17) option(BUILD_STD "Build the BLT standard utilities." ON) diff --git a/cmake-build-release/CMakeCache.txt b/cmake-build-release/CMakeCache.txt index c27606b..c44e71f 100644 --- a/cmake-build-release/CMakeCache.txt +++ b/cmake-build-release/CMakeCache.txt @@ -181,13 +181,16 @@ CMAKE_PROJECT_HOMEPAGE_URL:STATIC= CMAKE_PROJECT_NAME:STATIC=BLT_TESTS //Value Computed by CMake -CMAKE_PROJECT_VERSION_MAJOR:STATIC=1 +CMAKE_PROJECT_VERSION:STATIC=0.3.1 + +//Value Computed by CMake +CMAKE_PROJECT_VERSION_MAJOR:STATIC=0 //Value Computed by CMake CMAKE_PROJECT_VERSION_MINOR:STATIC=3 //Value Computed by CMake -CMAKE_PROJECT_VERSION_PATCH:STATIC=8 +CMAKE_PROJECT_VERSION_PATCH:STATIC=1 //Value Computed by CMake CMAKE_PROJECT_VERSION_TWEAK:STATIC= diff --git a/cmake-build-release/CMakeFiles/clion-Release-log.txt b/cmake-build-release/CMakeFiles/clion-Release-log.txt index 5275a66..ecb497e 100644 --- a/cmake-build-release/CMakeFiles/clion-Release-log.txt +++ b/cmake-build-release/CMakeFiles/clion-Release-log.txt @@ -4,7 +4,7 @@ Standard Files /home/brett/Documents/code/c++/BLT/src/blt/std/format.cpp;/home/b Profiler Files /home/brett/Documents/code/c++/BLT/src/blt/profiling/profiler.cpp Source: /home/brett/Documents/code/c++/BLT Current Source: /home/brett/Documents/code/c++/BLT -BLT 0.3a Successfully included! +BLT 0.3.1 Successfully included! BLT tests included! -- Configuring done -- Generating done diff --git a/src/blt/profiling/profiler.cpp b/src/blt/profiling/profiler.cpp index 3b05006..8b77a60 100644 --- a/src/blt/profiling/profiler.cpp +++ b/src/blt/profiling/profiler.cpp @@ -95,7 +95,7 @@ namespace blt::profiling { for (const auto& interval : intervals) { const auto difference = interval.second.end - interval.second.start; - formatter.addRow({interval.first, std::to_string(difference), std::to_string(difference/1000000)}); + formatter.addRow({interval.first, std::to_string(difference), std::to_string(difference/1000000.0)}); } std::vector updatedLines; @@ -127,7 +127,7 @@ namespace blt::profiling { return {longestName, longestIntervalTime}; } - void printOrderedProfile(const std::string& profileName, int loggingLevel) { + void printOrderedProfileOld(const std::string& profileName, int loggingLevel) { std::vector lines; const auto& profile = profiles[profileName]; const auto& intervals = profile.intervals; @@ -174,6 +174,39 @@ namespace blt::profiling { print(lines, loggingLevel); } + void printOrderedProfile(const std::string& profileName, int loggingLevel) { + const auto& profile = profiles[profileName]; + const auto& intervals = profile.intervals; + const auto& points = profile.points; + + std::vector unorderedIntervalVector; + + for (const auto& interval : intervals) { + const auto difference = interval.second.end - interval.second.start; + unorderedIntervalVector.emplace_back(difference, interval.first); + } + + std::sort(unorderedIntervalVector.begin(), unorderedIntervalVector.end(), timeCompare); + + string::TableFormatter formatter; + formatter.addColumn({"Order"}); + formatter.addColumn({"Interval"}); + formatter.addColumn({"Time (ns)"}); + formatter.addColumn({"Time (ms)"}); + + int index = 1; + for (const auto& interval : unorderedIntervalVector) { + formatter.addRow({std::to_string(index++), interval.name, std::to_string(interval.difference), std::to_string(interval.difference / 1000000.0)}); + } + + std::vector updatedLines; + const auto& lines = formatter.createTable(true, true); + for (const auto& line : lines) + updatedLines.emplace_back(line + "\n"); + + print(updatedLines, loggingLevel); + } + void discardProfiles() { profiles = {}; }