测量外壳中的管道吞吐量

Ale*_*x B 39 command-line performance io pipe

有一个 shell 命令可以让您测量数据通过它的速度,因此您可以测量管道中命令的输出速度。所以而不是:

$ somecommand | anothercommand
Run Code Online (Sandbox Code Playgroud)

您可以执行以下操作:

$ somecommand | ??? | anothercommand
Run Code Online (Sandbox Code Playgroud)

我认为,吞吐量统计信息(字节/秒)会打印到 stderr。但我终生无法记住那个命令是什么。

Mic*_*zek 56

cpipe可能更适合这些用途,但另一个相关程序是pv(管道查看器):

来自光伏主页的光伏截图

如果你给它这个--rate标志,它会显示传输速率


hob*_*ave 21

您需要一个名为cpipe的实用程序。

用法:

tar cCf / - usr | cpipe -vr -vw -vt > /dev/null
Run Code Online (Sandbox Code Playgroud)

输出:

...
  in:  19.541ms at    6.4MB/s (   4.7MB/s avg)    2.0MB
 out:   0.004ms at   30.5GB/s (  27.1GB/s avg)    2.0MB
thru:  19.865ms at    6.3MB/s (   4.6MB/s avg)    2.0MB
... 
Run Code Online (Sandbox Code Playgroud)

  • 不再找到对 `cpipe` 的任何有效引用......但 `pv` 是等效的。 (2认同)