zsh-workers
 help / color / mirror / code / Atom feed
* manpage mentions old TIMEFMT
@ 2012-04-13 20:47 Christian Neukirchen
  2012-04-13 21:15 ` Christian Neukirchen
  0 siblings, 1 reply; 7+ messages in thread
From: Christian Neukirchen @ 2012-04-13 20:47 UTC (permalink / raw)
  To: zsh-workers

Hi,

a minor documentation bug:

       TIMEFMT
              The format of process time reports with the time  keyword.   The
              default is `%E real  %U user  %S system  %P %J'.  

but actually:

% zsh --version
zsh 4.3.17 (x86_64-unknown-linux-gnu)
% zsh -f 
juno% echo $TIMEFMT
%J  %U user %S system %P cpu %*E total

This probably went unnoticed for a loong time. :)

> Thu Jun 15 00:25:43 1995  Richard Coleman  <coleman@math.gatech.edu>
> ...
>        * Changed the DEFAULT_TIMEFMT to
>          "%J  %U user %S system %P cpu %*E total".
>         From rc.

cheers,
-- 
Christian Neukirchen  <chneukirchen@gmail.com>  http://chneukirchen.org


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: manpage mentions old TIMEFMT
  2012-04-13 20:47 manpage mentions old TIMEFMT Christian Neukirchen
@ 2012-04-13 21:15 ` Christian Neukirchen
  2012-04-13 22:35   ` Peter Stephenson
  0 siblings, 1 reply; 7+ messages in thread
From: Christian Neukirchen @ 2012-04-13 21:15 UTC (permalink / raw)
  To: zsh-workers

Christian Neukirchen <chneukirchen@gmail.com> writes:

> Hi,
>
> a minor documentation bug:
>
>        TIMEFMT
>               The format of process time reports with the time  keyword.   The
>               default is `%E real  %U user  %S system  %P %J'.  
>
> but actually:
>
> % zsh --version
> zsh 4.3.17 (x86_64-unknown-linux-gnu)
> % zsh -f 
> juno% echo $TIMEFMT
> %J  %U user %S system %P cpu %*E total
>
> This probably went unnoticed for a loong time. :)
>
>> Thu Jun 15 00:25:43 1995  Richard Coleman  <coleman@math.gatech.edu>
>> ...
>>        * Changed the DEFAULT_TIMEFMT to
>>          "%J  %U user %S system %P cpu %*E total".
>>         From rc.

While I'm at it:

              %M     The  maximum memory the process had in use at any time in
                     Kbytes.

This seems to be in megabytes on my platform (zsh 4.3.17
(x86_64-unknown-linux-gnu), Linux 3.2.8).

Finally, %X and %D are rubbish on Linux (but GNU time(1) always shows
0 for them).

-- 
Christian Neukirchen  <chneukirchen@gmail.com>  http://chneukirchen.org


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: manpage mentions old TIMEFMT
  2012-04-13 21:15 ` Christian Neukirchen
@ 2012-04-13 22:35   ` Peter Stephenson
  2012-04-14 14:32     ` Christian Neukirchen
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Stephenson @ 2012-04-13 22:35 UTC (permalink / raw)
  To: zsh-workers

Thanks, I've committed these changes.

On Fri, 13 Apr 2012 23:15:40 +0200
Christian Neukirchen <chneukirchen@gmail.com> wrote:
>               %M     The  maximum memory the process had in use at any time in
>                      Kbytes
>
> This seems to be in megabytes on my platform (zsh 4.3.17
> (x86_64-unknown-linux-gnu), Linux 3.2.8).

Looks like there might be a clue there somewhere...

> Finally, %X and %D are rubbish on Linux (but GNU time(1) always shows
> 0 for them).

There's already a comment above saying the escape sequences are somewhat
system-specific, so I think it's covered.

-- 
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: manpage mentions old TIMEFMT
  2012-04-13 22:35   ` Peter Stephenson
@ 2012-04-14 14:32     ` Christian Neukirchen
  2012-04-14 20:55       ` Peter Stephenson
  0 siblings, 1 reply; 7+ messages in thread
From: Christian Neukirchen @ 2012-04-14 14:32 UTC (permalink / raw)
  To: zsh-workers

Peter Stephenson <p.w.stephenson@ntlworld.com> writes:

> Thanks, I've committed these changes.
>
> On Fri, 13 Apr 2012 23:15:40 +0200
> Christian Neukirchen <chneukirchen@gmail.com> wrote:
>>               %M     The  maximum memory the process had in use at any time in
>>                      Kbytes
>>
>> This seems to be in megabytes on my platform (zsh 4.3.17
>> (x86_64-unknown-linux-gnu), Linux 3.2.8).
>
> Looks like there might be a clue there somewhere...
>
>> Finally, %X and %D are rubbish on Linux (but GNU time(1) always shows
>> 0 for them).
>
> There's already a comment above saying the escape sequences are somewhat
> system-specific, so I think it's covered.

I'd prefer if they were 0 instead of -9223372036854775808...

-- 
Christian Neukirchen  <chneukirchen@gmail.com>  http://chneukirchen.org


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: manpage mentions old TIMEFMT
  2012-04-14 14:32     ` Christian Neukirchen
