OT: ptime [WAS: Re: stdio performance in tango, stdlib, and perl]

Sean Kelly sean at f4.ca
Fri Mar 23 11:58:01 PDT 2007


torhu wrote:
> Sean Kelly wrote:
> <snip>
>> For what it's worth, I created a Win32 version of the Unix 'time' 
>> command recently.  Not too complicated, but if anyone is interested, I 
>> have it here: http://www.invisibleduck.org/~sean/tmp/ptime.zip  It's a 
>> quick and dirty implementation, but works for how I typically use it.
> 
> Looks useful, my own tool just measures 'real' time.  But it breaks when 
> using redirection, either way:
> 
> redirect stdin:
> ---
> c:\prog\test\linetest>ptime cat <test.txt
> cat: -: Bad file descriptor
> 
> real    0m0.000s
> user    0m0.010s
> sys     0m0.000s
> 
> ---
> 
> redirect stdout:
> ---
> c:\prog\test\linetest>ptime cat test.txt >NUL
> 
> ---
> 
> The last one outputs nothing.  Printing to stderr would fix that.

Hm, I suspect IO redirection must be a feature of the shell.  It's a bit 
of a hack, but this may work "ptime cmd /c cat < test.txt."  I'll see 
how complicated a real fix would be.


Sean



More information about the Digitalmars-d mailing list