pct

command module
v0.0.0-...-de61fcb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2023 License: MIT Imports: 9 Imported by: 0

README

pct calculates the distribution of lines in text. It is similar to sort | uniq -c | sort -n -r, except that it prints percentages as well as counts.

Sample output:

$ cat std.qc | grep "clearfat" | pct | head
 33.05%    1204    clearfat q=2 c=0
 18.80%    685     clearfat q=4 c=0
 17.76%    647     clearfat q=3 c=0
  4.47%    163     clearfat q=6 c=0
  3.90%    142     clearfat q=8 c=0
  3.84%    140     clearfat q=10 c=0
  2.72%    99      clearfat q=5 c=0
  1.95%    71      clearfat q=13 c=0
  1.73%    63      clearfat q=4 c=4
  1.40%    51      clearfat q=7 c=0

I originally wrote it for compiler investigations, but have found it to be broadly useful.

This kind of tool seems to be prone to convergent evolution: https://blog.mozilla.org/nnethercote/2018/07/24/ad-hoc-profiling/

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL