Subject: Re: weird time(1) behaviour
To: None <current-users@NetBSD.org>
From: Eric Haszlakiewicz <erh@nimenees.com>
List: current-users
Date: 10/01/2007 07:04:50
David Laight wrote:
> On Sun, Sep 30, 2007 at 09:15:01PM +0200, Thomas Klausner wrote:
>
>> Hi!
>>
>> I tried to time a long-running operation today on
>> NetBSD-4.99.31/amd64. In the middle I statused it (CTRL-T),
>> interrupted it (CTRL-Z) and then timed it again when I put it in the
>> foreground again. The output was like this:
>>
>> # time longcmd
>> load: 2.86 cmd: longcmd 29364 [runnable] 2952.86u 126.60s 96% 104136k
>> ^Z
>> [1]+ Stopped longcmd
>>
>> real 75m15.099s
>> user 0m0.000s
>> sys 0m0.001s
>> # time fg
>> longcmd
>>
>> real 4m35.770s
>> user 69m18.580s
>> sys 2m51.754s
>>
>> Why is the user/system time in the first time(1) output 0, and the
>> second time(1) output has the correct date for the complete runtime
>> (at least I guess it has)?
>>
>
> Almost certainly because the current execution period isn't added into
> the processes execution time.
> This has been reported before (IIRC on sparc) but I haven't managed
> to reproduce it - and hence try to actually fix it.
>
I can reproduce it, but only with ksh. Any other shell doesn't like the
"time fg" command.
Using "ls -laR /var > /dev/null" works well as convenient "longcmd" to
run. (This is with NetBSD 4.99.20 as of Jun 22nd)
Thomas, what shell are you using? None of the ones I tried produces
output like you have.
eric