[PATCH 01/26] perf trace: Add total time column to summary.

2015-08-06 Thread Arnaldo Carvalho de Melo
From: Milian Wolff 

It is cumbersome to manually calculate the total time spent in a given
syscall by multiplying the average value with the number of calls.

Instead, we now do this directly inside perf trace.

Note that this is also done by 'strace', which even adds a column with
relative numbers - something we could do in the future.

Example:

  perf trace -s find /some/folder > /dev/null

   Summary of events:

   find (19976), 700123 events, 100.0%, 0.000 msec

 syscallcallstotal   min   avg   max  stddev
 (msec)(msec)(msec)(msec)(%)
 ---  - - - - --
 read   4 0.006 0.001 0.002 0.003 27.42%
 write   8046 9.617 0.001 0.001 0.035  0.56%
 open   3419640.384 0.001 0.001 0.071  0.30%
 close  6837557.104 0.001 0.001 0.076  0.25%
 stat   4 0.004 0.001 0.001 0.001  3.14%
 fstat  3418927.518 0.001 0.001 0.060  0.34%
 mmap  13 0.029 0.001 0.002 0.003 10.74%
 mprotect   6 0.018 0.002 0.003 0.005 17.04%
 munmap 3 0.014 0.003 0.005 0.006 24.87%
 brk   87 0.490 0.001 0.006 0.016  6.50%
 ioctl  3 0.004 0.001 0.001 0.003 36.39%
 access 1 0.004 0.004 0.004 0.004  0.00%
 uname  1 0.001 0.001 0.001 0.001  0.00%
 getdents   68393   143.600 0.001 0.002 0.187  0.95%
 fchdir 6837156.980 0.001 0.001 0.111  0.39%
 arch_prctl 1 0.001 0.001 0.001 0.001  0.00%
 openat 3418441.737 0.001 0.001 0.102  0.41%
 newfstatat 3418441.180 0.001 0.001 0.064  0.34%

Signed-off-by: Milian Wolff 
Tested-by: Arnaldo Carvalho de Melo 
LPU-Reference: 1438853069-5902-1-git-send-email-milian.wo...@kdab.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/builtin-trace.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index a47497011c93..a25048c85b76 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -2773,9 +2773,9 @@ static size_t thread__dump_stats(struct thread_trace 
*ttrace,
 
printed += fprintf(fp, "\n");
 
-   printed += fprintf(fp, "   syscallcalls  min   avg  
 max  stddev\n");
-   printed += fprintf(fp, "   (msec)(msec) 
   (msec)(%%)\n");
-   printed += fprintf(fp, "   ---  - - 
- --\n");
+   printed += fprintf(fp, "   syscallcallstotal   min  
 avg   max  stddev\n");
+   printed += fprintf(fp, "   (msec)(msec) 
   (msec)(msec)(%%)\n");
+   printed += fprintf(fp, "   ---  - - 
- - --\n");
 
/* each int_node is a syscall */
while (inode) {
@@ -2792,8 +2792,8 @@ static size_t thread__dump_stats(struct thread_trace 
*ttrace,
 
sc = >syscalls.table[inode->i];
printed += fprintf(fp, "   %-15s", sc->name);
-   printed += fprintf(fp, " %8" PRIu64 " %9.3f %9.3f",
-  n, min, avg);
+   printed += fprintf(fp, " %8" PRIu64 " %9.3f %9.3f 
%9.3f",
+  n, avg * n, min, avg);
printed += fprintf(fp, " %9.3f %9.2f%%\n", max, pct);
}
 
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 01/26] perf trace: Add total time column to summary.

2015-08-06 Thread Arnaldo Carvalho de Melo
From: Milian Wolff milian.wo...@kdab.com

It is cumbersome to manually calculate the total time spent in a given
syscall by multiplying the average value with the number of calls.

Instead, we now do this directly inside perf trace.

Note that this is also done by 'strace', which even adds a column with
relative numbers - something we could do in the future.

Example:

  perf trace -s find /some/folder  /dev/null

   Summary of events:

   find (19976), 700123 events, 100.0%, 0.000 msec

 syscallcallstotal   min   avg   max  stddev
 (msec)(msec)(msec)(msec)(%)
 ---  - - - - --
 read   4 0.006 0.001 0.002 0.003 27.42%
 write   8046 9.617 0.001 0.001 0.035  0.56%
 open   3419640.384 0.001 0.001 0.071  0.30%
 close  6837557.104 0.001 0.001 0.076  0.25%
 stat   4 0.004 0.001 0.001 0.001  3.14%
 fstat  3418927.518 0.001 0.001 0.060  0.34%
 mmap  13 0.029 0.001 0.002 0.003 10.74%
 mprotect   6 0.018 0.002 0.003 0.005 17.04%
 munmap 3 0.014 0.003 0.005 0.006 24.87%
 brk   87 0.490 0.001 0.006 0.016  6.50%
 ioctl  3 0.004 0.001 0.001 0.003 36.39%
 access 1 0.004 0.004 0.004 0.004  0.00%
 uname  1 0.001 0.001 0.001 0.001  0.00%
 getdents   68393   143.600 0.001 0.002 0.187  0.95%
 fchdir 6837156.980 0.001 0.001 0.111  0.39%
 arch_prctl 1 0.001 0.001 0.001 0.001  0.00%
 openat 3418441.737 0.001 0.001 0.102  0.41%
 newfstatat 3418441.180 0.001 0.001 0.064  0.34%

Signed-off-by: Milian Wolff milian.wo...@kdab.com
Tested-by: Arnaldo Carvalho de Melo a...@redhat.com
LPU-Reference: 1438853069-5902-1-git-send-email-milian.wo...@kdab.com
Signed-off-by: Arnaldo Carvalho de Melo a...@redhat.com
---
 tools/perf/builtin-trace.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index a47497011c93..a25048c85b76 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -2773,9 +2773,9 @@ static size_t thread__dump_stats(struct thread_trace 
*ttrace,
 
printed += fprintf(fp, \n);
 
-   printed += fprintf(fp,syscallcalls  min   avg  
 max  stddev\n);
-   printed += fprintf(fp,(msec)(msec) 
   (msec)(%%)\n);
-   printed += fprintf(fp,---  - - 
- --\n);
+   printed += fprintf(fp,syscallcallstotal   min  
 avg   max  stddev\n);
+   printed += fprintf(fp,(msec)(msec) 
   (msec)(msec)(%%)\n);
+   printed += fprintf(fp,---  - - 
- - --\n);
 
/* each int_node is a syscall */
while (inode) {
@@ -2792,8 +2792,8 @@ static size_t thread__dump_stats(struct thread_trace 
*ttrace,
 
sc = trace-syscalls.table[inode-i];
printed += fprintf(fp,%-15s, sc-name);
-   printed += fprintf(fp,  %8 PRIu64  %9.3f %9.3f,
-  n, min, avg);
+   printed += fprintf(fp,  %8 PRIu64  %9.3f %9.3f 
%9.3f,
+  n, avg * n, min, avg);
printed += fprintf(fp,  %9.3f %9.2f%%\n, max, pct);
}
 
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/