[Tutor] Is it possible?

Alan Gauld alan.gauld at btinternet.com
Sat Feb 9 00:50:21 CET 2008

"Nathan McBride" <nomb85 at comcast.net> wrote

> Is it possible to write a program that you pipe other programs 
> through
> and it measures the MBs per second of data moved?  Like I could pipe 
> it
> a cp and find out how fast the cp is working?

Not in any kind of general sense.
Even for cp its not clear what it would report.
On some OS cp is often not actually moving any data
but just readjusting file pointers within the directory
structure. And thats even more true for mv.
So would you count the size of the pointers changed
or the size of the file being referenced?
And what about a mv thats really a rename?
And what about ls? It doesn't move any data but
you might count the characters in the listing?
Or the number of files? Or even the total sizes of
the files listed?

It would be very difficult to write a general purpose program that
could cater for all of those. However you could do one for each
specific case... Although in most cases there are already standard
Unix tools that will do the job.

Alan G.

More information about the Tutor mailing list