Commit e35d318c authored by Brendan Gregg's avatar Brendan Gregg Committed by GitHub

Merge pull request #49 from iovisor/lhist_trim

lhist truncate zero ranges
parents 92218a24 aa097ebb
......@@ -913,7 +913,25 @@ int BPFtrace::print_lhist(const std::vector<uint64_t> &values, int min, int max,
lt << "(...," << min << "]";
std::ostringstream gt;
// trim empty values
int start_value = -1;
int end_value = 0;
for (int i = 0; i <= buckets + 1; i++)
{
if (values.at(i) > 0) {
if (start_value == -1) {
start_value = i;
}
end_value = i;
}
}
if (start_value == -1) {
start_value = 0;
}
for (int i = start_value; i <= end_value; i++)
{
int max_width = 52;
int bar_width = values.at(i)/(float)max_value*max_width;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment