[RndTbl] Help with pv?

Trevor Cordes trevor at tecnopolis.ca
Fri Dec 12 23:48:13 CST 2014

On 2014-12-12 Kevin McGregor wrote:
> I want to do something like this:
> root at srv1:~# pv </dev/zero | ssh root at srv2 'cat >/dev/null'

As per Adam's presentation a while back, you'll probably want to use nc
not ssh, otherwise you aren't testing the network as much as the CPUs.
Unless you don't care about that, of course.

> totals. I don't know how to do this. I'd rather not have four
> separate sessions open to see this. I just want to have one session
> that looks like
>  448MB 0:00:09 [ 112MB/s] [     <=>
>    ]
>  448MB 0:00:09 [ 112MB/s] [     <=>
>    ]

I just looked at pv's man at length and tried a few things and I see
absolutely no way to have pv combine multiple *different* pipes (ie not
in the same pipe group) into one output.  I'm pretty sure what Paul was
showing us was just multiple pv's in one pipe group, which isn't the
same thing.  Perhaps he can verify.

You may be able to write a script that uses something like -n to spit
out program-parseable output, launch all 4 pipes and aggregate the
results into your own curses output (or perhaps use dialog as the man
page suggests).  Your script would probably have to use select() on the
filehandles.  Perl would be perfect for this, I do select() stuff all
the time with perl.

More information about the Roundtable mailing list