测算压缩比

Measure compression ratio. zlib, gzip, bz2, lzma is supported.

Usage

usage: mcr.py [-h] [--verbose] [--chunk-size {4,8,16,32,64,128,256,512}]
              [--name {gzip,all,zlib,bz2}]
              [--level {-2,-1,0,1,2,3,4,5,6,7,8,9}]
              file

Measure compression ratio.

positional arguments:
  file                  file or directory

optional arguments:
  -h, --help            show this help message and exit
  --verbose             print progress status (default: None)
  --chunk-size {4,8,16,32,64,128,256,512}
                        data chunk's size (metric: KB) (default: 16)
  --name {gzip,all,zlib,bz2}
                        compression algorithm's name (default: all)
  --level {-2,-1,0,1,2,3,4,5,6,7,8,9}
                        controlling the level of compression, all = -2,
                        default = -1 (default: -2)

Example

$ python3 mcr.py --level=-1 /dev/vda
File: /dev/vda, Length: 40.0 GB, Chunk Size: 16.0 KB
NAME LVL OUTSIZE   EXPIRED %SAV  IN/ps       OUT/ps      RATIO %PROG REMAIN 
bz2    9 6.61 GB   1.1 h   83.48 10.33 MBps  1.71 MBps    6.05 100.0 0.0 s
zlib  -1 8.74 GB   14.93 m 78.15 45.72 MBps  9.99 MBps    4.58 100.0 0.0 s
gzip   9 8.75 GB   50.93 m 78.13 13.4 MBps   2.93 MBps    4.57 100.0 0.0 s
lzma   0 4.43 GB   3.03 h  88.93 3.75 MBps   425.55 KBps  9.03 100.0 0.0 s