print_log2_hist to strip leading zeros
- Dominant language
- C
- Stars
- 22.7k
- Forks
- 4.1k
- Avg merge
- 10d 4h
- Merged PRs (30d)
- 3
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
No contributing guide indexed for this repository
Research direction
Start at the print_log2_hist entry point and reproduce the funclatency vfs_write output shown in the issue. Update the histogram output so leading zero-count buckets are omitted while populated and trailing zero-count buckets remain, then verify the resulting output matches the concise example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- cli, observability
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100