Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

print_log2_hist to strip leading zeros #1109

Open
brendangregg opened this issue Apr 12, 2017 · 3 comments
Open

print_log2_hist to strip leading zeros #1109

brendangregg opened this issue Apr 12, 2017 · 3 comments

Comments

@brendangregg
Copy link
Member

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.

@frisso
Copy link

frisso commented Apr 13, 2017

Personally I like the original format, which makes more clear which intervals are taken into consideration and it's easy to compare two histograms together.

@brendangregg
Copy link
Member Author

I see what you mean. With the zeros, we visually get a clue as to where the range of events is.

Maybe stripping the zeros should be optional, then.

@tchajed
Copy link

tchajed commented May 13, 2021

I think this is fixed by #1226, which makes stripping leading zeros possible but optional.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants