From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4589 invoked from network); 20 Mar 2001 09:34:56 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 20 Mar 2001 09:34:56 -0000 Received: (qmail 20470 invoked by alias); 20 Mar 2001 09:34:43 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 13673 Received: (qmail 20455 invoked from network); 20 Mar 2001 09:34:43 -0000 Date: Tue, 20 Mar 2001 10:34:42 +0100 (MET) Message-Id: <200103200934.KAA07070@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.dk In-reply-to: Adam Spiers's message of Mon, 19 Mar 2001 22:25:21 +0000 Subject: PATCH: Re: misalignment in zprof output Adam Spiers wrote: > Just started to fiddle with zprof with the intent of spotting any > bottlenecks in my zsh startup (initial experiments show promptinit as > being quite bad), and spotted some "%5.2f%%" fields in printf() calls, > some of which should evidently be "%6.2f%%" as it's possible for some > of the fields to reach 100.00%, e.g. (apologies for long lines) Oops, that was a typo. > > ... > > I don't know off-hand which fields can reach 100% and which can't; > could someone more knowledgeable give these a tweak? I've just changed all of the %5.2f's (theoretically...). Thanks for spotting it. Bye Sven Index: Src/Modules/zprof.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Modules/zprof.c,v retrieving revision 1.1.1.6 diff -u -r1.1.1.6 zprof.c --- Src/Modules/zprof.c 2000/02/23 15:18:47 1.1.1.6 +++ Src/Modules/zprof.c 2001/03/20 09:32:33 @@ -168,7 +168,7 @@ printf("num calls time self name\n-----------------------------------------------------------------------------------\n"); for (fp = fs, i = 1; *fp; fp++, i++) { - printf("%2ld) %4ld %8.2f %8.2f %5.2f%% %8.2f %8.2f %5.2f%% %s\n", + printf("%2ld) %4ld %8.2f %8.2f %6.2f%% %8.2f %8.2f %6.2f%% %s\n", ((*fp)->num = i), (*fp)->calls, (*fp)->time, (*fp)->time / ((double) (*fp)->calls), @@ -184,14 +184,14 @@ printf("\n-----------------------------------------------------------------------------------\n\n"); for (ap = as; *ap; ap++) if ((*ap)->to == *fp) { - printf(" %4ld/%-4ld %8.2f %8.2f %5.2f%% %8.2f %8.2f %s [%ld]\n", + printf(" %4ld/%-4ld %8.2f %8.2f %6.2f%% %8.2f %8.2f %s [%ld]\n", (*ap)->calls, (*fp)->calls, (*ap)->time, (*ap)->time / ((double) (*ap)->calls), ((*ap)->time / total) * 100.0, (*ap)->self, (*ap)->self / ((double) (*ap)->calls), (*ap)->from->name, (*ap)->from->num); } - printf("%2ld) %4ld %8.2f %8.2f %5.2f%% %8.2f %8.2f %5.2f%% %s\n", + printf("%2ld) %4ld %8.2f %8.2f %6.2f%% %8.2f %8.2f %6.2f%% %s\n", (*fp)->num, (*fp)->calls, (*fp)->time, (*fp)->time / ((double) (*fp)->calls), ((*fp)->time / total) * 100.0, @@ -200,7 +200,7 @@ (*fp)->name); for (ap = as + narcs - 1; ap >= as; ap--) if ((*ap)->from == *fp) { - printf(" %4ld/%-4ld %8.2f %8.2f %5.2f%% %8.2f %8.2f %s [%ld]\n", + printf(" %4ld/%-4ld %8.2f %8.2f %6.2f%% %8.2f %8.2f %s [%ld]\n", (*ap)->calls, (*ap)->to->calls, (*ap)->time, (*ap)->time / ((double) (*ap)->calls), ((*ap)->time / total) * 100.0, -- Sven Wischnowsky wischnow@informatik.hu-berlin.de