iovisor/bcc

print_log2_hist to strip leading zeros

Open

#1,109 opened on Apr 12, 2017

View on GitHub
 (3 comments) (0 reactions) (0 assignees)C (4,051 forks)batch import
enhancementhelp wanted

Repository metrics

Stars
 (22,409 stars)
PR merge metrics
 (Avg merge 12d 6h) (12 merged PRs in 30d)

Description

Instead of this:

# ./funclatency vfs_write
Tracing 1 functions for "vfs_write"... Hit Ctrl-C to end.
^C
     nsecs               : count     distribution
         0 -> 1          : 0        |                                        |
         2 -> 3          : 0        |                                        |
         4 -> 7          : 0        |                                        |
         8 -> 15         : 0        |                                        |
        16 -> 31         : 0        |                                        |
        32 -> 63         : 0        |                                        |
        64 -> 127        : 0        |                                        |
       128 -> 255        : 0        |                                        |
       256 -> 511        : 0        |                                        |
       512 -> 1023       : 0        |                                        |
      1024 -> 2047       : 1        |                                        |
      2048 -> 4095       : 400      |*                                       |
      4096 -> 8191       : 4250     |*******************                     |
      8192 -> 16383      : 8652     |****************************************|
     16384 -> 32767      : 4663     |*********************                   |
     32768 -> 65535      : 453      |**                                      |
     65536 -> 131071     : 17       |                                        |
    131072 -> 262143     : 0        |                                        |
    262144 -> 524287     : 0        |                                        |
    524288 -> 1048575    : 0        |                                        |
   1048576 -> 2097151    : 0        |                                        |
   2097152 -> 4194303    : 1        |                                        |
Detaching...

Print this:

# ./funclatency vfs_write
Tracing 1 functions for "vfs_write"... Hit Ctrl-C to end.
^C
     nsecs               : count     distribution
      1024 -> 2047       : 1        |                                        |
      2048 -> 4095       : 400      |*                                       |
      4096 -> 8191       : 4250     |*******************                     |
      8192 -> 16383      : 8652     |****************************************|
     16384 -> 32767      : 4663     |*********************                   |
     32768 -> 65535      : 453      |**                                      |
     65536 -> 131071     : 17       |                                        |
    131072 -> 262143     : 0        |                                        |
    262144 -> 524287     : 0        |                                        |
    524288 -> 1048575    : 0        |                                        |
   1048576 -> 2097151    : 0        |                                        |
   2097152 -> 4194303    : 1        |                                        |
Detaching...

To keep the output more concise. This is especially noticeable by tools that print multiple histograms.

Contributor guide