perf sched: Display time in milliseconds, reorganize output
authorIngo Molnar <mingo@elte.hu>
Sat, 12 Sep 2009 08:08:34 +0000 (10:08 +0200)
committerIngo Molnar <mingo@elte.hu>
Sun, 13 Sep 2009 08:22:44 +0000 (10:22 +0200)
After:

-----------------------------------------------------------------------------------
 Task              |  runtime ms | switches | average delay ms | maximum delay ms |
-----------------------------------------------------------------------------------
 migration/0       |    0.000 ms |        1 | avg:    0.047 ms | max:    0.047 ms |
 ksoftirqd/0       |    0.000 ms |        1 | avg:    0.039 ms | max:    0.039 ms |
 migration/1       |    0.000 ms |        3 | avg:    0.013 ms | max:    0.016 ms |
 migration/3       |    0.000 ms |        2 | avg:    0.003 ms | max:    0.004 ms |
 migration/4       |    0.000 ms |        1 | avg:    0.022 ms | max:    0.022 ms |
 distccd           |    0.000 ms |        1 | avg:    0.004 ms | max:    0.004 ms |
 distccd           |    0.000 ms |        1 | avg:    0.014 ms | max:    0.014 ms |
 distccd           |    0.000 ms |        2 | avg:    0.000 ms | max:    0.000 ms |
 distccd           |    0.000 ms |        2 | avg:    0.012 ms | max:    0.019 ms |
 distccd           |    0.000 ms |        1 | avg:    0.002 ms | max:    0.002 ms |
 as                |    0.000 ms |        2 | avg:    0.019 ms | max:    0.019 ms |
 as                |    0.000 ms |        3 | avg:    0.015 ms | max:    0.017 ms |
 as                |    0.000 ms |        1 | avg:    0.009 ms | max:    0.009 ms |
 perf              |    0.000 ms |        1 | avg:    0.001 ms | max:    0.001 ms |
 gcc               |    0.000 ms |        1 | avg:    0.021 ms | max:    0.021 ms |
 run-mozilla.sh    |    0.000 ms |        2 | avg:    0.010 ms | max:    0.017 ms |
 mozilla-plugin-   |    0.000 ms |        1 | avg:    0.006 ms | max:    0.006 ms |
 gcc               |    0.000 ms |        2 | avg:    0.013 ms | max:    0.013 ms |
-----------------------------------------------------------------------------------

(The runtime ms column is not filled in yet.)

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
tools/perf/builtin-sched.c
tools/perf/util/trace-event-read.c

index 84699cf..a084c28 100644 (file)
@@ -1096,14 +1096,15 @@ static void output_lat_thread(struct thread_latency *lat)
        if (!count)
                return;
 
-       ret = printf("%s", lat->thread->comm);
+       ret = printf(" %s ", lat->thread->comm);
 
-       for (i = 0; i < 25 - ret; i++)
+       for (i = 0; i < 19 - ret; i++)
                printf(" ");
 
        avg = total / count;
 
-       printf("%5d        %10llu       %10llu      %10llu\n", count, total, avg, max);
+       printf("|%9.3f ms |%9d | avg:%9.3f ms | max:%9.3f ms |\n",
+               0.0, count, (double)avg/1e9, (double)max/1e9);
 }
 
 static void __cmd_lat(void)
@@ -1113,11 +1114,9 @@ static void __cmd_lat(void)
        setup_pager();
        read_events();
 
-       printf(" Tasks");
-       printf("                     count");
-       printf("          total");
-       printf("              avg");
-       printf("            max\n\n");
+       printf("-----------------------------------------------------------------------------------\n");
+       printf(" Task              |  runtime ms | switches | average delay ms | maximum delay ms |\n");
+       printf("-----------------------------------------------------------------------------------\n");
 
        next = rb_first(&lat_snapshot_root);
 
@@ -1128,6 +1127,8 @@ static void __cmd_lat(void)
                output_lat_thread(lat);
                next = rb_next(next);
        }
+
+       printf("-----------------------------------------------------------------------------------\n");
 }
 
 static struct trace_sched_handler *trace_handler;
index a1217a1..1b5c847 100644 (file)
@@ -458,12 +458,13 @@ struct record *trace_read_data(int cpu)
        return data;
 }
 
-void trace_report (void)
+void trace_report(void)
 {
        const char *input_file = "trace.info";
        char buf[BUFSIZ];
        char test[] = { 23, 8, 68 };
        char *version;
+       int show_version = 0;
        int show_funcs = 0;
        int show_printk = 0;
 
@@ -480,7 +481,8 @@ void trace_report (void)
                die("not a trace file (missing tracing)");
 
        version = read_string();
-       printf("version = %s\n", version);
+       if (show_version)
+               printf("version = %s\n", version);
        free(version);
 
        read_or_die(buf, 1);