@ 2012-04-14 20:55       ` Peter Stephenson
  2012-04-14 21:17         ` Christian Neukirchen
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Stephenson @ 2012-04-14 20:55 UTC (permalink / raw)
  To: zsh-workers

On Sat, 14 Apr 2012 16:32:48 +0200
Christian Neukirchen <chneukirchen@gmail.com> wrote:
> >> Finally, %X and %D are rubbish on Linux (but GNU time(1) always shows
> >> 0 for them).
> 
> I'd prefer if they were 0 instead of -9223372036854775808...

I don't know where this is coming from, but the shell does initialise
the structure when it's created, so something in the shell is actually
setting a value --- unless it's the effect of dividing by a zero total
time.

Index: Src/jobs.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/jobs.c,v
retrieving revision 1.88
diff -p -u -r1.88 jobs.c
--- Src/jobs.c	28 Aug 2011 16:38:28 -0000	1.88
+++ Src/jobs.c	14 Apr 2012 20:53:31 -0000
@@ -716,17 +716,22 @@ printtime(struct timeval *real, child_ti
 #endif
 #ifdef HAVE_STRUCT_RUSAGE_RU_IXRSS
 	    case 'X':
-		fprintf(stderr, "%ld", (long)(ti->ru_ixrss / total_time));
+		fprintf(stderr, "%ld", 
+			total_time ?
+			(long)(ti->ru_ixrss / total_time) :
+			(long)0);
 		break;
 #endif
 #ifdef HAVE_STRUCT_RUSAGE_RU_IDRSS
 	    case 'D':
 		fprintf(stderr, "%ld",
+			total_time ? 
 			(long) ((ti->ru_idrss
 #ifdef HAVE_STRUCT_RUSAGE_RU_ISRSS
 				 + ti->ru_isrss
 #endif
-				    ) / total_time));
+				    ) / total_time) :
+			(long)0);
 		break;
 #endif
 #if defined(HAVE_STRUCT_RUSAGE_RU_IDRSS) || \


-- 
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: manpage mentions old TIMEFMT
  2012-04-14 20:55       ` Peter Stephenson
@ 2012-04-14 21:17         ` Christian Neukirchen
  2012-04-20 11:48           ` Christian Neukirchen
  0 siblings, 1 reply; 7+ messages in thread
From: Christian Neukirchen @ 2012-04-14 21:17 UTC (permalink / raw)
  To: zsh-workers

Peter Stephenson <p.w.stephenson@ntlworld.com> writes:

> On Sat, 14 Apr 2012 16:32:48 +0200
> Christian Neukirchen <chneukirchen@gmail.com> wrote:
>> >> Finally, %X and %D are rubbish on Linux (but GNU time(1) always shows
>> >> 0 for them).
>> 
>> I'd prefer if they were 0 instead of -9223372036854775808...
>
> I don't know where this is coming from, but the shell does initialise
> the structure when it's created, so something in the shell is actually
> setting a value --- unless it's the effect of dividing by a zero total
> time.

That was indeed the case:

juno ~% TIMEFMT="%X %D %E"
juno ~% time sleep 0
-9223372036854775808 -9223372036854775808 0.00s
juno ~% time sleep 1
0 0 1.01s

-- 
Christian Neukirchen  <chneukirchen@gmail.com>  http://chneukirchen.org


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: manpage mentions old TIMEFMT
  2012-04-14 21:17         ` Christian Neukirchen
@ 2012-04-20 11:48           ` Christian Neukirchen
  0 siblings, 0 replies; 7+ messages in thread
From: Christian Neukirchen @ 2012-04-20 11:48 UTC (permalink / raw)
  To: zsh-workers

Christian Neukirchen <chneukirchen@gmail.com> writes:

> Peter Stephenson <p.w.stephenson@ntlworld.com> writes:
>
>> On Sat, 14 Apr 2012 16:32:48 +0200
>> Christian Neukirchen <chneukirchen@gmail.com> wrote:
>>> >> Finally, %X and %D are rubbish on Linux (but GNU time(1) always shows
>>> >> 0 for them).
>>> 
>>> I'd prefer if they were 0 instead of -9223372036854775808...
>>
>> I don't know where this is coming from, but the shell does initialise
>> the structure when it's created, so something in the shell is actually
>> setting a value --- unless it's the effect of dividing by a zero total
>> time.
>
> That was indeed the case:
>
> juno ~% TIMEFMT="%X %D %E"
> juno ~% time sleep 0
> -9223372036854775808 -9223372036854775808 0.00s
> juno ~% time sleep 1
> 0 0 1.01s

There seem to be other case of division by zero, too:

make -v  0.00s user 18446744073.71s system -2147483648% cpu 4M memory 0.004 total

-- 
Christian Neukirchen  <chneukirchen@gmail.com>  http://chneukirchen.org


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-04-20 11:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-13 20:47 manpage mentions old TIMEFMT Christian Neukirchen
2012-04-13 21:15 ` Christian Neukirchen
2012-04-13 22:35   ` Peter Stephenson
2012-04-14 14:32     ` Christian Neukirchen
2012-04-14 20:55       ` Peter Stephenson
2012-04-14 21:17         ` Christian Neukirchen
2012-04-20 11:48           ` Christian Neukirchen

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).