we need to make a profiler_v3
parent
456eeb12ac
commit
c5f3d9ba3b
|
@ -1,7 +1,7 @@
|
||||||
cmake_minimum_required(VERSION 3.20)
|
cmake_minimum_required(VERSION 3.20)
|
||||||
include(cmake/color.cmake)
|
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_TEST_VERSION 0.0.1)
|
||||||
|
|
||||||
set(BLT_TARGET BLT)
|
set(BLT_TARGET BLT)
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
namespace blt
|
namespace blt
|
||||||
{
|
{
|
||||||
// use the historical values (average) instead of the latest values
|
// 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
|
// print out the cycles
|
||||||
static inline constexpr std::uint32_t PRINT_CYCLES = 0x2;
|
static inline constexpr std::uint32_t PRINT_CYCLES = 0x2;
|
||||||
// print out the wall time
|
// print out the wall time
|
||||||
|
@ -96,7 +96,7 @@ namespace blt
|
||||||
|
|
||||||
void endInterval(interval_t* interval);
|
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);
|
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);
|
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 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);
|
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);
|
void writeProfile(std::ifstream& stream, const std::string& profile_name);
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 8a889d3699b3c09ade435641fb034427f3fd12b6
|
Subproject commit d88c5e15079047777b418132ece5879e7c9aaa2b
|
|
@ -21,27 +21,27 @@ namespace blt
|
||||||
|
|
||||||
#define SORT_INTERVALS_FUNC_MACRO(use_history, TYPE_END, TYPE_START, TYPE_TOTAL) \
|
#define SORT_INTERVALS_FUNC_MACRO(use_history, TYPE_END, TYPE_START, TYPE_TOTAL) \
|
||||||
[&use_history](const interval_t* a, const interval_t* b) -> bool { \
|
[&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 a_diff = a->TYPE_END - a->TYPE_START; \
|
||||||
auto b_diff = b->TYPE_END - b->TYPE_START; \
|
auto b_diff = b->TYPE_END - b->TYPE_START; \
|
||||||
return a_diff > b_diff; \
|
return a_diff > b_diff; \
|
||||||
} else { \
|
} else { \
|
||||||
return a->TYPE_TOTAL < b->TYPE_TOTAL; \
|
*/return a->TYPE_TOTAL < b->TYPE_TOTAL; \
|
||||||
} \
|
/*}*/ \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define INTERVAL_DIFFERENCE_MACRO(printHistory, interval) \
|
#define INTERVAL_DIFFERENCE_MACRO(printHistory, interval) \
|
||||||
auto wall = printHistory \
|
auto wall = printHistory \
|
||||||
? (static_cast<double>(interval->wall_total) / static_cast<double>(interval->count)) \
|
? (static_cast<double>(interval->wall_total) / static_cast<double>(interval->count)) \
|
||||||
: static_cast<double>(interval->wall_end - interval->wall_start); \
|
: static_cast<double>(interval->wall_total); \
|
||||||
\
|
\
|
||||||
auto thread = printHistory \
|
auto thread = printHistory \
|
||||||
? (static_cast<double>(interval->thread_total) / static_cast<double>(interval->count)) \
|
? (static_cast<double>(interval->thread_total) / static_cast<double>(interval->count)) \
|
||||||
: static_cast<double>(interval->thread_end - interval->thread_start); \
|
: (static_cast<double>(interval->thread_total)); \
|
||||||
\
|
\
|
||||||
auto cycles = printHistory \
|
auto cycles = printHistory \
|
||||||
? ((interval->cycles_total) / (interval->count)) \
|
? ((interval->cycles_total) / (interval->count)) \
|
||||||
: (interval->cycles_end - interval->cycles_start);
|
: (interval->cycles_total);
|
||||||
|
|
||||||
enum class unit
|
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)
|
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 printCycles = flags & PRINT_CYCLES;
|
||||||
bool printThread = flags & PRINT_THREAD;
|
bool printThread = flags & PRINT_THREAD;
|
||||||
bool printWall = flags & PRINT_WALL;
|
bool printWall = flags & PRINT_WALL;
|
||||||
|
|
Loading…
Reference in New Issue