cmumford/chromeio

Output would be easier to read with consistent column alignment

randomascii opened this issue · 2 comments

The default output looks like this (needs a fixed-width font to see):

Visited Links           : R[0=0B=0.0%=0B/day], W[234875648=224.0MB=0.0%=9.4GB/day]
Temp                    : R[749568=732.0KB=0.0%=30.8MB/day], W[144240603=137.6MB=0.0%=5.8GB/day]
Cache                   : R[8474447=8.1MB=0.0%=349.0MB/day], W[119710572=114.2MB=0.0%=4.8GB/day]
Cookies                 : R[2035712=1.9MB=0.0%=83.8MB/day], W[8648708=8.2MB=0.0%=356.1MB/day]
Current Session         : R[0=0B=0.0%=0B/day], W[4973469=4.7MB=0.0%=204.8MB/day]

This makes it hard to see patterns in the data. Because it is sorted by write bytes the critical information can be found, but not easily, IMHO.

Visited Links           : R[    0B = 0.0%=    0B /day], W[224.0MB= 0.0%=  9.4GB/day]
Temp                    : R[732.0KB= 0.0%= 30.8MB/day], W[137.6MB= 0.0%=  5.8GB/day]
Cache                   : R[  8.1MB= 0.0%=349.0MB/day], W[114.2MB= 0.0%=  4.8GB/day]
Cookies                 : R[  1.9MB= 0.0%= 83.8MB/day], W[  8.2MB= 0.0%=356.1MB/day]
Current Session         : R[    0B = 0.0%=    0B /day], W[  4.7MB= 0.0%=204.8MB/day]

It wasn't until I fixed the alignment that I realized that I broke percentages. I'll fix that separately, but perhaps the ease of seeing the breakage once the columns are aligned is an indication of the importance of alignment?

Fully fixed output looks like this:

Visited Links           : R[    0 B= 0.0%=    0 B/day], W[224.0MB=44.8%=  9.4GB/day]
Temp                    : R[732.0KB= 2.1%= 30.8MB/day], W[137.6MB=27.5%=  5.8GB/day]
Cache                   : R[  8.1MB=23.7%=349.0MB/day], W[114.2MB=22.8%=  4.8GB/day]
Cookies                 : R[  1.9MB= 5.7%= 83.8MB/day], W[  8.2MB= 1.7%=356.1MB/day]
Current Session         : R[    0 B= 0.0%=    0 B/day], W[  4.7MB= 0.9%=204.8MB/day]

I'm filling this is an issue to discuss the best fix:

  1. The simplest option is to do the output shown above, always, omitting the exact byte count.
  2. Alternately it could be a switch, for those who want the old format
  3. Various alternative cleanups?

Note that the alignment is not guaranteed to always be perfect because 100% and 1023.0 MB will both use one extra column - probably rare enough to ignore.

Edited by cmumford: Merged randomascii's comment into this post and corrected formatting.

I like the simplest approach (no. 1) above. I doubt others prefer the other format.

Nice job editing the output in the original comment.