Skip to content

Commit

Permalink
Handle unlikely case for qemu perfetto stats recording.
Browse files Browse the repository at this point in the history
Avoid creating histogram buckets starting at 0 when pause is called
but no instructions have been executed yet.
  • Loading branch information
qwattash committed Nov 3, 2021
1 parent 5b7916b commit b06b88a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion trace_extra/trace_stats.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ qemu_stats::pause(perfetto::Track &track, uint64_t pc)
if (paused_)
return;
paused_ = true;
assert(pc_range_start_ != 0 && "PC bb start was not updated");
/* Nothing to flush */
if (pc_range_start_ == 0)
return;
assert(pc != 0 && "pause PC can not be zero");
/* Treat this as the end of the block, otherwise the current PC slice will be lost. */
bb_hit_map_ += std::make_pair(addr_range::right_open(pc_range_start_, pc), icount_);
Expand Down

0 comments on commit b06b88a

Please sign in to comment.