diff --git a/include/blt/parse/argparse.h b/include/blt/parse/argparse.h index 747d3b7..15ea9a7 100755 --- a/include/blt/parse/argparse.h +++ b/include/blt/parse/argparse.h @@ -375,18 +375,22 @@ namespace blt { if constexpr (std::is_same_v) return std::get(v); - else - { - auto t = std::get(v); - // user is requesting an int, but holds a string, we are going to make the assumption the data can be converted - // it is up to the user to deal with the variant if they do not want this behaviour! - if constexpr (std::is_same_v) - { - if (std::holds_alternative(t)) - return std::stoi(std::get(t)); - } + auto t = std::get(v); + // user is requesting an int, but holds a string, we are going to make the assumption the data can be converted + // it is up to the user to deal with the variant if they do not want this behaviour! + if constexpr (!std::is_arithmetic_v) return std::get(t); - } + // ugly! + if (std::holds_alternative(t)) + return static_cast(std::get(t)); + if (std::holds_alternative(t)) + return static_cast(std::get(t)); + auto s = std::get(t); + if constexpr (std::is_floating_point_v) + return static_cast(std::stod(s)); + if constexpr (std::is_signed_v) + return static_cast(std::stoll(s)); + return static_cast(std::stoull(s)); } public: diff --git a/libraries/parallel-hashmap b/libraries/parallel-hashmap index 93201da..77cab81 160000 --- a/libraries/parallel-hashmap +++ b/libraries/parallel-hashmap @@ -1 +1 @@ -Subproject commit 93201da2ba5a6aba0a6e57ada64973555629b3e3 +Subproject commit 77cab8192a879e5d27188f97e8f2080dd7e36ca8 diff --git a/src/blt/profiling/profiler.cpp b/src/blt/profiling/profiler.cpp index d006c44..5e8f6b7 100755 --- a/src/blt/profiling/profiler.cpp +++ b/src/blt/profiling/profiler.cpp @@ -148,7 +148,7 @@ namespace blt::profiling { void startInterval(const std::string& profileName, const std::string& intervalName) { std::scoped_lock lock(profileLock); capture_interval interval{}; - interval.start = system::getCurrentTimeNanoseconds(); + interval.start = system::getCPUThreadTime(); profiles[profileName].intervals[intervalName] = interval; } @@ -157,7 +157,7 @@ namespace blt::profiling { auto& prof = profiles[profileName]; auto& ref = prof.intervals[intervalName]; - ref.end = system::getCurrentTimeNanoseconds(); + ref.end = system::getCPUThreadTime(); auto difference = ref.end - ref.start; auto& href = prof.intervals_total[intervalName]; @@ -169,7 +169,7 @@ namespace blt::profiling { void point(const std::string& profileName, const std::string& pointName) { std::scoped_lock lock(profileLock); capture_point point{}; - point.point = system::getCurrentTimeNanoseconds(); + point.point = system::getCPUThreadTime(); point.name = pointName; profiles[profileName].points.push(point); }