Howto Determine the throughput of a pipe command

If you want to Determine the throughput of a pipe you need to use cpipe.Cpipe copies its standard input to its standard output while measuring the time it takes to read an input buffer and write an output buffer. Statistics of average throughput and the total amount of bytes copied are printed to the standard error output.

Did you ever want to know how fast your tar is or how much data it has transferred already. How about using socket or nc to copy files either with or without compression over a fast network connection, which one is faster?

If you want to know the answer, use cpipe as a totally unscientific approach to measure throughput. Cpipe copies its standard input to its standard output while measuring the time it takes to read an input buffer and write an output buffer. Statistics of average throughput and the total amount of bytes copied are printed to the standard error output.

Install cpipe in Debian

#aptitude install cpipe

Using cpipe

cpipe syntax

cpipe [-b bsize] [-vt] [-vr] [-vw] [-ngr] [-s speed]

Available options

-b buffer size in kB,
1 Int value between 1 and oo.
Default: â128â

-vt show throughput.

-vr show read-times.

-vw show write-times.

-ngr non-greedy read. Donât enforce a full buffer on read before starting to write.

-s throughput speed limit in kB/s,
1 Double value between 1 and oo.

Cpipe Example

The command

tar cCf / – usr | cpipe -vr -vw -vt > /dev/null

results in an output like

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

The first column shows the times it takes to handle one buffer of data (128kB by default). The read-call took 19.541ms, the write-call to
/dev/null took just 0.004ms and from the start of the read to the end of write, it took 19.865ms.

The second column shows the result of dividing the buffer size (128kB by default) by the times in the first column.

The third column contains the average over all measured values from the start of the program.

Sponsored Link

2 thoughts on “Howto Determine the throughput of a pipe command

  1. i was just about to write a quick and dirty pipe speed measuring program, but it already exists (not as quick and dirty as what i had in mind though ;))!

Leave a comment

Your email address will not be published. Required fields are marked *