Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1395541

[PATCH 05/17] perf trace: Do not show the runtime_ms for a thread when not collecting it

From Arnaldo Carvalho de Melo <acme@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 05/17] perf trace: Do not show the runtime_ms for a thread when not collecting it
Date 2016-05-06 02:40 +0200
Message-ID <rvBYf-2li-55@gated-at.bofh.it> (permalink)
References <rvBYe-2li-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Arnaldo Carvalho de Melo <acme@redhat.com>

That field is only updated when we use the "sched:sched_stat_runtime"
tracepoint, and that is only done so far when we use the '--stat' command line
option, without it we get just zeros, confusing the users:

Without this patch:

  # trace -a -s sleep 1
  <SNIP>
   qemu-system-x86 (9931), 468 events, 9.6%, 0.000 msec

     syscall     calls    total       min       avg       max      stddev
                          (msec)    (msec)    (msec)    (msec)        (%)
     ---------- ------ --------- --------- --------- ---------     ------
     ppoll          98   982.374     0.000    10.024    29.983     12.65%
     write          34     0.401     0.005     0.012     0.027      5.49%
     ioctl         102     0.347     0.002     0.003     0.007      3.08%

   firefox (10871), 1856 events, 38.2%, 0.000 msec

                          (msec)    (msec)    (msec)    (msec)        (%)
     ---------- ------ --------- --------- --------- ---------     ------
     poll          395   934.873     0.000     2.367    17.120     11.51%
     recvmsg       395     0.988     0.001     0.003     0.021      4.20%
     read          106     0.460     0.002     0.004     0.007      3.17%
     futex          24     0.108     0.001     0.004     0.010     10.05%
     mmap            2     0.041     0.016     0.021     0.026     23.92%
     write           6     0.027     0.004     0.004     0.005      2.52%

After this patch that ', 0.000 msecs' gets suppressed when --stat is not
in use.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Milian Wolff <milian.wolff@kdab.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-p7emqrsw7900tdkg43v9l1e1@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-trace.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index c61e61240b3b..66aa2a00414b 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -2860,7 +2860,11 @@ static size_t trace__fprintf_thread(FILE *fp, struct thread *thread, struct trac
 		printed += fprintf(fp, ", %lu majfaults", ttrace->pfmaj);
 	if (ttrace->pfmin)
 		printed += fprintf(fp, ", %lu minfaults", ttrace->pfmin);
-	printed += fprintf(fp, ", %.3f msec\n", ttrace->runtime_ms);
+	if (trace->sched)
+		printed += fprintf(fp, ", %.3f msec\n", ttrace->runtime_ms);
+	else if (fputc('\n', fp) != EOF)
+		++printed;
+
 	printed += thread__dump_stats(ttrace, trace, fp);
 
 	return printed;
-- 
2.5.5

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[GIT PULL 00/17] perf/core improvements and fixes Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-05-06 02:40 +0200
  [PATCH 11/17] perf hists: Move sort__has_socket into struct perf_hpp_list Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-05-06 02:40 +0200
  [PATCH 02/17] perf tools: Add template for generating rbtree resort class Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-05-06 02:40 +0200
  [PATCH 13/17] perf hists: Move sort__has_comm into struct perf_hpp_list Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-05-06 02:40 +0200
  [PATCH 14/17] perf powerpc: Fix kprobe and kretprobe handling with kallsyms on ppc64le Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-05-06 02:40 +0200
  [PATCH 04/17] perf trace: Sort syscalls stats by msecs in --summary Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-05-06 02:40 +0200
  [PATCH 05/17] perf trace: Do not show the runtime_ms for a thread when not collecting it Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-05-06 02:40 +0200
  [PATCH 01/17] perf machine: Introduce number of threads member Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-05-06 02:40 +0200
  [PATCH 17/17] perf evlist: Rename variable in perf_mmap__read() Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-05-06 02:40 +0200
  [PATCH 10/17] perf hists: Move sort__has_dso into struct perf_hpp_list Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-05-06 02:40 +0200
  [PATCH 03/17] perf trace: Sort summary output by number of events Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-05-06 02:40 +0200
  [PATCH 09/17] perf hists: Move sort__has_sym into struct perf_hpp_list Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-05-06 02:40 +0200
  [PATCH 15/17] perf symbols: Fix kallsyms perf test on ppc64le Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-05-06 02:40 +0200
  Re: [GIT PULL 00/17] perf/core improvements and fixes Ingo Molnar <mingo@kernel.org> - 2016-05-06 08:40 +0200

csiph-web