changeset 12977:9db4e9b352d6

Add index into FunctionTable to profshow output table. profshow.m: Also print the index into FunctionTable for each line.
author Daniel Kraft <d@domob.eu>
date Fri, 19 Aug 2011 16:39:09 +0200
parents 2e20c26b1007
children fb0f40cd8752
files scripts/general/profshow.m
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/general/profshow.m
+++ b/scripts/general/profshow.m
@@ -63,18 +63,19 @@
   for i = 1 : n
     nameLen = max (nameLen, length (data.FunctionTable(p(i)).FunctionName));
   endfor
-  headerFormat = sprintf ("%%%ds %%4s %%12s %%12s\n", nameLen);
-  rowFormat = sprintf ("%%%ds %%4s %%12.3f %%12d\n", nameLen);
+  headerFormat = sprintf ("%%4s %%%ds %%4s %%12s %%12s\n", nameLen);
+  rowFormat = sprintf ("%%4d %%%ds %%4s %%12.3f %%12d\n", nameLen);
 
-  printf (headerFormat, "Function", "Attr", "Time (s)", "Calls");
-  printf ("%s\n", repmat ("-", 1, nameLen + 2 * 13 + 5));
+  printf (headerFormat, "#", "Function", "Attr", "Time (s)", "Calls");
+  printf ("%s\n", repmat ("-", 1, nameLen + 2 * 5 + 2 * 13));
   for i = 1 : n
     row = data.FunctionTable(p(i));
     attr = "";
     if (row.IsRecursive)
       attr = "R";
     endif
-    printf (rowFormat, row.FunctionName, attr, row.TotalTime, row.NumCalls);
+    printf (rowFormat, p(i), row.FunctionName, attr, ...
+            row.TotalTime, row.NumCalls);
   endfor
 
 endfunction