Re:Pipe Viewer
by ralph on Thursday May 24, 2012 @05:04PM
(#4020555)
Note, a plain dd will report progress on stderr if sent a SIGUSR1. That can sometimes be enough to avoid the overhead of pv(1) and sending huge amounts of data through another pipe.
Re:Pipe Viewer
by protopete on Thursday May 24, 2012 @05:32PM
(#4020683)
About the pv overhead, I sent a note to the pv author saying that on Linux at least the transfer function could take advantage of the splice system call. Splice "copies" data from one file descriptor to another file descriptor, avoiding having to copy the data from the kernel to userspace and back.
Re:Pipe Viewer
by Erwin on Thursday May 24, 2012 @07:36PM
(#4021149)
On FreeBSD (and maybe Mac OS X) you can press Control-T to send a SIGINFO signal (non-standard extension. This prints out how far dd has gotten (and perhaps other FreeBSD utilities too).
Re:Pipe Viewer
by sneak on Friday May 25, 2012 @05:03AM
(#4022659)
N.B. also that dd on osx will EXIT IMMEDIATELY if sent a SIGUSR1. It double-sucks because one tends to do this on long-running dd processes that you're wondering are done yet...
Re:Pipe Viewer
by mbreese on Thursday May 24, 2012 @04:14PM
(#4020334)
Right. I usually use pv in place of 'cat' at the start of a long set of piped commands. Anywhere you could use 'cat' you can use pv. If I'm not mistaken, I think you can also use multiple 'pv' commands at a time too.
Re:Pipe Viewer
by pronoiac on Thursday May 24, 2012 @05:28PM
(#4020663)
> If I'm not mistaken, I think you can also use multiple 'pv' commands at a time too.
I use multiple pv instances to track compression/decompression rates, and overall progress, for tarballs. Using the "-c" code for console codes keeps the instances from stomping over each other's output.
Re:Pipe Viewer
by b0b0b0b on Thursday May 24, 2012 @10:14PM
(#4021569)
If I'm dealing with [compressed] files on disk or across a network, what's the practical overhead of pv? A few extra percent CPU, or some material decrease in through put?
Nifty command. Been using this for a month or so. One use case is measuring if a downstream process can consume data as fast the previous process is producing it (by alternating second process with /dev/null or some such).
http://news.ycombinator.com/item?id=2567186
tail -f query.log | pv -tri 1 > /dev/null
I was under the assumption that pipes do not know how much total data is on its way?
I use multiple pv instances to track compression/decompression rates, and overall progress, for tarballs. Using the "-c" code for console codes keeps the instances from stomping over each other's output.
Example: https://gist.github.com/2783910
(hell it could even use splice() and never even see the bytes)
pv -f *.sql.gz | zcat | mysql db_instance_name
http://news.ycombinator.com/item?id=3626020
http://news.ycombinator.com/item?id=3198572
I'm sure there were older stories too. IIRC I saw it on HN longer than 6 months ago, but I couldn't find that submission in a cursory search.
my throughput from yes is 49MB/s whereas from /dev/zero it's 12GB/s