Skip to content

Commit

Permalink
Fixed debug timer for gpu
Browse files Browse the repository at this point in the history
  • Loading branch information
aristocratos committed May 19, 2023
1 parent 01acfd6 commit 8bae1ec
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/btop.cpp
Expand Up @@ -394,7 +394,9 @@ namespace Runner {

enum debug_actions {
collect_begin,
collect_done,
draw_begin,
draw_begin_only,
draw_done
};

Expand Down Expand Up @@ -430,6 +432,13 @@ namespace Runner {
case collect_begin:
debug_times[name].at(collect) = time_micros();
return;
case collect_done:
debug_times[name].at(collect) = time_micros() - debug_times[name].at(collect);
debug_times["total"].at(collect) += debug_times[name].at(collect);
return;
case draw_begin_only:
debug_times[name].at(draw) = time_micros();
return;
case draw_begin:
debug_times[name].at(draw) = time_micros();
debug_times[name].at(collect) = debug_times[name].at(draw) - debug_times[name].at(collect);
Expand Down Expand Up @@ -489,8 +498,6 @@ namespace Runner {
if (debug_bg.empty() or redraw)
Runner::debug_bg = Draw::createBox(2, 2, 33, 8, "", true, "μs");



debug_times.clear();
debug_times["total"] = {0, 0};
}
Expand All @@ -514,6 +521,7 @@ namespace Runner {
if (gpu_in_cpu_panel or not gpu_panels.empty()) {
if (Global::debug) debug_timer("gpu", collect_begin);
gpus = Gpu::collect(conf.no_update);
if (Global::debug) debug_timer("gpu", collect_done);
}
auto& gpus_ref = gpus;

Expand Down Expand Up @@ -548,7 +556,7 @@ namespace Runner {
//? GPU
if (not gpu_panels.empty() and not gpus_ref.empty()) {
try {
if (Global::debug) debug_timer("gpu", draw_begin);
if (Global::debug) debug_timer("gpu", draw_begin_only);

//? Draw box
if (not pause_output)
Expand Down

0 comments on commit 8bae1ec

Please sign in to comment.