Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

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@xxxxxxxxxxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author