linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [GIT PULL 00/35] perf/core improvements and fixes
@ 2016-08-23 21:03 Arnaldo Carvalho de Melo
  2016-08-23 21:03 ` [PATCH 01/35] tools: Introduce tools/include/linux/time64.h for *SEC_PER_*SEC macros Arnaldo Carvalho de Melo
                   ` (35 more replies)
  0 siblings, 36 replies; 37+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-08-23 21:03 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	Alexander Shishkin, Alexander Yarygin, Alexey Brodkin,
	Alexei Starovoitov, Arjan van de Ven, Colin King, David Ahern,
	He Kuang, Hemant Kumar, Jiri Olsa, Masami Hiramatsu,
	Mathieu Poirier, Namhyung Kim, Naohiro Aota, Pekka Enberg,
	Peter Zijlstra, Rui Teng, Stanislav Fomichev, Steven Rostedt,
	Vince Weaver, Vineet Gupta, Wang Nan, Arnaldo Carvalho de Melo

Hi Ingo,

	Please consider pulling, I first merged tip/perf/urgent into a
tip/perf/core and rebased the patches I had in acme/perf/core.

- Arnaldo

Build stats at the end of this message.

The following changes since commit ce90c12d2453aa6be743719bb0a5d4040b92700f:

  Merge branch 'perf/urgent' into perf/core, to pick up fixes before merging new changes (2016-08-23 15:35:47 -0300)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo-20160823

for you to fetch changes up to 5e30d55c71de058e4156080fe32d426c22d094cb:

  perf record: Fix spelling mistake "Finshed" -> "Finished" (2016-08-23 17:06:40 -0300)

----------------------------------------------------------------
perf/core improvements and fixes:

User visible:

. Allow configuring the default 'perf report -s' sort order in ~/.perfconfig,
  for instance, "sym,dso" may be more fitting for kernel developers. (Arnaldo Carvalho de Melo)

- Support x8/x16/x32/x64 hexadecimal "types" in ftrace and 'perf probe' (Masami Hiramatsu)

Infrastructure:

- Skip running the feature tests for 'make install-doc' (Rui Teng)

- Introduce tools/include/linux/time64.h with *SEC_PER_*SEC macros
  to use in all of tools/ (Arnaldo Carvalho de Melo)

- Break down symbol__disassemble() into multiple functions, to ease
  future work on better reporting the errors that may take place in
  the various steps it performs (possibly decompressing kernel module
  files, getting build-id keyed files, calling objdump, parsing its
  output, etc) (Arnaldo Carvalho de Melo)

- Typo fixes in various places (Colin Ian King)

- Remove superfluous NULL check in the TUI code (Colin Ian King)

- Allow displaying multiple header lines in the TUI browser, prep
  work for the 'perf c2c' browser (Jiri Olsa)

- Copy coresight-pmu.h header file needed by perf tools (Mathieu Poirier)

- Use __weak definition from linux/compiler.h (Rui Teng)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

----------------------------------------------------------------

Arnaldo Carvalho de Melo (16):
      tools: Introduce tools/include/linux/time64.h for *SEC_PER_*SEC macros
      perf bench numa: Use NSEC_PER_U?SEC
      perf sched: Use linux/time64.h
      perf timechart: Use NSEC_PER_U?SEC
      perf bench sched-pipe: Use linux/time64.h, USEC_PER_SEC
      perf stat: Use *SEC_PER_*SEC macros
      perf bench mem: Use USEC_PER_SEC
      perf bench sched-messaging: Use USEC_PER_MSEC
      perf record: Use USEC_PER_MSEC
      perf kvm: Use NSEC_PER_USEC
      perf bench futex: Use NSEC_PER_USEC
      perf top: Use MSEC_PER_SEC
      perf disassemble: Move check for kallsyms + !kcore
      perf disassemble: Simplify logic for picking the filename to disassemble
      perf disassemble: Extract logic to find file to pass to objdump to a separate function
      perf report: Allow configuring the default sort order in ~/.perfconfig

Colin Ian King (5):
      perf hists browser: Remove superfluous null check on map
      perf tools: Fix typo: "ehough" -> "enough"
      perf test bpf: Fix typo: "ehough" -> "enough"
      perf bpf: Fix typo: "ehough" -> "enough"
      perf record: Fix spelling mistake "Finshed" -> "Finished"

Jiri Olsa (5):
      perf hists: Introduce nr_header_lines into struct perf_hpp_list
      perf hists: Add line argument into perf_hpp_fmt's header callback
      perf tools tui: Display multiple header lines
      perf tools stdio: Display multiple header lines
      perf hists: Add support for header span

Masami Hiramatsu (6):
      ftrace: kprobe: uprobe: Add x8/x16/x32/x64 for hexadecimal types
      ftrace: probe: Add README entries for k/uprobe-events
      perf probe: Add supported for type casting by the running kernel
      perf probe: Support hexadecimal casting
      perf probe: Use hexadecimal type by default if possible
      ftrace: kprobe: uprobe: Show u8/u16/u32/u64 types in decimal

Mathieu Poirier (1):
      tools: Copy coresight-pmu.h header file needed by perf tools

Rui Teng (2):
      perf tools: Use __weak definition from linux/compiler.h
      perf tools: Skip running the feature tests for 'make install-doc'

 Documentation/trace/kprobetrace.txt                |  9 ++-
 Documentation/trace/uprobetracer.txt               |  9 ++-
 kernel/trace/trace.c                               | 24 ++++++
 kernel/trace/trace_kprobe.c                        |  4 +
 kernel/trace/trace_probe.c                         | 30 ++++----
 kernel/trace/trace_probe.h                         | 11 ++-
 kernel/trace/trace_uprobe.c                        |  4 +
 tools/include/linux/coresight-pmu.h                | 39 ++++++++++
 tools/include/linux/time64.h                       | 12 +++
 tools/perf/Documentation/perf-config.txt           |  4 +
 tools/perf/Documentation/perf-probe.txt            |  5 +-
 tools/perf/MANIFEST                                |  2 +
 tools/perf/Makefile.perf                           |  5 +-
 tools/perf/bench/futex-requeue.c                   |  5 +-
 tools/perf/bench/futex-wake-parallel.c             |  5 +-
 tools/perf/bench/futex-wake.c                      |  5 +-
 tools/perf/bench/mem-functions.c                   |  3 +-
 tools/perf/bench/numa.c                            | 53 ++++++-------
 tools/perf/bench/sched-messaging.c                 |  5 +-
 tools/perf/bench/sched-pipe.c                      |  9 ++-
 tools/perf/builtin-diff.c                          |  4 +-
 tools/perf/builtin-kvm.c                           | 11 +--
 tools/perf/builtin-record.c                        |  8 +-
 tools/perf/builtin-report.c                        |  4 +
 tools/perf/builtin-sched.c                         | 37 ++++-----
 tools/perf/builtin-script.c                        |  7 +-
 tools/perf/builtin-stat.c                          | 19 ++---
 tools/perf/builtin-timechart.c                     | 13 ++--
 tools/perf/builtin-top.c                           |  3 +-
 tools/perf/builtin-trace.c                         |  1 +
 tools/perf/perf.h                                  |  7 --
 tools/perf/tests/backward-ring-buffer.c            |  2 +-
 tools/perf/tests/bpf.c                             |  2 +-
 tools/perf/ui/browsers/hists.c                     | 50 +++++++++----
 tools/perf/ui/gtk/hists.c                          |  2 +-
 tools/perf/ui/hist.c                               |  4 +-
 tools/perf/ui/stdio/hist.c                         | 45 +++++++----
 tools/perf/util/annotate.c                         | 87 +++++++++++-----------
 tools/perf/util/bpf-loader.c                       |  2 +-
 tools/perf/util/debug.c                            | 10 +--
 tools/perf/util/header.c                           |  3 +-
 tools/perf/util/hist.h                             |  3 +-
 tools/perf/util/probe-file.c                       | 57 ++++++++++++++
 tools/perf/util/probe-file.h                       | 10 +++
 tools/perf/util/probe-finder.c                     | 19 +++--
 .../perf/util/scripting-engines/trace-event-perl.c |  5 +-
 .../util/scripting-engines/trace-event-python.c    |  5 +-
 tools/perf/util/sort.c                             |  9 ++-
 tools/perf/util/sort.h                             |  2 +-
 tools/perf/util/svghelper.c                        | 11 +--
 tools/perf/util/util.c                             |  1 +
 tools/perf/util/util.h                             |  4 -
 52 files changed, 464 insertions(+), 226 deletions(-)
 create mode 100644 tools/include/linux/coresight-pmu.h
 create mode 100644 tools/include/linux/time64.h

Build Stats:

News:

The fedora:24-x-ARC-uClibc adds the ARC arch and the uClibc libc to the mix of
targets tested, still with a minimal build that doesn't include even libelf,
that will be added soon, using a more full featured pre-built toolchain provided
by the Synopsys folks.

  [root@jouet ~]# time dm
   1 70.304638757 alpine:3.4: Ok
   2 24.806303766 android-ndk:r12b-arm: Ok
   3 71.829633643 archlinux:latest: Ok
   4 39.316551941 centos:5: Ok
   5 59.282978228 centos:6: Ok
   6 69.836088394 centos:7: Ok
   7 63.476952272 debian:7: Ok
   8 69.450110099 debian:8: Ok
   9 72.484714796 debian:experimental: Ok
  10 69.730035221 fedora:20: Ok
  11 73.629813614 fedora:21: Ok
  12 71.955425760 fedora:22: Ok
  13 73.015579053 fedora:23: Ok
  14 81.186943795 fedora:24: Ok
  15 31.401503154 fedora:24-x-ARC-uClibc: Ok
  16 78.366606942 fedora:rawhide: Ok
  17 77.434661064 mageia:5: Ok
  18 74.491020416 opensuse:13.2: Ok
  19 71.673570141 opensuse:42.1: Ok
  20 79.587415167 opensuse:tumbleweed: Ok
  21 57.802976895 ubuntu:12.04.5: Ok
  22 68.505810699 ubuntu:14.04.4: Ok
  23 69.478057262 ubuntu:15.10: Ok
  24 65.596669700 ubuntu:16.04: Ok
  25 52.759886216 ubuntu:16.04-x-arm: Ok
  26 52.389293077 ubuntu:16.04-x-arm64: Ok
  27 52.319141734 ubuntu:16.04-x-powerpc64: Ok
  28 54.378287607 ubuntu:16.04-x-powerpc64el: Ok
  29 72.794919209 ubuntu:16.10: Ok
  30 53.351899868 ubuntu:16.10-x-s390: Ok
     1922.64s

  real	32m3.246s
  user	0m1.858s
  sys	0m2.363s
  [root@jouet ~]#

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 01/35] tools: Introduce tools/include/linux/time64.h for *SEC_PER_*SEC macros
  2016-08-23 21:03 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
@ 2016-08-23 21:03 ` Arnaldo Carvalho de Melo
  2016-08-23 21:03 ` [PATCH 02/35] perf bench numa: Use NSEC_PER_U?SEC Arnaldo Carvalho de Melo
                   ` (34 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-08-23 21:03 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	David Ahern, Jiri Olsa, Namhyung Kim, Steven Rostedt, Wang Nan

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

And remove it from tools/perf/{perf,util}.h, making code that needs
these macros to include linux/time64.h instead, to match how this is
used in the kernel sources.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-e69fc1pvkgt57yvxqt6eunyg@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/include/linux/time64.h                           | 12 ++++++++++++
 tools/perf/MANIFEST                                    |  1 +
 tools/perf/builtin-kvm.c                               |  1 +
 tools/perf/builtin-script.c                            |  7 ++++---
 tools/perf/builtin-stat.c                              |  7 ++++---
 tools/perf/builtin-trace.c                             |  1 +
 tools/perf/perf.h                                      |  7 -------
 tools/perf/util/debug.c                                | 10 ++++------
 tools/perf/util/scripting-engines/trace-event-perl.c   |  5 +++--
 tools/perf/util/scripting-engines/trace-event-python.c |  5 +++--
 tools/perf/util/util.c                                 |  1 +
 tools/perf/util/util.h                                 |  4 ----
 12 files changed, 34 insertions(+), 27 deletions(-)
 create mode 100644 tools/include/linux/time64.h

diff --git a/tools/include/linux/time64.h b/tools/include/linux/time64.h
new file mode 100644
index 000000000000..df9265483d65
--- /dev/null
+++ b/tools/include/linux/time64.h
@@ -0,0 +1,12 @@
+#ifndef _TOOLS_LINUX_TIME64_H
+#define _TOOLS_LINUX_TIME64_H
+
+#define MSEC_PER_SEC	1000L
+#define USEC_PER_MSEC	1000L
+#define NSEC_PER_USEC	1000L
+#define NSEC_PER_MSEC	1000000L
+#define USEC_PER_SEC	1000000L
+#define NSEC_PER_SEC	1000000000L
+#define FSEC_PER_SEC	1000000000000000LL
+
+#endif /* _LINUX_TIME64_H */
diff --git a/tools/perf/MANIFEST b/tools/perf/MANIFEST
index ad2534df4ba6..f23a5e72aaa5 100644
--- a/tools/perf/MANIFEST
+++ b/tools/perf/MANIFEST
@@ -77,4 +77,5 @@ tools/include/linux/stringify.h
 tools/include/linux/types.h
 tools/include/linux/err.h
 tools/include/linux/bitmap.h
+tools/include/linux/time64.h
 tools/arch/*/include/uapi/asm/perf_regs.h
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index 5e2127e04f83..a0040f74e935 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -24,6 +24,7 @@
 #include <sys/timerfd.h>
 #endif
 
+#include <linux/time64.h>
 #include <termios.h>
 #include <semaphore.h>
 #include <pthread.h>
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index c859e59dfe3e..6b3c8b0d3276 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -24,6 +24,7 @@
 #include "util/thread-stack.h"
 #include <linux/bitmap.h>
 #include <linux/stringify.h>
+#include <linux/time64.h>
 #include "asm/bug.h"
 #include "util/mem-events.h"
 
@@ -464,9 +465,9 @@ static void print_sample_start(struct perf_sample *sample,
 
 	if (PRINT_FIELD(TIME)) {
 		nsecs = sample->time;
-		secs = nsecs / NSECS_PER_SEC;
-		nsecs -= secs * NSECS_PER_SEC;
-		usecs = nsecs / NSECS_PER_USEC;
+		secs = nsecs / NSEC_PER_SEC;
+		nsecs -= secs * NSEC_PER_SEC;
+		usecs = nsecs / NSEC_PER_USEC;
 		if (nanosecs)
 			printf("%5lu.%09llu: ", secs, nsecs);
 		else
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 3c7452b39f57..e33a66bffbdb 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -65,6 +65,7 @@
 #include "util/group.h"
 #include "asm/bug.h"
 
+#include <linux/time64.h>
 #include <api/fs/fs.h>
 #include <stdlib.h>
 #include <sys/prctl.h>
@@ -354,7 +355,7 @@ static void process_interval(void)
 	diff_timespec(&rs, &ts, &ref_time);
 
 	if (STAT_RECORD) {
-		if (WRITE_STAT_ROUND_EVENT(rs.tv_sec * NSECS_PER_SEC + rs.tv_nsec, INTERVAL))
+		if (WRITE_STAT_ROUND_EVENT(rs.tv_sec * NSEC_PER_SEC + rs.tv_nsec, INTERVAL))
 			pr_err("failed to write stat round event\n");
 	}
 
@@ -2175,8 +2176,8 @@ static int process_stat_round_event(struct perf_tool *tool __maybe_unused,
 		update_stats(&walltime_nsecs_stats, stat_round->time);
 
 	if (stat_config.interval && stat_round->time) {
-		tsh.tv_sec  = stat_round->time / NSECS_PER_SEC;
-		tsh.tv_nsec = stat_round->time % NSECS_PER_SEC;
+		tsh.tv_sec  = stat_round->time / NSEC_PER_SEC;
+		tsh.tv_nsec = stat_round->time % NSEC_PER_SEC;
 		ts = &tsh;
 	}
 
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index b8c6766301db..b4fc1ab3d2a7 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -45,6 +45,7 @@
 #include <linux/audit.h>
 #include <linux/random.h>
 #include <linux/stringify.h>
+#include <linux/time64.h>
 
 #ifndef O_CLOEXEC
 # define O_CLOEXEC		02000000
diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index cb0f1356ff81..9a0236a4cf95 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -14,13 +14,6 @@ void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu,
 #define HAVE_ATTR_TEST
 #include "perf-sys.h"
 
-#ifndef NSEC_PER_SEC
-# define NSEC_PER_SEC			1000000000ULL
-#endif
-#ifndef NSEC_PER_USEC
-# define NSEC_PER_USEC			1000ULL
-#endif
-
 static inline unsigned long long rdclock(void)
 {
 	struct timespec ts;
diff --git a/tools/perf/util/debug.c b/tools/perf/util/debug.c
index 8c4212abd19b..c1838b643108 100644
--- a/tools/perf/util/debug.c
+++ b/tools/perf/util/debug.c
@@ -6,6 +6,7 @@
 #include <stdarg.h>
 #include <stdio.h>
 #include <api/debug.h>
+#include <linux/time64.h>
 
 #include "cache.h"
 #include "color.h"
@@ -14,9 +15,6 @@
 #include "util.h"
 #include "target.h"
 
-#define NSECS_PER_SEC  1000000000ULL
-#define NSECS_PER_USEC 1000ULL
-
 int verbose;
 bool dump_trace = false, quiet = false;
 int debug_ordered_events;
@@ -54,9 +52,9 @@ static int veprintf_time(u64 t, const char *fmt, va_list args)
 	int ret = 0;
 	u64 secs, usecs, nsecs = t;
 
-	secs   = nsecs / NSECS_PER_SEC;
-	nsecs -= secs  * NSECS_PER_SEC;
-	usecs  = nsecs / NSECS_PER_USEC;
+	secs   = nsecs / NSEC_PER_SEC;
+	nsecs -= secs  * NSEC_PER_SEC;
+	usecs  = nsecs / NSEC_PER_USEC;
 
 	ret = fprintf(stderr, "[%13" PRIu64 ".%06" PRIu64 "] ",
 		      secs, usecs);
diff --git a/tools/perf/util/scripting-engines/trace-event-perl.c b/tools/perf/util/scripting-engines/trace-event-perl.c
index 5d1eb1ccd96c..e55a132f69b7 100644
--- a/tools/perf/util/scripting-engines/trace-event-perl.c
+++ b/tools/perf/util/scripting-engines/trace-event-perl.c
@@ -25,6 +25,7 @@
 #include <ctype.h>
 #include <errno.h>
 #include <linux/bitmap.h>
+#include <linux/time64.h>
 
 #include "../util.h"
 #include <EXTERN.h>
@@ -359,8 +360,8 @@ static void perl_process_tracepoint(struct perf_sample *sample,
 	if (!test_and_set_bit(event->id, events_defined))
 		define_event_symbols(event, handler, event->print_fmt.args);
 
-	s = nsecs / NSECS_PER_SEC;
-	ns = nsecs - s * NSECS_PER_SEC;
+	s = nsecs / NSEC_PER_SEC;
+	ns = nsecs - s * NSEC_PER_SEC;
 
 	scripting_context->event_data = data;
 	scripting_context->pevent = evsel->tp_format->pevent;
diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c
index e0203b979474..089438da1f7f 100644
--- a/tools/perf/util/scripting-engines/trace-event-python.c
+++ b/tools/perf/util/scripting-engines/trace-event-python.c
@@ -27,6 +27,7 @@
 #include <stdbool.h>
 #include <errno.h>
 #include <linux/bitmap.h>
+#include <linux/time64.h>
 
 #include "../../perf.h"
 #include "../debug.h"
@@ -426,8 +427,8 @@ static void python_process_tracepoint(struct perf_sample *sample,
 		if (!dict)
 			Py_FatalError("couldn't create Python dict");
 	}
-	s = nsecs / NSECS_PER_SEC;
-	ns = nsecs - s * NSECS_PER_SEC;
+	s = nsecs / NSEC_PER_SEC;
+	ns = nsecs - s * NSEC_PER_SEC;
 
 	scripting_context->event_data = data;
 	scripting_context->pevent = evsel->tp_format->pevent;
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index cee559d8c9e8..85c56800f17a 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -15,6 +15,7 @@
 #include <byteswap.h>
 #include <linux/kernel.h>
 #include <linux/log2.h>
+#include <linux/time64.h>
 #include <unistd.h>
 #include "callchain.h"
 #include "strlist.h"
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index e5f55477491d..43899e0d6fa1 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -179,10 +179,6 @@ static inline void *zalloc(size_t size)
 #undef tolower
 #undef toupper
 
-#ifndef NSEC_PER_MSEC
-#define NSEC_PER_MSEC	1000000L
-#endif
-
 int parse_nsec_time(const char *str, u64 *ptime);
 
 extern unsigned char sane_ctype[256];
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 02/35] perf bench numa: Use NSEC_PER_U?SEC
  2016-08-23 21:03 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
  2016-08-23 21:03 ` [PATCH 01/35] tools: Introduce tools/include/linux/time64.h for *SEC_PER_*SEC macros Arnaldo Carvalho de Melo
@ 2016-08-23 21:03 ` Arnaldo Carvalho de Melo
  2016-08-23 21:03 ` [PATCH 03/35] perf sched: Use linux/time64.h Arnaldo Carvalho de Melo
                   ` (33 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-08-23 21:03 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	David Ahern, Jiri Olsa, Namhyung Kim, Steven Rostedt, Wang Nan

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

Following kernel practices, using linux/time64.h

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-7vnv15263y50qku76p4w5xk6@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/bench/numa.c | 53 +++++++++++++++++++++++++------------------------
 1 file changed, 27 insertions(+), 26 deletions(-)

diff --git a/tools/perf/bench/numa.c b/tools/perf/bench/numa.c
index f7f530081aa9..8efe904e486b 100644
--- a/tools/perf/bench/numa.c
+++ b/tools/perf/bench/numa.c
@@ -30,6 +30,7 @@
 #include <sys/wait.h>
 #include <sys/prctl.h>
 #include <sys/types.h>
+#include <linux/time64.h>
 
 #include <numa.h>
 #include <numaif.h>
@@ -1004,7 +1005,7 @@ static void calc_convergence(double runtime_ns_max, double *convergence)
 	if (strong && process_groups == g->p.nr_proc) {
 		if (!*convergence) {
 			*convergence = runtime_ns_max;
-			tprintf(" (%6.1fs converged)\n", *convergence/1e9);
+			tprintf(" (%6.1fs converged)\n", *convergence / NSEC_PER_SEC);
 			if (g->p.measure_convergence) {
 				g->all_converged = true;
 				g->stop_work = true;
@@ -1012,7 +1013,7 @@ static void calc_convergence(double runtime_ns_max, double *convergence)
 		}
 	} else {
 		if (*convergence) {
-			tprintf(" (%6.1fs de-converged)", runtime_ns_max/1e9);
+			tprintf(" (%6.1fs de-converged)", runtime_ns_max / NSEC_PER_SEC);
 			*convergence = 0;
 		}
 		tprintf("\n");
@@ -1022,7 +1023,7 @@ static void calc_convergence(double runtime_ns_max, double *convergence)
 static void show_summary(double runtime_ns_max, int l, double *convergence)
 {
 	tprintf("\r #  %5.1f%%  [%.1f mins]",
-		(double)(l+1)/g->p.nr_loops*100.0, runtime_ns_max/1e9 / 60.0);
+		(double)(l+1)/g->p.nr_loops*100.0, runtime_ns_max / NSEC_PER_SEC / 60.0);
 
 	calc_convergence(runtime_ns_max, convergence);
 
@@ -1179,8 +1180,8 @@ static void *worker_thread(void *__tdata)
 
 		if (details >= 3) {
 			timersub(&stop, &start, &diff);
-			runtime_ns_max = diff.tv_sec * 1000000000;
-			runtime_ns_max += diff.tv_usec * 1000;
+			runtime_ns_max = diff.tv_sec * NSEC_PER_SEC;
+			runtime_ns_max += diff.tv_usec * NSEC_PER_USEC;
 
 			if (details >= 0) {
 				printf(" #%2d / %2d: %14.2lf nsecs/op [val: %016"PRIx64"]\n",
@@ -1192,23 +1193,23 @@ static void *worker_thread(void *__tdata)
 			continue;
 
 		timersub(&stop, &start0, &diff);
-		runtime_ns_max = diff.tv_sec * 1000000000ULL;
-		runtime_ns_max += diff.tv_usec * 1000ULL;
+		runtime_ns_max = diff.tv_sec * NSEC_PER_SEC;
+		runtime_ns_max += diff.tv_usec * NSEC_PER_USEC;
 
 		show_summary(runtime_ns_max, l, &convergence);
 	}
 
 	gettimeofday(&stop, NULL);
 	timersub(&stop, &start0, &diff);
-	td->runtime_ns = diff.tv_sec * 1000000000ULL;
-	td->runtime_ns += diff.tv_usec * 1000ULL;
-	td->speed_gbs = bytes_done / (td->runtime_ns / 1e9) / 1e9;
+	td->runtime_ns = diff.tv_sec * NSEC_PER_SEC;
+	td->runtime_ns += diff.tv_usec * NSEC_PER_USEC;
+	td->speed_gbs = bytes_done / (td->runtime_ns / NSEC_PER_SEC) / 1e9;
 
 	getrusage(RUSAGE_THREAD, &rusage);
-	td->system_time_ns = rusage.ru_stime.tv_sec * 1000000000ULL;
-	td->system_time_ns += rusage.ru_stime.tv_usec * 1000ULL;
-	td->user_time_ns = rusage.ru_utime.tv_sec * 1000000000ULL;
-	td->user_time_ns += rusage.ru_utime.tv_usec * 1000ULL;
+	td->system_time_ns = rusage.ru_stime.tv_sec * NSEC_PER_SEC;
+	td->system_time_ns += rusage.ru_stime.tv_usec * NSEC_PER_USEC;
+	td->user_time_ns = rusage.ru_utime.tv_sec * NSEC_PER_SEC;
+	td->user_time_ns += rusage.ru_utime.tv_usec * NSEC_PER_USEC;
 
 	free_data(thread_data, g->p.bytes_thread);
 
@@ -1469,7 +1470,7 @@ static int __bench_numa(const char *name)
 	}
 	/* Wait for all the threads to start up: */
 	while (g->nr_tasks_started != g->p.nr_tasks)
-		usleep(1000);
+		usleep(USEC_PER_MSEC);
 
 	BUG_ON(g->nr_tasks_started != g->p.nr_tasks);
 
@@ -1488,9 +1489,9 @@ static int __bench_numa(const char *name)
 
 		timersub(&stop, &start, &diff);
 
-		startup_sec = diff.tv_sec * 1000000000.0;
-		startup_sec += diff.tv_usec * 1000.0;
-		startup_sec /= 1e9;
+		startup_sec = diff.tv_sec * NSEC_PER_SEC;
+		startup_sec += diff.tv_usec * NSEC_PER_USEC;
+		startup_sec /= NSEC_PER_SEC;
 
 		tprintf(" threads initialized in %.6f seconds.\n", startup_sec);
 		tprintf(" #\n");
@@ -1529,14 +1530,14 @@ static int __bench_numa(const char *name)
 	tprintf("\n ###\n");
 	tprintf("\n");
 
-	runtime_sec_max = diff.tv_sec * 1000000000.0;
-	runtime_sec_max += diff.tv_usec * 1000.0;
-	runtime_sec_max /= 1e9;
+	runtime_sec_max = diff.tv_sec * NSEC_PER_SEC;
+	runtime_sec_max += diff.tv_usec * NSEC_PER_USEC;
+	runtime_sec_max /= NSEC_PER_SEC;
 
-	runtime_sec_min = runtime_ns_min/1e9;
+	runtime_sec_min = runtime_ns_min / NSEC_PER_SEC;
 
 	bytes = g->bytes_done;
-	runtime_avg = (double)runtime_ns_sum / g->p.nr_tasks / 1e9;
+	runtime_avg = (double)runtime_ns_sum / g->p.nr_tasks / NSEC_PER_SEC;
 
 	if (g->p.measure_convergence) {
 		print_res(name, runtime_sec_max,
@@ -1562,7 +1563,7 @@ static int __bench_numa(const char *name)
 	print_res(name, bytes / 1e9,
 		"GB,", "data-total",		"GB data processed, total");
 
-	print_res(name, runtime_sec_max * 1e9 / (bytes / g->p.nr_tasks),
+	print_res(name, runtime_sec_max * NSEC_PER_SEC / (bytes / g->p.nr_tasks),
 		"nsecs,", "runtime/byte/thread","nsecs/byte/thread runtime");
 
 	print_res(name, bytes / g->p.nr_tasks / 1e9 / runtime_sec_max,
@@ -1581,9 +1582,9 @@ static int __bench_numa(const char *name)
 				snprintf(tname, 32, "process%d:thread%d", p, t);
 				print_res(tname, td->speed_gbs,
 					"GB/sec",	"thread-speed", "GB/sec/thread speed");
-				print_res(tname, td->system_time_ns / 1e9,
+				print_res(tname, td->system_time_ns / NSEC_PER_SEC,
 					"secs",	"thread-system-time", "system CPU time/thread");
-				print_res(tname, td->user_time_ns / 1e9,
+				print_res(tname, td->user_time_ns / NSEC_PER_SEC,
 					"secs",	"thread-user-time", "user CPU time/thread");
 			}
 		}
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 03/35] perf sched: Use linux/time64.h
  2016-08-23 21:03 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
  2016-08-23 21:03 ` [PATCH 01/35] tools: Introduce tools/include/linux/time64.h for *SEC_PER_*SEC macros Arnaldo Carvalho de Melo
  2016-08-23 21:03 ` [PATCH 02/35] perf bench numa: Use NSEC_PER_U?SEC Arnaldo Carvalho de Melo
@ 2016-08-23 21:03 ` Arnaldo Carvalho de Melo
  2016-08-23 21:03 ` [PATCH 04/35] perf timechart: Use NSEC_PER_U?SEC Arnaldo Carvalho de Melo
                   ` (32 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-08-23 21:03 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	David Ahern, Jiri Olsa, Namhyung Kim, Steven Rostedt, Wang Nan

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

Probably the next step is to introduce linux/time.h and use
timespec_to_ns(), etc.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-4nqhskn27fn93cz3ukbc8drf@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-sched.c | 37 +++++++++++++++++++------------------
 1 file changed, 19 insertions(+), 18 deletions(-)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 0dfe8df2ab9b..f5503ca22e1c 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -26,6 +26,7 @@
 #include <pthread.h>
 #include <math.h>
 #include <api/fs/fs.h>
+#include <linux/time64.h>
 
 #define PR_SET_NAME		15               /* Set process name */
 #define MAX_CPUS		4096
@@ -199,7 +200,7 @@ static u64 get_nsecs(void)
 
 	clock_gettime(CLOCK_MONOTONIC, &ts);
 
-	return ts.tv_sec * 1000000000ULL + ts.tv_nsec;
+	return ts.tv_sec * NSEC_PER_SEC + ts.tv_nsec;
 }
 
 static void burn_nsecs(struct perf_sched *sched, u64 nsecs)
@@ -223,7 +224,7 @@ static void sleep_nsecs(u64 nsecs)
 
 static void calibrate_run_measurement_overhead(struct perf_sched *sched)
 {
-	u64 T0, T1, delta, min_delta = 1000000000ULL;
+	u64 T0, T1, delta, min_delta = NSEC_PER_SEC;
 	int i;
 
 	for (i = 0; i < 10; i++) {
@@ -240,7 +241,7 @@ static void calibrate_run_measurement_overhead(struct perf_sched *sched)
 
 static void calibrate_sleep_measurement_overhead(struct perf_sched *sched)
 {
-	u64 T0, T1, delta, min_delta = 1000000000ULL;
+	u64 T0, T1, delta, min_delta = NSEC_PER_SEC;
 	int i;
 
 	for (i = 0; i < 10; i++) {
@@ -452,8 +453,8 @@ static u64 get_cpu_usage_nsec_parent(void)
 	err = getrusage(RUSAGE_SELF, &ru);
 	BUG_ON(err);
 
-	sum =  ru.ru_utime.tv_sec*1e9 + ru.ru_utime.tv_usec*1e3;
-	sum += ru.ru_stime.tv_sec*1e9 + ru.ru_stime.tv_usec*1e3;
+	sum =  ru.ru_utime.tv_sec * NSEC_PER_SEC + ru.ru_utime.tv_usec * NSEC_PER_USEC;
+	sum += ru.ru_stime.tv_sec * NSEC_PER_SEC + ru.ru_stime.tv_usec * NSEC_PER_USEC;
 
 	return sum;
 }
@@ -667,12 +668,12 @@ static void run_one_test(struct perf_sched *sched)
 		sched->run_avg = delta;
 	sched->run_avg = (sched->run_avg * (sched->replay_repeat - 1) + delta) / sched->replay_repeat;
 
-	printf("#%-3ld: %0.3f, ", sched->nr_runs, (double)delta / 1000000.0);
+	printf("#%-3ld: %0.3f, ", sched->nr_runs, (double)delta / NSEC_PER_MSEC);
 
-	printf("ravg: %0.2f, ", (double)sched->run_avg / 1e6);
+	printf("ravg: %0.2f, ", (double)sched->run_avg / NSEC_PER_MSEC);
 
 	printf("cpu: %0.2f / %0.2f",
-		(double)sched->cpu_usage / 1e6, (double)sched->runavg_cpu_usage / 1e6);
+		(double)sched->cpu_usage / NSEC_PER_MSEC, (double)sched->runavg_cpu_usage / NSEC_PER_MSEC);
 
 #if 0
 	/*
@@ -680,8 +681,8 @@ static void run_one_test(struct perf_sched *sched)
 	 * accurate than the sched->sum_exec_runtime based statistics:
 	 */
 	printf(" [%0.2f / %0.2f]",
-		(double)sched->parent_cpu_usage/1e6,
-		(double)sched->runavg_parent_cpu_usage/1e6);
+		(double)sched->parent_cpu_usage / NSEC_PER_MSEC,
+		(double)sched->runavg_parent_cpu_usage / NSEC_PER_MSEC);
 #endif
 
 	printf("\n");
@@ -696,13 +697,13 @@ static void test_calibrations(struct perf_sched *sched)
 	u64 T0, T1;
 
 	T0 = get_nsecs();
-	burn_nsecs(sched, 1e6);
+	burn_nsecs(sched, NSEC_PER_MSEC);
 	T1 = get_nsecs();
 
 	printf("the run test took %" PRIu64 " nsecs\n", T1 - T0);
 
 	T0 = get_nsecs();
-	sleep_nsecs(1e6);
+	sleep_nsecs(NSEC_PER_MSEC);
 	T1 = get_nsecs();
 
 	printf("the sleep test took %" PRIu64 " nsecs\n", T1 - T0);
@@ -1213,10 +1214,10 @@ static void output_lat_thread(struct perf_sched *sched, struct work_atoms *work_
 	avg = work_list->total_lat / work_list->nb_atoms;
 
 	printf("|%11.3f ms |%9" PRIu64 " | avg:%9.3f ms | max:%9.3f ms | max at: %13.6f s\n",
-	      (double)work_list->total_runtime / 1e6,
-		 work_list->nb_atoms, (double)avg / 1e6,
-		 (double)work_list->max_lat / 1e6,
-		 (double)work_list->max_lat_at / 1e9);
+	      (double)work_list->total_runtime / NSEC_PER_MSEC,
+		 work_list->nb_atoms, (double)avg / NSEC_PER_MSEC,
+		 (double)work_list->max_lat / NSEC_PER_MSEC,
+		 (double)work_list->max_lat_at / NSEC_PER_SEC);
 }
 
 static int pid_cmp(struct work_atoms *l, struct work_atoms *r)
@@ -1491,7 +1492,7 @@ static int map_switch_event(struct perf_sched *sched, struct perf_evsel *evsel,
 	if (sched->map.cpus && !cpu_map__has(sched->map.cpus, this_cpu))
 		goto out;
 
-	color_fprintf(stdout, color, "  %12.6f secs ", (double)timestamp/1e9);
+	color_fprintf(stdout, color, "  %12.6f secs ", (double)timestamp / NSEC_PER_SEC);
 	if (new_shortname) {
 		const char *pid_color = color;
 
@@ -1753,7 +1754,7 @@ static int perf_sched__lat(struct perf_sched *sched)
 
 	printf(" -----------------------------------------------------------------------------------------------------------------\n");
 	printf("  TOTAL:                |%11.3f ms |%9" PRIu64 " |\n",
-		(double)sched->all_runtime / 1e6, sched->all_count);
+		(double)sched->all_runtime / NSEC_PER_MSEC, sched->all_count);
 
 	printf(" ---------------------------------------------------\n");
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 04/35] perf timechart: Use NSEC_PER_U?SEC
  2016-08-23 21:03 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (2 preceding siblings ...)
  2016-08-23 21:03 ` [PATCH 03/35] perf sched: Use linux/time64.h Arnaldo Carvalho de Melo
@ 2016-08-23 21:03 ` Arnaldo Carvalho de Melo
  2016-08-23 21:03 ` [PATCH 05/35] perf bench sched-pipe: Use linux/time64.h, USEC_PER_SEC Arnaldo Carvalho de Melo
                   ` (31 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-08-23 21:03 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	Arjan van de Ven, David Ahern, Jiri Olsa, Namhyung Kim,
	Stanislav Fomichev, Steven Rostedt, Wang Nan

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

Following kernel practices, using linux/time64.h

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Arjan van de Ven <arjan@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stanislav Fomichev <stfomichev@yandex-team.ru>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-5l1md8lsdhfnrlsqyejzo9w2@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-timechart.c | 13 +++++++------
 tools/perf/util/svghelper.c    | 11 ++++++-----
 2 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c
index 733a55422d03..e7eaa298d34a 100644
--- a/tools/perf/builtin-timechart.c
+++ b/tools/perf/builtin-timechart.c
@@ -24,6 +24,7 @@
 #include "util/evlist.h"
 #include "util/evsel.h"
 #include <linux/rbtree.h>
+#include <linux/time64.h>
 #include "util/symbol.h"
 #include "util/callchain.h"
 #include "util/strlist.h"
@@ -1288,9 +1289,9 @@ static void draw_process_bars(struct timechart *tchart)
 			if (c->comm) {
 				char comm[256];
 				if (c->total_time > 5000000000) /* 5 seconds */
-					sprintf(comm, "%s:%i (%2.2fs)", c->comm, p->pid, c->total_time / 1000000000.0);
+					sprintf(comm, "%s:%i (%2.2fs)", c->comm, p->pid, c->total_time / (double)NSEC_PER_SEC);
 				else
-					sprintf(comm, "%s:%i (%3.1fms)", c->comm, p->pid, c->total_time / 1000000.0);
+					sprintf(comm, "%s:%i (%3.1fms)", c->comm, p->pid, c->total_time / (double)NSEC_PER_MSEC);
 
 				svg_text(Y, c->start_time, comm);
 			}
@@ -1637,7 +1638,7 @@ static int __cmd_timechart(struct timechart *tchart, const char *output_name)
 	write_svg_file(tchart, output_name);
 
 	pr_info("Written %2.1f seconds of trace to %s.\n",
-		(tchart->last_time - tchart->first_time) / 1000000000.0, output_name);
+		(tchart->last_time - tchart->first_time) / (double)NSEC_PER_SEC, output_name);
 out_delete:
 	perf_session__delete(session);
 	return ret;
@@ -1901,10 +1902,10 @@ parse_time(const struct option *opt, const char *arg, int __maybe_unused unset)
 	if (sscanf(arg, "%" PRIu64 "%cs", value, &unit) > 0) {
 		switch (unit) {
 		case 'm':
-			*value *= 1000000;
+			*value *= NSEC_PER_MSEC;
 			break;
 		case 'u':
-			*value *= 1000;
+			*value *= NSEC_PER_USEC;
 			break;
 		case 'n':
 			break;
@@ -1928,7 +1929,7 @@ int cmd_timechart(int argc, const char **argv,
 			.ordered_events	 = true,
 		},
 		.proc_num = 15,
-		.min_time = 1000000,
+		.min_time = NSEC_PER_MSEC,
 		.merge_dist = 1000,
 	};
 	const char *output_name = "output.svg";
diff --git a/tools/perf/util/svghelper.c b/tools/perf/util/svghelper.c
index eec6c1149f44..1cbada2dc6be 100644
--- a/tools/perf/util/svghelper.c
+++ b/tools/perf/util/svghelper.c
@@ -18,6 +18,7 @@
 #include <unistd.h>
 #include <string.h>
 #include <linux/bitmap.h>
+#include <linux/time64.h>
 
 #include "perf.h"
 #include "svghelper.h"
@@ -274,14 +275,14 @@ static char *time_to_string(u64 duration)
 
 	text[0] = 0;
 
-	if (duration < 1000) /* less than 1 usec */
+	if (duration < NSEC_PER_USEC) /* less than 1 usec */
 		return text;
 
-	if (duration < 1000 * 1000) { /* less than 1 msec */
-		sprintf(text, "%.1f us", duration / 1000.0);
+	if (duration < NSEC_PER_MSEC) { /* less than 1 msec */
+		sprintf(text, "%.1f us", duration / (double)NSEC_PER_USEC);
 		return text;
 	}
-	sprintf(text, "%.1f ms", duration / 1000.0 / 1000);
+	sprintf(text, "%.1f ms", duration / (double)NSEC_PER_MSEC);
 
 	return text;
 }
@@ -297,7 +298,7 @@ void svg_waiting(int Yslot, int cpu, u64 start, u64 end, const char *backtrace)
 
 	style = "waiting";
 
-	if (end-start > 10 * 1000000) /* 10 msec */
+	if (end-start > 10 * NSEC_PER_MSEC) /* 10 msec */
 		style = "WAITING";
 
 	text = time_to_string(end-start);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 05/35] perf bench sched-pipe: Use linux/time64.h, USEC_PER_SEC
  2016-08-23 21:03 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (3 preceding siblings ...)
  2016-08-23 21:03 ` [PATCH 04/35] perf timechart: Use NSEC_PER_U?SEC Arnaldo Carvalho de Melo
@ 2016-08-23 21:03 ` Arnaldo Carvalho de Melo
  2016-08-23 21:03 ` [PATCH 06/35] perf stat: Use *SEC_PER_*SEC macros Arnaldo Carvalho de Melo
                   ` (30 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-08-23 21:03 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	David Ahern, Jiri Olsa, Namhyung Kim, Steven Rostedt, Wang Nan

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

Following kernel practices.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-wgfu1h1pnw8lc919o2tan58y@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/bench/sched-pipe.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/tools/perf/bench/sched-pipe.c b/tools/perf/bench/sched-pipe.c
index 1dc2d13cc272..2243f0150d76 100644
--- a/tools/perf/bench/sched-pipe.c
+++ b/tools/perf/bench/sched-pipe.c
@@ -25,6 +25,7 @@
 #include <sys/time.h>
 #include <sys/types.h>
 #include <sys/syscall.h>
+#include <linux/time64.h>
 
 #include <pthread.h>
 
@@ -153,24 +154,24 @@ int bench_sched_pipe(int argc, const char **argv, const char *prefix __maybe_unu
 		printf("# Executed %d pipe operations between two %s\n\n",
 			loops, threaded ? "threads" : "processes");
 
-		result_usec = diff.tv_sec * 1000000;
+		result_usec = diff.tv_sec * USEC_PER_SEC;
 		result_usec += diff.tv_usec;
 
 		printf(" %14s: %lu.%03lu [sec]\n\n", "Total time",
 		       diff.tv_sec,
-		       (unsigned long) (diff.tv_usec/1000));
+		       (unsigned long) (diff.tv_usec / USEC_PER_MSEC));
 
 		printf(" %14lf usecs/op\n",
 		       (double)result_usec / (double)loops);
 		printf(" %14d ops/sec\n",
 		       (int)((double)loops /
-			     ((double)result_usec / (double)1000000)));
+			     ((double)result_usec / (double)USEC_PER_SEC)));
 		break;
 
 	case BENCH_FORMAT_SIMPLE:
 		printf("%lu.%03lu\n",
 		       diff.tv_sec,
-		       (unsigned long) (diff.tv_usec / 1000));
+		       (unsigned long) (diff.tv_usec / USEC_PER_MSEC));
 		break;
 
 	default:
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 06/35] perf stat: Use *SEC_PER_*SEC macros
  2016-08-23 21:03 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (4 preceding siblings ...)
  2016-08-23 21:03 ` [PATCH 05/35] perf bench sched-pipe: Use linux/time64.h, USEC_PER_SEC Arnaldo Carvalho de Melo
@ 2016-08-23 21:03 ` Arnaldo Carvalho de Melo
  2016-08-23 21:03 ` [PATCH 07/35] perf bench mem: Use USEC_PER_SEC Arnaldo Carvalho de Melo
                   ` (29 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-08-23 21:03 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	David Ahern, Jiri Olsa, Namhyung Kim, Steven Rostedt, Wang Nan

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

To match how this is done in the kernel.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-gym6yshewpdegt153u8v2q5r@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-stat.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index e33a66bffbdb..90882b1d6a91 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -173,7 +173,7 @@ static inline void diff_timespec(struct timespec *r, struct timespec *a,
 {
 	r->tv_sec = a->tv_sec - b->tv_sec;
 	if (a->tv_nsec < b->tv_nsec) {
-		r->tv_nsec = a->tv_nsec + 1000000000L - b->tv_nsec;
+		r->tv_nsec = a->tv_nsec + NSEC_PER_SEC - b->tv_nsec;
 		r->tv_sec--;
 	} else {
 		r->tv_nsec = a->tv_nsec - b->tv_nsec ;
@@ -365,7 +365,7 @@ static void process_interval(void)
 static void enable_counters(void)
 {
 	if (initial_delay)
-		usleep(initial_delay * 1000);
+		usleep(initial_delay * USEC_PER_MSEC);
 
 	/*
 	 * We need to enable counters only if:
@@ -542,8 +542,8 @@ static int __run_perf_stat(int argc, const char **argv)
 	bool is_pipe = STAT_RECORD ? perf_stat.file.is_pipe : false;
 
 	if (interval) {
-		ts.tv_sec  = interval / 1000;
-		ts.tv_nsec = (interval % 1000) * 1000000;
+		ts.tv_sec  = interval / USEC_PER_MSEC;
+		ts.tv_nsec = (interval % USEC_PER_MSEC) * NSEC_PER_MSEC;
 	} else {
 		ts.tv_sec  = 1;
 		ts.tv_nsec = 0;
@@ -972,7 +972,7 @@ static void print_metric_header(void *ctx, const char *color __maybe_unused,
 static void nsec_printout(int id, int nr, struct perf_evsel *evsel, double avg)
 {
 	FILE *output = stat_config.output;
-	double msecs = avg / 1e6;
+	double msecs = avg / NSEC_PER_MSEC;
 	const char *fmt_v, *fmt_n;
 	char name[25];
 
@@ -1461,7 +1461,7 @@ static void print_footer(void)
 	if (!null_run)
 		fprintf(output, "\n");
 	fprintf(output, " %17.9f seconds time elapsed",
-			avg_stats(&walltime_nsecs_stats)/1e9);
+			avg_stats(&walltime_nsecs_stats) / NSEC_PER_SEC);
 	if (run_count > 1) {
 		fprintf(output, "                                        ");
 		print_noise_pct(stddev_stats(&walltime_nsecs_stats),
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 07/35] perf bench mem: Use USEC_PER_SEC
  2016-08-23 21:03 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (5 preceding siblings ...)
  2016-08-23 21:03 ` [PATCH 06/35] perf stat: Use *SEC_PER_*SEC macros Arnaldo Carvalho de Melo
@ 2016-08-23 21:03 ` Arnaldo Carvalho de Melo
  2016-08-23 21:03 ` [PATCH 08/35] perf bench sched-messaging: Use USEC_PER_MSEC Arnaldo Carvalho de Melo
                   ` (28 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-08-23 21:03 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	David Ahern, Jiri Olsa, Namhyung Kim, Steven Rostedt, Wang Nan

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

Following kernel practices, using linux/time64.h

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-xdtmguafva17wp023sxojiib@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/bench/mem-functions.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/perf/bench/mem-functions.c b/tools/perf/bench/mem-functions.c
index 2b54d0f2672a..c684910e5a48 100644
--- a/tools/perf/bench/mem-functions.c
+++ b/tools/perf/bench/mem-functions.c
@@ -21,6 +21,7 @@
 #include <string.h>
 #include <sys/time.h>
 #include <errno.h>
+#include <linux/time64.h>
 
 #define K 1024
 
@@ -89,7 +90,7 @@ static u64 get_cycles(void)
 
 static double timeval2double(struct timeval *ts)
 {
-	return (double)ts->tv_sec + (double)ts->tv_usec / (double)1000000;
+	return (double)ts->tv_sec + (double)ts->tv_usec / (double)USEC_PER_SEC;
 }
 
 #define print_bps(x) do {						\
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 08/35] perf bench sched-messaging: Use USEC_PER_MSEC
  2016-08-23 21:03 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (6 preceding siblings ...)
  2016-08-23 21:03 ` [PATCH 07/35] perf bench mem: Use USEC_PER_SEC Arnaldo Carvalho de Melo
@ 2016-08-23 21:03 ` Arnaldo Carvalho de Melo
  2016-08-23 21:03 ` [PATCH 09/35] perf record: " Arnaldo Carvalho de Melo
                   ` (27 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-08-23 21:03 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	David Ahern, Jiri Olsa, Namhyung Kim, Steven Rostedt, Wang Nan

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

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-xhyoyxejvorrgmwjx9k3j8k2@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/bench/sched-messaging.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/perf/bench/sched-messaging.c b/tools/perf/bench/sched-messaging.c
index bfaf9503de8e..6a111e775210 100644
--- a/tools/perf/bench/sched-messaging.c
+++ b/tools/perf/bench/sched-messaging.c
@@ -29,6 +29,7 @@
 #include <poll.h>
 #include <limits.h>
 #include <err.h>
+#include <linux/time64.h>
 
 #define DATASIZE 100
 
@@ -312,11 +313,11 @@ int bench_sched_messaging(int argc, const char **argv,
 		       thread_mode ? "threads" : "processes");
 		printf(" %14s: %lu.%03lu [sec]\n", "Total time",
 		       diff.tv_sec,
-		       (unsigned long) (diff.tv_usec/1000));
+		       (unsigned long) (diff.tv_usec / USEC_PER_MSEC));
 		break;
 	case BENCH_FORMAT_SIMPLE:
 		printf("%lu.%03lu\n", diff.tv_sec,
-		       (unsigned long) (diff.tv_usec/1000));
+		       (unsigned long) (diff.tv_usec / USEC_PER_MSEC));
 		break;
 	default:
 		/* reaching here is something disaster */
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 09/35] perf record: Use USEC_PER_MSEC
  2016-08-23 21:03 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (7 preceding siblings ...)
  2016-08-23 21:03 ` [PATCH 08/35] perf bench sched-messaging: Use USEC_PER_MSEC Arnaldo Carvalho de Melo
@ 2016-08-23 21:03 ` Arnaldo Carvalho de Melo
  2016-08-23 21:03 ` [PATCH 10/35] perf kvm: Use NSEC_PER_USEC Arnaldo Carvalho de Melo
                   ` (26 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-08-23 21:03 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	David Ahern, Jiri Olsa, Namhyung Kim, Steven Rostedt, Wang Nan

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

Instead of a naked 1000.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-7v6be7jhvstbkvk3rsytjw0o@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-record.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 6355902fbfc8..a3792e8c3e03 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -42,7 +42,7 @@
 #include <sched.h>
 #include <sys/mman.h>
 #include <asm/bug.h>
-
+#include <linux/time64.h>
 
 struct record {
 	struct perf_tool	tool;
@@ -954,7 +954,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
 	}
 
 	if (opts->initial_delay) {
-		usleep(opts->initial_delay * 1000);
+		usleep(opts->initial_delay * USEC_PER_MSEC);
 		perf_evlist__enable(rec->evlist);
 	}
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 10/35] perf kvm: Use NSEC_PER_USEC
  2016-08-23 21:03 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (8 preceding siblings ...)
  2016-08-23 21:03 ` [PATCH 09/35] perf record: " Arnaldo Carvalho de Melo
@ 2016-08-23 21:03 ` Arnaldo Carvalho de Melo
  2016-08-23 21:03 ` [PATCH 11/35] perf bench futex: " Arnaldo Carvalho de Melo
                   ` (25 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-08-23 21:03 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	Alexander Yarygin, David Ahern, Hemant Kumar, Jiri Olsa,
	Namhyung Kim, Steven Rostedt, Wang Nan

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

Following kernel practices and better documenting units of time.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Yarygin <yarygin@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-5x6p6fmzrogonpbnkkkw4usk@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-kvm.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index a0040f74e935..08fa88f62a24 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -363,7 +363,7 @@ static bool handle_end_event(struct perf_kvm_stat *kvm,
 		if (!skip_event(decode)) {
 			pr_info("%" PRIu64 " VM %d, vcpu %d: %s event took %" PRIu64 "usec\n",
 				 sample->time, sample->pid, vcpu_record->vcpu_id,
-				 decode, time_diff/1000);
+				 decode, time_diff / NSEC_PER_USEC);
 		}
 	}
 
@@ -609,15 +609,15 @@ static void print_result(struct perf_kvm_stat *kvm)
 		pr_info("%10llu ", (unsigned long long)ecount);
 		pr_info("%8.2f%% ", (double)ecount / kvm->total_count * 100);
 		pr_info("%8.2f%% ", (double)etime / kvm->total_time * 100);
-		pr_info("%9.2fus ", (double)min / 1e3);
-		pr_info("%9.2fus ", (double)max / 1e3);
-		pr_info("%9.2fus ( +-%7.2f%% )", (double)etime / ecount/1e3,
+		pr_info("%9.2fus ", (double)min / NSEC_PER_USEC);
+		pr_info("%9.2fus ", (double)max / NSEC_PER_USEC);
+		pr_info("%9.2fus ( +-%7.2f%% )", (double)etime / ecount / NSEC_PER_USEC,
 			kvm_event_rel_stddev(vcpu, event));
 		pr_info("\n");
 	}
 
 	pr_info("\nTotal Samples:%" PRIu64 ", Total events handled time:%.2fus.\n\n",
-		kvm->total_count, kvm->total_time / 1e3);
+		kvm->total_count, kvm->total_time / (double)NSEC_PER_USEC);
 
 	if (kvm->lost_events)
 		pr_info("\nLost events: %" PRIu64 "\n\n", kvm->lost_events);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 11/35] perf bench futex: Use NSEC_PER_USEC
  2016-08-23 21:03 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (9 preceding siblings ...)
  2016-08-23 21:03 ` [PATCH 10/35] perf kvm: Use NSEC_PER_USEC Arnaldo Carvalho de Melo
@ 2016-08-23 21:03 ` Arnaldo Carvalho de Melo
  2016-08-23 21:03 ` [PATCH 12/35] perf top: Use MSEC_PER_SEC Arnaldo Carvalho de Melo
                   ` (24 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-08-23 21:03 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	David Ahern, Jiri Olsa, Namhyung Kim, Steven Rostedt, Wang Nan

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

Following kernel practices and better documentin

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-xncwqxegjp13g2nxih3lp9mx@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/bench/futex-requeue.c       | 5 +++--
 tools/perf/bench/futex-wake-parallel.c | 5 +++--
 tools/perf/bench/futex-wake.c          | 5 +++--
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/tools/perf/bench/futex-requeue.c b/tools/perf/bench/futex-requeue.c
index f96e22ed9f87..2b9705a8734c 100644
--- a/tools/perf/bench/futex-requeue.c
+++ b/tools/perf/bench/futex-requeue.c
@@ -16,6 +16,7 @@
 #include <subcmd/parse-options.h>
 #include <linux/compiler.h>
 #include <linux/kernel.h>
+#include <linux/time64.h>
 #include <errno.h>
 #include "bench.h"
 #include "futex.h"
@@ -62,7 +63,7 @@ static void print_summary(void)
 	printf("Requeued %d of %d threads in %.4f ms (+-%.2f%%)\n",
 	       requeued_avg,
 	       nthreads,
-	       requeuetime_avg/1e3,
+	       requeuetime_avg / USEC_PER_MSEC,
 	       rel_stddev_stats(requeuetime_stddev, requeuetime_avg));
 }
 
@@ -184,7 +185,7 @@ int bench_futex_requeue(int argc, const char **argv,
 
 		if (!silent) {
 			printf("[Run %d]: Requeued %d of %d threads in %.4f ms\n",
-			       j + 1, nrequeued, nthreads, runtime.tv_usec/1e3);
+			       j + 1, nrequeued, nthreads, runtime.tv_usec / (double)USEC_PER_MSEC);
 		}
 
 		/* everybody should be blocked on futex2, wake'em up */
diff --git a/tools/perf/bench/futex-wake-parallel.c b/tools/perf/bench/futex-wake-parallel.c
index 4a2ecd7438ca..2c8fa67ad537 100644
--- a/tools/perf/bench/futex-wake-parallel.c
+++ b/tools/perf/bench/futex-wake-parallel.c
@@ -15,6 +15,7 @@
 #include <subcmd/parse-options.h>
 #include <linux/compiler.h>
 #include <linux/kernel.h>
+#include <linux/time64.h>
 #include <errno.h>
 #include "bench.h"
 #include "futex.h"
@@ -156,7 +157,7 @@ static void print_run(struct thread_data *waking_worker, unsigned int run_num)
 
 	printf("[Run %d]: Avg per-thread latency (waking %d/%d threads) "
 	       "in %.4f ms (+-%.2f%%)\n", run_num + 1, wakeup_avg,
-	       nblocked_threads, waketime_avg/1e3,
+	       nblocked_threads, waketime_avg / USEC_PER_MSEC,
 	       rel_stddev_stats(waketime_stddev, waketime_avg));
 }
 
@@ -172,7 +173,7 @@ static void print_summary(void)
 	printf("Avg per-thread latency (waking %d/%d threads) in %.4f ms (+-%.2f%%)\n",
 	       wakeup_avg,
 	       nblocked_threads,
-	       waketime_avg/1e3,
+	       waketime_avg / USEC_PER_MSEC,
 	       rel_stddev_stats(waketime_stddev, waketime_avg));
 }
 
diff --git a/tools/perf/bench/futex-wake.c b/tools/perf/bench/futex-wake.c
index 87d8f4f292d9..e246b1b8388a 100644
--- a/tools/perf/bench/futex-wake.c
+++ b/tools/perf/bench/futex-wake.c
@@ -16,6 +16,7 @@
 #include <subcmd/parse-options.h>
 #include <linux/compiler.h>
 #include <linux/kernel.h>
+#include <linux/time64.h>
 #include <errno.h>
 #include "bench.h"
 #include "futex.h"
@@ -81,7 +82,7 @@ static void print_summary(void)
 	printf("Wokeup %d of %d threads in %.4f ms (+-%.2f%%)\n",
 	       wakeup_avg,
 	       nthreads,
-	       waketime_avg/1e3,
+	       waketime_avg / USEC_PER_MSEC,
 	       rel_stddev_stats(waketime_stddev, waketime_avg));
 }
 
@@ -182,7 +183,7 @@ int bench_futex_wake(int argc, const char **argv,
 
 		if (!silent) {
 			printf("[Run %d]: Wokeup %d of %d threads in %.4f ms\n",
-			       j + 1, nwoken, nthreads, runtime.tv_usec/1e3);
+			       j + 1, nwoken, nthreads, runtime.tv_usec / (double)USEC_PER_MSEC);
 		}
 
 		for (i = 0; i < nthreads; i++) {
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 12/35] perf top: Use MSEC_PER_SEC
  2016-08-23 21:03 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (10 preceding siblings ...)
  2016-08-23 21:03 ` [PATCH 11/35] perf bench futex: " Arnaldo Carvalho de Melo
@ 2016-08-23 21:03 ` Arnaldo Carvalho de Melo
  2016-08-23 21:03 ` [PATCH 13/35] perf hists: Introduce nr_header_lines into struct perf_hpp_list Arnaldo Carvalho de Melo
                   ` (23 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-08-23 21:03 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	David Ahern, Jiri Olsa, Namhyung Kim, Steven Rostedt, Wang Nan

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

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-iof4j6mutyogdeie1sj98dhv@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-top.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 418ed94756d3..a3223aa22213 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -68,6 +68,7 @@
 #include <sys/mman.h>
 
 #include <linux/stringify.h>
+#include <linux/time64.h>
 #include <linux/types.h>
 
 static volatile int done;
@@ -624,7 +625,7 @@ static void *display_thread(void *arg)
 	display_setup_sig();
 	pthread__unblock_sigwinch();
 repeat:
-	delay_msecs = top->delay_secs * 1000;
+	delay_msecs = top->delay_secs * MSEC_PER_SEC;
 	set_term_quiet_input(&save);
 	/* trash return*/
 	getc(stdin);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 13/35] perf hists: Introduce nr_header_lines into struct perf_hpp_list
  2016-08-23 21:03 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (11 preceding siblings ...)
  2016-08-23 21:03 ` [PATCH 12/35] perf top: Use MSEC_PER_SEC Arnaldo Carvalho de Melo
@ 2016-08-23 21:03 ` Arnaldo Carvalho de Melo
  2016-08-23 21:03 ` [PATCH 14/35] perf hists: Add line argument into perf_hpp_fmt's header callback Arnaldo Carvalho de Melo
                   ` (22 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-08-23 21:03 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jiri Olsa, David Ahern, Namhyung Kim,
	Peter Zijlstra, Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@kernel.org>

Currently we support just single line headers, this is first step to
allow more.

Store the number of header lines in perf_hpp_list, which encompasses all
the display/sort entries and is thus suitable to hold this value.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1470583710-1649-2-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/ui/browsers/hists.c | 15 ++++++++++++---
 tools/perf/ui/hist.c           |  1 +
 tools/perf/util/hist.h         |  1 +
 3 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 13d414384739..95f7cf1991fc 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -69,8 +69,11 @@ static u32 hist_browser__nr_entries(struct hist_browser *hb)
 static void hist_browser__update_rows(struct hist_browser *hb)
 {
 	struct ui_browser *browser = &hb->b;
-	u16 header_offset = hb->show_headers ? 1 : 0, index_row;
+	struct hists *hists = hb->hists;
+	struct perf_hpp_list *hpp_list = hists->hpp_list;
+	u16 header_offset, index_row;
 
+	header_offset = hb->show_headers ? hpp_list->nr_header_lines : 0;
 	browser->rows = browser->height - header_offset;
 	/*
 	 * Verify if we were at the last line and that line isn't
@@ -99,8 +102,11 @@ static void hist_browser__refresh_dimensions(struct ui_browser *browser)
 
 static void hist_browser__gotorc(struct hist_browser *browser, int row, int column)
 {
-	u16 header_offset = browser->show_headers ? 1 : 0;
+	struct hists *hists = browser->hists;
+	struct perf_hpp_list *hpp_list = hists->hpp_list;
+	u16 header_offset;
 
+	header_offset = browser->show_headers ? hpp_list->nr_header_lines : 0;
 	ui_browser__gotorc(&browser->b, row + header_offset, column);
 }
 
@@ -1656,10 +1662,13 @@ static unsigned int hist_browser__refresh(struct ui_browser *browser)
 	u16 header_offset = 0;
 	struct rb_node *nd;
 	struct hist_browser *hb = container_of(browser, struct hist_browser, b);
+	struct hists *hists = hb->hists;
 
 	if (hb->show_headers) {
+		struct perf_hpp_list *hpp_list = hists->hpp_list;
+
 		hist_browser__show_headers(hb);
-		header_offset = 1;
+		header_offset = hpp_list->nr_header_lines;
 	}
 
 	ui_browser__hists_init_top(browser);
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index 4274969ddc89..be7a17fec889 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -441,6 +441,7 @@ struct perf_hpp_fmt perf_hpp__format[] = {
 struct perf_hpp_list perf_hpp_list = {
 	.fields	= LIST_HEAD_INIT(perf_hpp_list.fields),
 	.sorts	= LIST_HEAD_INIT(perf_hpp_list.sorts),
+	.nr_header_lines = 1,
 };
 
 #undef HPP__COLOR_PRINT_FNS
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 0a1edf1ab450..8cc5d33d2405 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -259,6 +259,7 @@ struct perf_hpp_list {
 	struct list_head fields;
 	struct list_head sorts;
 
+	int nr_header_lines;
 	int need_collapse;
 	int parent;
 	int sym;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 14/35] perf hists: Add line argument into perf_hpp_fmt's header callback
  2016-08-23 21:03 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (12 preceding siblings ...)
  2016-08-23 21:03 ` [PATCH 13/35] perf hists: Introduce nr_header_lines into struct perf_hpp_list Arnaldo Carvalho de Melo
@ 2016-08-23 21:03 ` Arnaldo Carvalho de Melo
  2016-08-23 21:03 ` [PATCH 15/35] perf tools tui: Display multiple header lines Arnaldo Carvalho de Melo
                   ` (21 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-08-23 21:03 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jiri Olsa, David Ahern, Namhyung Kim,
	Peter Zijlstra, Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@kernel.org>

Adding line argument into perf_hpp_fmt's header callback to be able to
request specific header line.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1470583710-1649-3-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-diff.c      | 3 ++-
 tools/perf/ui/browsers/hists.c | 6 +++---
 tools/perf/ui/gtk/hists.c      | 2 +-
 tools/perf/ui/hist.c           | 2 +-
 tools/perf/ui/stdio/hist.c     | 6 +++---
 tools/perf/util/hist.h         | 2 +-
 tools/perf/util/sort.c         | 5 +++--
 7 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index 21ee753211ad..75da965df343 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -1033,7 +1033,8 @@ static int hpp__entry_global(struct perf_hpp_fmt *_fmt, struct perf_hpp *hpp,
 }
 
 static int hpp__header(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
-		       struct hists *hists __maybe_unused)
+		       struct hists *hists __maybe_unused,
+		       int line __maybe_unused)
 {
 	struct diff_hpp_fmt *dfmt =
 		container_of(fmt, struct diff_hpp_fmt, fmt);
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 95f7cf1991fc..303ed62a8f53 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -1523,7 +1523,7 @@ static int hists_browser__scnprintf_headers(struct hist_browser *browser, char *
 		if (perf_hpp__should_skip(fmt, hists)  || column++ < browser->b.horiz_scroll)
 			continue;
 
-		ret = fmt->header(fmt, &dummy_hpp, hists);
+		ret = fmt->header(fmt, &dummy_hpp, hists, 0);
 		if (advance_hpp_check(&dummy_hpp, ret))
 			break;
 
@@ -1560,7 +1560,7 @@ static int hists_browser__scnprintf_hierarchy_headers(struct hist_browser *brows
 		if (column++ < browser->b.horiz_scroll)
 			continue;
 
-		ret = fmt->header(fmt, &dummy_hpp, hists);
+		ret = fmt->header(fmt, &dummy_hpp, hists, 0);
 		if (advance_hpp_check(&dummy_hpp, ret))
 			break;
 
@@ -1597,7 +1597,7 @@ static int hists_browser__scnprintf_hierarchy_headers(struct hist_browser *brows
 			}
 			first_col = false;
 
-			ret = fmt->header(fmt, &dummy_hpp, hists);
+			ret = fmt->header(fmt, &dummy_hpp, hists, 0);
 			dummy_hpp.buf[ret] = '\0';
 
 			start = trim(dummy_hpp.buf);
diff --git a/tools/perf/ui/gtk/hists.c b/tools/perf/ui/gtk/hists.c
index c5f3677f6679..79cb5c4d5e2e 100644
--- a/tools/perf/ui/gtk/hists.c
+++ b/tools/perf/ui/gtk/hists.c
@@ -549,7 +549,7 @@ static void perf_gtk__show_hierarchy(GtkWidget *window, struct hists *hists,
 				strcat(buf, "+");
 			first_col = false;
 
-			fmt->header(fmt, &hpp, hists);
+			fmt->header(fmt, &hpp, hists, 0);
 			strcat(buf, ltrim(rtrim(hpp.buf)));
 		}
 	}
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index be7a17fec889..30457c65980c 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -230,7 +230,7 @@ static int hpp__width_fn(struct perf_hpp_fmt *fmt,
 }
 
 static int hpp__header_fn(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
-			  struct hists *hists)
+			  struct hists *hists, int line __maybe_unused)
 {
 	int len = hpp__width_fn(fmt, hpp, hists);
 	return scnprintf(hpp->buf, hpp->size, "%*s", len, fmt->name);
diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
index f04a63112079..91b8e10cabd5 100644
--- a/tools/perf/ui/stdio/hist.c
+++ b/tools/perf/ui/stdio/hist.c
@@ -549,7 +549,7 @@ static int print_hierarchy_header(struct hists *hists, struct perf_hpp *hpp,
 				    struct perf_hpp_list_node, list);
 
 	perf_hpp_list__for_each_format(&fmt_node->hpp, fmt) {
-		fmt->header(fmt, hpp, hists);
+		fmt->header(fmt, hpp, hists, 0);
 		fprintf(fp, "%s%s", hpp->buf, sep ?: "  ");
 	}
 
@@ -569,7 +569,7 @@ static int print_hierarchy_header(struct hists *hists, struct perf_hpp *hpp,
 				header_width += fprintf(fp, "+");
 			first_col = false;
 
-			fmt->header(fmt, hpp, hists);
+			fmt->header(fmt, hpp, hists, 0);
 
 			header_width += fprintf(fp, "%s", trim(hpp->buf));
 		}
@@ -658,7 +658,7 @@ hists__fprintf_standard_headers(struct hists *hists,
 		else
 			first = false;
 
-		fmt->header(fmt, hpp, hists);
+		fmt->header(fmt, hpp, hists, 0);
 		fprintf(fp, "%s", hpp->buf);
 	}
 
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 8cc5d33d2405..71a44c1c44de 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -230,7 +230,7 @@ struct perf_hpp {
 struct perf_hpp_fmt {
 	const char *name;
 	int (*header)(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
-		      struct hists *hists);
+		      struct hists *hists, int line);
 	int (*width)(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
 		     struct hists *hists);
 	int (*color)(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 3d3cb8392c86..a556de751018 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -1492,7 +1492,7 @@ void perf_hpp__reset_sort_width(struct perf_hpp_fmt *fmt, struct hists *hists)
 }
 
 static int __sort__hpp_header(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
-			      struct hists *hists)
+			      struct hists *hists, int line __maybe_unused)
 {
 	struct hpp_sort_entry *hse;
 	size_t len = fmt->user_len;
@@ -1797,7 +1797,8 @@ static void update_dynamic_len(struct hpp_dynamic_entry *hde,
 }
 
 static int __sort__hde_header(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
-			      struct hists *hists __maybe_unused)
+			      struct hists *hists __maybe_unused,
+			      int line __maybe_unused)
 {
 	struct hpp_dynamic_entry *hde;
 	size_t len = fmt->user_len;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 15/35] perf tools tui: Display multiple header lines
  2016-08-23 21:03 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (13 preceding siblings ...)
  2016-08-23 21:03 ` [PATCH 14/35] perf hists: Add line argument into perf_hpp_fmt's header callback Arnaldo Carvalho de Melo
@ 2016-08-23 21:03 ` Arnaldo Carvalho de Melo
  2016-08-23 21:03 ` [PATCH 16/35] perf tools stdio: " Arnaldo Carvalho de Melo
                   ` (20 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-08-23 21:03 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jiri Olsa, David Ahern, Namhyung Kim,
	Peter Zijlstra, Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@kernel.org>

Display multiple header lines in TUI browser, if it's configured within
struct perf_hpp_list::nr_header_lines.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1470583710-1649-4-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/ui/browsers/hists.c | 25 +++++++++++++++++--------
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 303ed62a8f53..4a7aac8ed5ee 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -1502,7 +1502,9 @@ static int advance_hpp_check(struct perf_hpp *hpp, int inc)
 	return hpp->size <= 0;
 }
 
-static int hists_browser__scnprintf_headers(struct hist_browser *browser, char *buf, size_t size)
+static int
+hists_browser__scnprintf_headers(struct hist_browser *browser, char *buf,
+				 size_t size, int line)
 {
 	struct hists *hists = browser->hists;
 	struct perf_hpp dummy_hpp = {
@@ -1523,7 +1525,7 @@ static int hists_browser__scnprintf_headers(struct hist_browser *browser, char *
 		if (perf_hpp__should_skip(fmt, hists)  || column++ < browser->b.horiz_scroll)
 			continue;
 
-		ret = fmt->header(fmt, &dummy_hpp, hists, 0);
+		ret = fmt->header(fmt, &dummy_hpp, hists, line);
 		if (advance_hpp_check(&dummy_hpp, ret))
 			break;
 
@@ -1628,14 +1630,21 @@ static void hists_browser__hierarchy_headers(struct hist_browser *browser)
 
 static void hists_browser__headers(struct hist_browser *browser)
 {
-	char headers[1024];
+	struct hists *hists = browser->hists;
+	struct perf_hpp_list *hpp_list = hists->hpp_list;
 
-	hists_browser__scnprintf_headers(browser, headers,
-					 sizeof(headers));
+	int line;
 
-	ui_browser__gotorc(&browser->b, 0, 0);
-	ui_browser__set_color(&browser->b, HE_COLORSET_ROOT);
-	ui_browser__write_nstring(&browser->b, headers, browser->b.width + 1);
+	for (line = 0; line < hpp_list->nr_header_lines; line++) {
+		char headers[1024];
+
+		hists_browser__scnprintf_headers(browser, headers,
+						 sizeof(headers), line);
+
+		ui_browser__gotorc(&browser->b, line, 0);
+		ui_browser__set_color(&browser->b, HE_COLORSET_ROOT);
+		ui_browser__write_nstring(&browser->b, headers, browser->b.width + 1);
+	}
 }
 
 static void hist_browser__show_headers(struct hist_browser *browser)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 16/35] perf tools stdio: Display multiple header lines
  2016-08-23 21:03 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (14 preceding siblings ...)
  2016-08-23 21:03 ` [PATCH 15/35] perf tools tui: Display multiple header lines Arnaldo Carvalho de Melo
@ 2016-08-23 21:03 ` Arnaldo Carvalho de Melo
  2016-08-23 21:03 ` [PATCH 17/35] perf hists: Add support for header span Arnaldo Carvalho de Melo
                   ` (19 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-08-23 21:03 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jiri Olsa, David Ahern, Namhyung Kim,
	Peter Zijlstra, Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@kernel.org>

Display multiple header lines in stdio output , if it's configured
within struct perf_hpp_list::nr_header_lines.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1470583710-1649-5-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/ui/stdio/hist.c | 34 +++++++++++++++++++++++++---------
 1 file changed, 25 insertions(+), 9 deletions(-)

diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
index 91b8e10cabd5..9b807cbb56b1 100644
--- a/tools/perf/ui/stdio/hist.c
+++ b/tools/perf/ui/stdio/hist.c
@@ -639,13 +639,10 @@ hists__fprintf_hierarchy_headers(struct hists *hists,
 	return print_hierarchy_header(hists, hpp, symbol_conf.field_sep, fp);
 }
 
-static int
-hists__fprintf_standard_headers(struct hists *hists,
-				struct perf_hpp *hpp,
-				FILE *fp)
+static void fprintf_line(struct hists *hists, struct perf_hpp *hpp,
+			 int line, FILE *fp)
 {
 	struct perf_hpp_fmt *fmt;
-	unsigned int width;
 	const char *sep = symbol_conf.field_sep;
 	bool first = true;
 
@@ -658,14 +655,33 @@ hists__fprintf_standard_headers(struct hists *hists,
 		else
 			first = false;
 
-		fmt->header(fmt, hpp, hists, 0);
+		fmt->header(fmt, hpp, hists, line);
 		fprintf(fp, "%s", hpp->buf);
 	}
+}
 
-	fprintf(fp, "\n");
+static int
+hists__fprintf_standard_headers(struct hists *hists,
+				struct perf_hpp *hpp,
+				FILE *fp)
+{
+	struct perf_hpp_list *hpp_list = hists->hpp_list;
+	struct perf_hpp_fmt *fmt;
+	unsigned int width;
+	const char *sep = symbol_conf.field_sep;
+	bool first = true;
+	int line;
+
+	for (line = 0; line < hpp_list->nr_header_lines; line++) {
+		/* first # is displayed one level up */
+		if (line)
+			fprintf(fp, "# ");
+		fprintf_line(hists, hpp, line, fp);
+		fprintf(fp, "\n");
+	}
 
 	if (sep)
-		return 1;
+		return hpp_list->nr_header_lines;
 
 	first = true;
 
@@ -689,7 +705,7 @@ hists__fprintf_standard_headers(struct hists *hists,
 
 	fprintf(fp, "\n");
 	fprintf(fp, "#\n");
-	return 3;
+	return hpp_list->nr_header_lines + 2;
 }
 
 static int hists__fprintf_headers(struct hists *hists, FILE *fp)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 17/35] perf hists: Add support for header span
  2016-08-23 21:03 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (15 preceding siblings ...)
  2016-08-23 21:03 ` [PATCH 16/35] perf tools stdio: " Arnaldo Carvalho de Melo
@ 2016-08-23 21:03 ` Arnaldo Carvalho de Melo
  2016-08-23 21:03 ` [PATCH 18/35] perf disassemble: Move check for kallsyms + !kcore Arnaldo Carvalho de Melo
                   ` (18 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-08-23 21:03 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jiri Olsa, David Ahern, Namhyung Kim,
	Peter Zijlstra, Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@kernel.org>

Add span argument for header callback function.

The handling of this argument is completely in the hands of the
callback. The only thing the caller ensures is it's zeroed on the
beginning.

Omitting span skipping in hierarchy headers and gtk code.

The c2c code use this to span header lines based on the entries span
configuration.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1470583710-1649-6-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-diff.c      |  3 ++-
 tools/perf/ui/browsers/hists.c | 10 +++++++---
 tools/perf/ui/gtk/hists.c      |  2 +-
 tools/perf/ui/hist.c           |  3 ++-
 tools/perf/ui/stdio/hist.c     | 13 ++++++++-----
 tools/perf/util/hist.h         |  2 +-
 tools/perf/util/sort.c         |  6 ++++--
 7 files changed, 25 insertions(+), 14 deletions(-)

diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index 75da965df343..9ff0db4e2d0c 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -1034,7 +1034,8 @@ static int hpp__entry_global(struct perf_hpp_fmt *_fmt, struct perf_hpp *hpp,
 
 static int hpp__header(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
 		       struct hists *hists __maybe_unused,
-		       int line __maybe_unused)
+		       int line __maybe_unused,
+		       int *span __maybe_unused)
 {
 	struct diff_hpp_fmt *dfmt =
 		container_of(fmt, struct diff_hpp_fmt, fmt);
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 4a7aac8ed5ee..22e48a3ebe29 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -1514,6 +1514,7 @@ hists_browser__scnprintf_headers(struct hist_browser *browser, char *buf,
 	struct perf_hpp_fmt *fmt;
 	size_t ret = 0;
 	int column = 0;
+	int span = 0;
 
 	if (symbol_conf.use_callchain) {
 		ret = scnprintf(buf, size, "  ");
@@ -1525,10 +1526,13 @@ hists_browser__scnprintf_headers(struct hist_browser *browser, char *buf,
 		if (perf_hpp__should_skip(fmt, hists)  || column++ < browser->b.horiz_scroll)
 			continue;
 
-		ret = fmt->header(fmt, &dummy_hpp, hists, line);
+		ret = fmt->header(fmt, &dummy_hpp, hists, line, &span);
 		if (advance_hpp_check(&dummy_hpp, ret))
 			break;
 
+		if (span)
+			continue;
+
 		ret = scnprintf(dummy_hpp.buf, dummy_hpp.size, "  ");
 		if (advance_hpp_check(&dummy_hpp, ret))
 			break;
@@ -1562,7 +1566,7 @@ static int hists_browser__scnprintf_hierarchy_headers(struct hist_browser *brows
 		if (column++ < browser->b.horiz_scroll)
 			continue;
 
-		ret = fmt->header(fmt, &dummy_hpp, hists, 0);
+		ret = fmt->header(fmt, &dummy_hpp, hists, 0, NULL);
 		if (advance_hpp_check(&dummy_hpp, ret))
 			break;
 
@@ -1599,7 +1603,7 @@ static int hists_browser__scnprintf_hierarchy_headers(struct hist_browser *brows
 			}
 			first_col = false;
 
-			ret = fmt->header(fmt, &dummy_hpp, hists, 0);
+			ret = fmt->header(fmt, &dummy_hpp, hists, 0, NULL);
 			dummy_hpp.buf[ret] = '\0';
 
 			start = trim(dummy_hpp.buf);
diff --git a/tools/perf/ui/gtk/hists.c b/tools/perf/ui/gtk/hists.c
index 79cb5c4d5e2e..a4f02de7c1b5 100644
--- a/tools/perf/ui/gtk/hists.c
+++ b/tools/perf/ui/gtk/hists.c
@@ -549,7 +549,7 @@ static void perf_gtk__show_hierarchy(GtkWidget *window, struct hists *hists,
 				strcat(buf, "+");
 			first_col = false;
 
-			fmt->header(fmt, &hpp, hists, 0);
+			fmt->header(fmt, &hpp, hists, 0, NULL);
 			strcat(buf, ltrim(rtrim(hpp.buf)));
 		}
 	}
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index 30457c65980c..b47fafc8ee2a 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -230,7 +230,8 @@ static int hpp__width_fn(struct perf_hpp_fmt *fmt,
 }
 
 static int hpp__header_fn(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
-			  struct hists *hists, int line __maybe_unused)
+			  struct hists *hists, int line __maybe_unused,
+			  int *span __maybe_unused)
 {
 	int len = hpp__width_fn(fmt, hpp, hists);
 	return scnprintf(hpp->buf, hpp->size, "%*s", len, fmt->name);
diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
index 9b807cbb56b1..9b65f4a6b35a 100644
--- a/tools/perf/ui/stdio/hist.c
+++ b/tools/perf/ui/stdio/hist.c
@@ -549,7 +549,7 @@ static int print_hierarchy_header(struct hists *hists, struct perf_hpp *hpp,
 				    struct perf_hpp_list_node, list);
 
 	perf_hpp_list__for_each_format(&fmt_node->hpp, fmt) {
-		fmt->header(fmt, hpp, hists, 0);
+		fmt->header(fmt, hpp, hists, 0, NULL);
 		fprintf(fp, "%s%s", hpp->buf, sep ?: "  ");
 	}
 
@@ -569,7 +569,7 @@ static int print_hierarchy_header(struct hists *hists, struct perf_hpp *hpp,
 				header_width += fprintf(fp, "+");
 			first_col = false;
 
-			fmt->header(fmt, hpp, hists, 0);
+			fmt->header(fmt, hpp, hists, 0, NULL);
 
 			header_width += fprintf(fp, "%s", trim(hpp->buf));
 		}
@@ -645,18 +645,21 @@ static void fprintf_line(struct hists *hists, struct perf_hpp *hpp,
 	struct perf_hpp_fmt *fmt;
 	const char *sep = symbol_conf.field_sep;
 	bool first = true;
+	int span = 0;
 
 	hists__for_each_format(hists, fmt) {
 		if (perf_hpp__should_skip(fmt, hists))
 			continue;
 
-		if (!first)
+		if (!first && !span)
 			fprintf(fp, "%s", sep ?: "  ");
 		else
 			first = false;
 
-		fmt->header(fmt, hpp, hists, line);
-		fprintf(fp, "%s", hpp->buf);
+		fmt->header(fmt, hpp, hists, line, &span);
+
+		if (!span)
+			fprintf(fp, "%s", hpp->buf);
 	}
 }
 
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 71a44c1c44de..a002c93fe422 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -230,7 +230,7 @@ struct perf_hpp {
 struct perf_hpp_fmt {
 	const char *name;
 	int (*header)(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
-		      struct hists *hists, int line);
+		      struct hists *hists, int line, int *span);
 	int (*width)(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
 		     struct hists *hists);
 	int (*color)(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index a556de751018..5ae3d32a21d6 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -1492,7 +1492,8 @@ void perf_hpp__reset_sort_width(struct perf_hpp_fmt *fmt, struct hists *hists)
 }
 
 static int __sort__hpp_header(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
-			      struct hists *hists, int line __maybe_unused)
+			      struct hists *hists, int line __maybe_unused,
+			      int *span __maybe_unused)
 {
 	struct hpp_sort_entry *hse;
 	size_t len = fmt->user_len;
@@ -1798,7 +1799,8 @@ static void update_dynamic_len(struct hpp_dynamic_entry *hde,
 
 static int __sort__hde_header(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
 			      struct hists *hists __maybe_unused,
-			      int line __maybe_unused)
+			      int line __maybe_unused,
+			      int *span __maybe_unused)
 {
 	struct hpp_dynamic_entry *hde;
 	size_t len = fmt->user_len;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 18/35] perf disassemble: Move check for kallsyms + !kcore
  2016-08-23 21:03 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (16 preceding siblings ...)
  2016-08-23 21:03 ` [PATCH 17/35] perf hists: Add support for header span Arnaldo Carvalho de Melo
@ 2016-08-23 21:03 ` Arnaldo Carvalho de Melo
  2016-08-23 21:03 ` [PATCH 19/35] perf disassemble: Simplify logic for picking the filename to disassemble Arnaldo Carvalho de Melo
                   ` (17 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-08-23 21:03 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan

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

We don't need to do all that filename logic to then just have to test
something unrelated and bail out, move it to the start of the function.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-lk1v4srtsktonnyp6t1o0uhx@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/annotate.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 4024d309bb00..9882bc6ac566 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -1165,11 +1165,10 @@ int symbol__strerror_disassemble(struct symbol *sym __maybe_unused, struct map *
 int symbol__disassemble(struct symbol *sym, struct map *map, size_t privsize)
 {
 	struct dso *dso = map->dso;
-	char *filename = dso__build_id_filename(dso, NULL, 0);
+	char *filename;
 	bool free_filename = true;
 	char command[PATH_MAX * 2];
 	FILE *file;
-	int err = 0;
 	char symfs_filename[PATH_MAX];
 	struct kcore_extract kce;
 	bool delete_extract = false;
@@ -1177,7 +1176,13 @@ int symbol__disassemble(struct symbol *sym, struct map *map, size_t privsize)
 	int lineno = 0;
 	int nline;
 	pid_t pid;
+	int err = SYMBOL_ANNOTATE_ERRNO__NO_VMLINUX;
+
+	if (dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS &&
+	    !dso__is_kcore(dso))
+		goto out;
 
+	filename = dso__build_id_filename(dso, NULL, 0);
 	if (filename)
 		symbol__join_symfs(symfs_filename, filename);
 
@@ -1201,12 +1206,6 @@ fallback:
 		free_filename = false;
 	}
 
-	if (dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS &&
-	    !dso__is_kcore(dso)) {
-		err = SYMBOL_ANNOTATE_ERRNO__NO_VMLINUX;
-		goto out_free_filename;
-	}
-
 	pr_debug("%s: filename=%s, sym=%s, start=%#" PRIx64 ", end=%#" PRIx64 "\n", __func__,
 		 filename, sym->name, map->unmap_ip(map, sym->start),
 		 map->unmap_ip(map, sym->end));
@@ -1338,6 +1337,7 @@ out_free_filename:
 		kcore_extract__delete(&kce);
 	if (free_filename)
 		free(filename);
+out:
 	return err;
 
 out_close_stdout:
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 19/35] perf disassemble: Simplify logic for picking the filename to disassemble
  2016-08-23 21:03 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (17 preceding siblings ...)
  2016-08-23 21:03 ` [PATCH 18/35] perf disassemble: Move check for kallsyms + !kcore Arnaldo Carvalho de Melo
@ 2016-08-23 21:03 ` Arnaldo Carvalho de Melo
  2016-08-23 21:03 ` [PATCH 20/35] perf disassemble: Extract logic to find file to pass to objdump to a separate function Arnaldo Carvalho de Melo
                   ` (16 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-08-23 21:03 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan

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

Lots of changes to support kcore, compressed modules, build-id files
left us with some spaguetti code, simplify it a bit, more to come.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-h70p7x451li3f2fhs44vzmm8@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/annotate.c | 41 ++++++++++++++++-------------------------
 1 file changed, 16 insertions(+), 25 deletions(-)

diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 9882bc6ac566..8a9949399112 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -1166,7 +1166,6 @@ int symbol__disassemble(struct symbol *sym, struct map *map, size_t privsize)
 {
 	struct dso *dso = map->dso;
 	char *filename;
-	bool free_filename = true;
 	char command[PATH_MAX * 2];
 	FILE *file;
 	char symfs_filename[PATH_MAX];
@@ -1183,31 +1182,30 @@ int symbol__disassemble(struct symbol *sym, struct map *map, size_t privsize)
 		goto out;
 
 	filename = dso__build_id_filename(dso, NULL, 0);
-	if (filename)
+	if (filename) {
 		symbol__join_symfs(symfs_filename, filename);
-
-	if (filename == NULL) {
+		free(filename);
+	} else {
 		if (dso->has_build_id)
 			return ENOMEM;
 		goto fallback;
-	} else if (dso__is_kcore(dso) ||
-		   readlink(symfs_filename, command, sizeof(command)) < 0 ||
-		   strstr(command, DSO__NAME_KALLSYMS) ||
-		   access(symfs_filename, R_OK)) {
-		free(filename);
+	}
+
+	if (dso__is_kcore(dso) ||
+	    readlink(symfs_filename, command, sizeof(command)) < 0 ||
+	    strstr(command, DSO__NAME_KALLSYMS) ||
+	    access(symfs_filename, R_OK)) {
 fallback:
 		/*
 		 * If we don't have build-ids or the build-id file isn't in the
 		 * cache, or is just a kallsyms file, well, lets hope that this
 		 * DSO is the same as when 'perf record' ran.
 		 */
-		filename = (char *)dso->long_name;
-		symbol__join_symfs(symfs_filename, filename);
-		free_filename = false;
+		symbol__join_symfs(symfs_filename, dso->long_name);
 	}
 
 	pr_debug("%s: filename=%s, sym=%s, start=%#" PRIx64 ", end=%#" PRIx64 "\n", __func__,
-		 filename, sym->name, map->unmap_ip(map, sym->start),
+		 symfs_filename, sym->name, map->unmap_ip(map, sym->start),
 		 map->unmap_ip(map, sym->end));
 
 	pr_debug("annotating [%p] %30s : [%p] %30s\n",
@@ -1222,11 +1220,6 @@ fallback:
 			delete_extract = true;
 			strlcpy(symfs_filename, kce.extract_filename,
 				sizeof(symfs_filename));
-			if (free_filename) {
-				free(filename);
-				free_filename = false;
-			}
-			filename = symfs_filename;
 		}
 	} else if (dso__needs_decompress(dso)) {
 		char tmp[PATH_MAX];
@@ -1235,14 +1228,14 @@ fallback:
 		bool ret;
 
 		if (kmod_path__parse_ext(&m, symfs_filename))
-			goto out_free_filename;
+			goto out;
 
 		snprintf(tmp, PATH_MAX, "/tmp/perf-kmod-XXXXXX");
 
 		fd = mkstemp(tmp);
 		if (fd < 0) {
 			free(m.ext);
-			goto out_free_filename;
+			goto out;
 		}
 
 		ret = decompress_to_file(m.ext, symfs_filename, fd);
@@ -1254,7 +1247,7 @@ fallback:
 		close(fd);
 
 		if (!ret)
-			goto out_free_filename;
+			goto out;
 
 		strcpy(symfs_filename, tmp);
 	}
@@ -1270,7 +1263,7 @@ fallback:
 		 map__rip_2objdump(map, sym->end),
 		 symbol_conf.annotate_asm_raw ? "" : "--no-show-raw",
 		 symbol_conf.annotate_src ? "-S" : "",
-		 symfs_filename, filename);
+		 symfs_filename, symfs_filename);
 
 	pr_debug("Executing: %s\n", command);
 
@@ -1332,11 +1325,9 @@ out_remove_tmp:
 
 	if (dso__needs_decompress(dso))
 		unlink(symfs_filename);
-out_free_filename:
+
 	if (delete_extract)
 		kcore_extract__delete(&kce);
-	if (free_filename)
-		free(filename);
 out:
 	return err;
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 20/35] perf disassemble: Extract logic to find file to pass to objdump to a separate function
  2016-08-23 21:03 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (18 preceding siblings ...)
  2016-08-23 21:03 ` [PATCH 19/35] perf disassemble: Simplify logic for picking the filename to disassemble Arnaldo Carvalho de Melo
@ 2016-08-23 21:03 ` Arnaldo Carvalho de Melo
  2016-08-23 21:03 ` [PATCH 21/35] tools: Copy coresight-pmu.h header file needed by perf tools Arnaldo Carvalho de Melo
                   ` (15 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-08-23 21:03 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan

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

Disentangling this a bit further, more to come.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-7bjv2xazuyzs0xw01mlwosn5@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/annotate.c | 54 +++++++++++++++++++++++++++-------------------
 1 file changed, 32 insertions(+), 22 deletions(-)

diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 8a9949399112..25a9259a6a6e 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -1162,29 +1162,19 @@ int symbol__strerror_disassemble(struct symbol *sym __maybe_unused, struct map *
 	return 0;
 }
 
-int symbol__disassemble(struct symbol *sym, struct map *map, size_t privsize)
+static int dso__disassemble_filename(struct dso *dso, char *filename, size_t filename_size)
 {
-	struct dso *dso = map->dso;
-	char *filename;
-	char command[PATH_MAX * 2];
-	FILE *file;
-	char symfs_filename[PATH_MAX];
-	struct kcore_extract kce;
-	bool delete_extract = false;
-	int stdout_fd[2];
-	int lineno = 0;
-	int nline;
-	pid_t pid;
-	int err = SYMBOL_ANNOTATE_ERRNO__NO_VMLINUX;
+	char linkname[PATH_MAX];
+	char *build_id_filename;
 
 	if (dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS &&
 	    !dso__is_kcore(dso))
-		goto out;
+		return SYMBOL_ANNOTATE_ERRNO__NO_VMLINUX;
 
-	filename = dso__build_id_filename(dso, NULL, 0);
-	if (filename) {
-		symbol__join_symfs(symfs_filename, filename);
-		free(filename);
+	build_id_filename = dso__build_id_filename(dso, NULL, 0);
+	if (build_id_filename) {
+		__symbol__join_symfs(filename, filename_size, build_id_filename);
+		free(build_id_filename);
 	} else {
 		if (dso->has_build_id)
 			return ENOMEM;
@@ -1192,18 +1182,38 @@ int symbol__disassemble(struct symbol *sym, struct map *map, size_t privsize)
 	}
 
 	if (dso__is_kcore(dso) ||
-	    readlink(symfs_filename, command, sizeof(command)) < 0 ||
-	    strstr(command, DSO__NAME_KALLSYMS) ||
-	    access(symfs_filename, R_OK)) {
+	    readlink(filename, linkname, sizeof(linkname)) < 0 ||
+	    strstr(linkname, DSO__NAME_KALLSYMS) ||
+	    access(filename, R_OK)) {
 fallback:
 		/*
 		 * If we don't have build-ids or the build-id file isn't in the
 		 * cache, or is just a kallsyms file, well, lets hope that this
 		 * DSO is the same as when 'perf record' ran.
 		 */
-		symbol__join_symfs(symfs_filename, dso->long_name);
+		__symbol__join_symfs(filename, filename_size, dso->long_name);
 	}
 
+	return 0;
+}
+
+int symbol__disassemble(struct symbol *sym, struct map *map, size_t privsize)
+{
+	struct dso *dso = map->dso;
+	char command[PATH_MAX * 2];
+	FILE *file;
+	char symfs_filename[PATH_MAX];
+	struct kcore_extract kce;
+	bool delete_extract = false;
+	int stdout_fd[2];
+	int lineno = 0;
+	int nline;
+	pid_t pid;
+	int err = dso__disassemble_filename(dso, symfs_filename, sizeof(symfs_filename));
+
+	if (err)
+		return err;
+
 	pr_debug("%s: filename=%s, sym=%s, start=%#" PRIx64 ", end=%#" PRIx64 "\n", __func__,
 		 symfs_filename, sym->name, map->unmap_ip(map, sym->start),
 		 map->unmap_ip(map, sym->end));
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 21/35] tools: Copy coresight-pmu.h header file needed by perf tools
  2016-08-23 21:03 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (19 preceding siblings ...)
  2016-08-23 21:03 ` [PATCH 20/35] perf disassemble: Extract logic to find file to pass to objdump to a separate function Arnaldo Carvalho de Melo
@ 2016-08-23 21:03 ` Arnaldo Carvalho de Melo
  2016-08-23 21:03 ` [PATCH 22/35] perf report: Allow configuring the default sort order in ~/.perfconfig Arnaldo Carvalho de Melo
                   ` (14 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-08-23 21:03 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Mathieu Poirier, Jiri Olsa, Peter Zijlstra,
	Vince Weaver, Arnaldo Carvalho de Melo

From: Mathieu Poirier <mathieu.poirier@linaro.org>

Directly accessing kernel files is not allowed anymore.  As such making
file coresight-pmu.h accessible by the perf tools and complain if this
copy strays from the one found in the main kernel tree.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Vince Weaver <vince@deater.net>
Link: http://lkml.kernel.org/r/1470932464-726-2-git-send-email-mathieu.poirier@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/include/linux/coresight-pmu.h | 39 +++++++++++++++++++++++++++++++++++++
 tools/perf/MANIFEST                 |  1 +
 tools/perf/Makefile.perf            |  3 +++
 3 files changed, 43 insertions(+)
 create mode 100644 tools/include/linux/coresight-pmu.h

diff --git a/tools/include/linux/coresight-pmu.h b/tools/include/linux/coresight-pmu.h
new file mode 100644
index 000000000000..7d410260661b
--- /dev/null
+++ b/tools/include/linux/coresight-pmu.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright(C) 2015 Linaro Limited. All rights reserved.
+ * Author: Mathieu Poirier <mathieu.poirier@linaro.org>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _LINUX_CORESIGHT_PMU_H
+#define _LINUX_CORESIGHT_PMU_H
+
+#define CORESIGHT_ETM_PMU_NAME "cs_etm"
+#define CORESIGHT_ETM_PMU_SEED  0x10
+
+/* ETMv3.5/PTM's ETMCR config bit */
+#define ETM_OPT_CYCACC  12
+#define ETM_OPT_TS      28
+
+static inline int coresight_get_trace_id(int cpu)
+{
+	/*
+	 * A trace ID of value 0 is invalid, so let's start at some
+	 * random value that fits in 7 bits and go from there.  Since
+	 * the common convention is to have data trace IDs be I(N) + 1,
+	 * set instruction trace IDs as a function of the CPU number.
+	 */
+	return (CORESIGHT_ETM_PMU_SEED + (cpu * 2));
+}
+
+#endif
diff --git a/tools/perf/MANIFEST b/tools/perf/MANIFEST
index f23a5e72aaa5..ff200c6cb790 100644
--- a/tools/perf/MANIFEST
+++ b/tools/perf/MANIFEST
@@ -60,6 +60,7 @@ tools/include/asm-generic/bitops.h
 tools/include/linux/atomic.h
 tools/include/linux/bitops.h
 tools/include/linux/compiler.h
+tools/include/linux/coresight-pmu.h
 tools/include/linux/filter.h
 tools/include/linux/hash.h
 tools/include/linux/kernel.h
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 2d9087501633..aa7ab23fbc9f 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -429,6 +429,9 @@ $(PERF_IN): prepare FORCE
 	@(test -f ../../include/asm-generic/bitops/fls64.h && ( \
         (diff -B ../include/asm-generic/bitops/fls64.h ../../include/asm-generic/bitops/fls64.h >/dev/null) \
         || echo "Warning: tools/include/asm-generic/bitops/fls64.h differs from kernel" >&2 )) || true
+	@(test -f ../../include/linux/coresight-pmu.h && ( \
+	(diff -B ../include/linux/coresight-pmu.h ../../include/linux/coresight-pmu.h >/dev/null) \
+	|| echo "Warning: tools/include/linux/coresight-pmu.h differs from kernel" >&2 )) || true
 	$(Q)$(MAKE) $(build)=perf
 
 $(OUTPUT)perf: $(PERFLIBS) $(PERF_IN) $(LIBTRACEEVENT_DYNAMIC_LIST)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 22/35] perf report: Allow configuring the default sort order in ~/.perfconfig
  2016-08-23 21:03 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (20 preceding siblings ...)
  2016-08-23 21:03 ` [PATCH 21/35] tools: Copy coresight-pmu.h header file needed by perf tools Arnaldo Carvalho de Melo
@ 2016-08-23 21:03 ` Arnaldo Carvalho de Melo
  2016-08-23 21:03 ` [PATCH 23/35] perf tools: Use __weak definition from linux/compiler.h Arnaldo Carvalho de Melo
                   ` (13 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-08-23 21:03 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	David Ahern, Jiri Olsa, Linus Torvalds, Namhyung Kim, Wang Nan

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

Allows changing the default sort order from "comm,dso,symbol" to some
other default, for instance "sym,dso" may be more fitting for kernel
developers.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-pm1h5puxua8nsxksd68fjm8r@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Documentation/perf-config.txt | 4 ++++
 tools/perf/builtin-report.c              | 4 ++++
 tools/perf/util/sort.c                   | 2 +-
 tools/perf/util/sort.h                   | 2 +-
 4 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/tools/perf/Documentation/perf-config.txt b/tools/perf/Documentation/perf-config.txt
index 15949e2a7805..68c89190e79c 100644
--- a/tools/perf/Documentation/perf-config.txt
+++ b/tools/perf/Documentation/perf-config.txt
@@ -382,6 +382,10 @@ call-graph.*::
 		histogram entry. Default is 0 which means no limitation.
 
 report.*::
+	report.sort_order::
+		Allows changing the default sort order from "comm,dso,symbol" to
+		some other default, for instance "sym,dso" may be more fitting for
+		kernel developers.
 	report.percent-limit::
 		This one is mostly the same as call-graph.threshold but works for
 		histogram entries. Entries having an overhead lower than this
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 949e5a15c960..b9e046baa5fc 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -89,6 +89,10 @@ static int report__config(const char *var, const char *value, void *cb)
 		rep->queue_size = perf_config_u64(var, value);
 		return 0;
 	}
+	if (!strcmp(var, "report.sort_order")) {
+		default_sort_order = strdup(value);
+		return 0;
+	}
 
 	return 0;
 }
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 5ae3d32a21d6..1884d7f9b9d2 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -11,7 +11,7 @@
 regex_t		parent_regex;
 const char	default_parent_pattern[] = "^sys_|^do_page_fault";
 const char	*parent_pattern = default_parent_pattern;
-const char	default_sort_order[] = "comm,dso,symbol";
+const char	*default_sort_order = "comm,dso,symbol";
 const char	default_branch_sort_order[] = "comm,dso_from,symbol_from,symbol_to,cycles";
 const char	default_mem_sort_order[] = "local_weight,mem,sym,dso,symbol_daddr,dso_daddr,snoop,tlb,locked";
 const char	default_top_sort_order[] = "dso,symbol";
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index 7ca37ea17395..28c0524c8702 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -28,7 +28,7 @@ extern const char *sort_order;
 extern const char *field_order;
 extern const char default_parent_pattern[];
 extern const char *parent_pattern;
-extern const char default_sort_order[];
+extern const char *default_sort_order;
 extern regex_t ignore_callees_regex;
 extern int have_ignore_callees;
 extern enum sort_mode sort__mode;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 23/35] perf tools: Use __weak definition from linux/compiler.h
  2016-08-23 21:03 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (21 preceding siblings ...)
  2016-08-23 21:03 ` [PATCH 22/35] perf report: Allow configuring the default sort order in ~/.perfconfig Arnaldo Carvalho de Melo
@ 2016-08-23 21:03 ` Arnaldo Carvalho de Melo
  2016-08-23 21:03 ` [PATCH 24/35] perf tools: Skip running the feature tests for 'make install-doc' Arnaldo Carvalho de Melo
                   ` (12 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-08-23 21:03 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Rui Teng, Alexander Shishkin, Peter Zijlstra,
	Arnaldo Carvalho de Melo

From: Rui Teng <rui.teng@linux.vnet.ibm.com>

Replace __attribute__((weak)) with __weak definition

Signed-off-by: Rui Teng <rui.teng@linux.vnet.ibm.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1469671557-2256-2-git-send-email-rui.teng@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/header.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 8f0db4007282..85dd0db0a127 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -828,8 +828,7 @@ static int write_group_desc(int fd, struct perf_header *h __maybe_unused,
  * default get_cpuid(): nothing gets recorded
  * actual implementation must be in arch/$(ARCH)/util/header.c
  */
-int __attribute__ ((weak)) get_cpuid(char *buffer __maybe_unused,
-				     size_t sz __maybe_unused)
+int __weak get_cpuid(char *buffer __maybe_unused, size_t sz __maybe_unused)
 {
 	return -1;
 }
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 24/35] perf tools: Skip running the feature tests for 'make install-doc'
  2016-08-23 21:03 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (22 preceding siblings ...)
  2016-08-23 21:03 ` [PATCH 23/35] perf tools: Use __weak definition from linux/compiler.h Arnaldo Carvalho de Melo
@ 2016-08-23 21:03 ` Arnaldo Carvalho de Melo
  2016-08-23 21:03 ` [PATCH 25/35] perf hists browser: Remove superfluous null check on map Arnaldo Carvalho de Melo
                   ` (11 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-08-23 21:03 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Rui Teng, Alexander Shishkin, Peter Zijlstra,
	Arnaldo Carvalho de Melo

From: Rui Teng <rui.teng@linux.vnet.ibm.com>

It is a requirement from the perf TODO list[1]:

''The feature tests should be performed only when a file that needs those
  tests, or at least only when some .c or .h file will be rebuilt. An
  initial step would be for 'make install-doc' not to run the feature
  tests, there it is not needed at all.''

By adding 'install-doc' to the NON_CONFIG_TARGETS, it will skip running
the feature tests for such target. The Auto-detecting system features
list will not be displayed:

  $ make install-doc
    BUILD:   Doing 'make -j2' parallel build
    SUBDIR   Documentation
  make[2]: Nothing to be done for 'install'.

[1] https://perf.wiki.kernel.org/index.php/Todo

Signed-off-by: Rui Teng <rui.teng@linux.vnet.ibm.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1470818948-17784-1-git-send-email-rui.teng@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Makefile.perf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index aa7ab23fbc9f..828cfd766e31 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -165,7 +165,7 @@ SUBCMD_DIR	= $(srctree)/tools/lib/subcmd/
 # non-config cases
 config := 1
 
-NON_CONFIG_TARGETS := clean TAGS tags cscope help
+NON_CONFIG_TARGETS := clean TAGS tags cscope help install-doc
 
 ifdef MAKECMDGOALS
 ifeq ($(filter-out $(NON_CONFIG_TARGETS),$(MAKECMDGOALS)),)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 25/35] perf hists browser: Remove superfluous null check on map
  2016-08-23 21:03 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (23 preceding siblings ...)
  2016-08-23 21:03 ` [PATCH 24/35] perf tools: Skip running the feature tests for 'make install-doc' Arnaldo Carvalho de Melo
@ 2016-08-23 21:03 ` Arnaldo Carvalho de Melo
  2016-08-23 21:03 ` [PATCH 26/35] ftrace: kprobe: uprobe: Add x8/x16/x32/x64 for hexadecimal types Arnaldo Carvalho de Melo
                   ` (10 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-08-23 21:03 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Colin Ian King, Alexander Shishkin, Jiri Olsa,
	Pekka Enberg, Peter Zijlstra, Wang Nan, Arnaldo Carvalho de Melo

From: Colin Ian King <colin.king@canonical.com>

'map' is being already checked if it is NULL at the start of
do_zoom_dso(), so the second subsequent check is superfluous and can be
removed.

Signed-off-by: Colin King <colin.king@canonical.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1471278343-14999-1-git-send-email-colin.king@canonical.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/ui/browsers/hists.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 22e48a3ebe29..f0611c937d4b 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -2440,8 +2440,6 @@ do_zoom_dso(struct hist_browser *browser, struct popup_action *act)
 		browser->hists->dso_filter = NULL;
 		ui_helpline__pop();
 	} else {
-		if (map == NULL)
-			return 0;
 		ui_helpline__fpush("To zoom out press ESC or ENTER + \"Zoom out of %s DSO\"",
 				   __map__is_kernel(map) ? "the Kernel" : map->dso->short_name);
 		browser->hists->dso_filter = map->dso;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 26/35] ftrace: kprobe: uprobe: Add x8/x16/x32/x64 for hexadecimal types
  2016-08-23 21:03 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (24 preceding siblings ...)
  2016-08-23 21:03 ` [PATCH 25/35] perf hists browser: Remove superfluous null check on map Arnaldo Carvalho de Melo
@ 2016-08-23 21:03 ` Arnaldo Carvalho de Melo
  2016-08-23 21:03 ` [PATCH 27/35] ftrace: probe: Add README entries for k/uprobe-events Arnaldo Carvalho de Melo
                   ` (9 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-08-23 21:03 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Masami Hiramatsu, Alexander Shishkin, Hemant Kumar,
	Naohiro Aota, Peter Zijlstra, Wang Nan, Arnaldo Carvalho de Melo

From: Masami Hiramatsu <mhiramat@kernel.org>

Add x8/x16/x32/x64 for hexadecimal type casting to kprobe/uprobe event
tracer.

These type casts can be used for integer arguments for explicitly
showing them in hexadecimal digits in formatted text.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
Cc: Naohiro Aota <naohiro.aota@hgst.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/147151067029.12957.11591314629326414783.stgit@devbox
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 Documentation/trace/kprobetrace.txt     |  4 ++--
 Documentation/trace/uprobetracer.txt    |  4 ++--
 kernel/trace/trace_kprobe.c             |  4 ++++
 kernel/trace/trace_probe.c              | 30 +++++++++++++++++-------------
 kernel/trace/trace_probe.h              |  9 +++++++++
 kernel/trace/trace_uprobe.c             |  4 ++++
 tools/perf/Documentation/perf-probe.txt |  4 ++--
 7 files changed, 40 insertions(+), 19 deletions(-)

diff --git a/Documentation/trace/kprobetrace.txt b/Documentation/trace/kprobetrace.txt
index ea52ec1f8484..9109c8e8a5a1 100644
--- a/Documentation/trace/kprobetrace.txt
+++ b/Documentation/trace/kprobetrace.txt
@@ -44,8 +44,8 @@ Synopsis of kprobe_events
   +|-offs(FETCHARG) : Fetch memory at FETCHARG +|- offs address.(**)
   NAME=FETCHARG : Set NAME as the argument name of FETCHARG.
   FETCHARG:TYPE : Set TYPE as the type of FETCHARG. Currently, basic types
-		  (u8/u16/u32/u64/s8/s16/s32/s64), "string" and bitfield
-		  are supported.
+		  (u8/u16/u32/u64/s8/s16/s32/s64), hexadecimal types
+		  (x8/x16/x32/x64), "string" and bitfield are supported.
 
   (*) only for return probe.
   (**) this is useful for fetching a field of data structures.
diff --git a/Documentation/trace/uprobetracer.txt b/Documentation/trace/uprobetracer.txt
index 72d1cd4f7bf3..7e6d28c54b75 100644
--- a/Documentation/trace/uprobetracer.txt
+++ b/Documentation/trace/uprobetracer.txt
@@ -40,8 +40,8 @@ Synopsis of uprobe_tracer
    +|-offs(FETCHARG) : Fetch memory at FETCHARG +|- offs address.(**)
    NAME=FETCHARG     : Set NAME as the argument name of FETCHARG.
    FETCHARG:TYPE     : Set TYPE as the type of FETCHARG. Currently, basic types
-		       (u8/u16/u32/u64/s8/s16/s32/s64), "string" and bitfield
-		       are supported.
+		       (u8/u16/u32/u64/s8/s16/s32/s64), hexadecimal types
+		       (x8/x16/x32/x64), "string" and bitfield are supported.
 
   (*) only for return probe.
   (**) this is useful for fetching a field of data structures.
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index 9aedb0b06683..eb6c9f1d3a93 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -253,6 +253,10 @@ static const struct fetch_type kprobes_fetch_type_table[] = {
 	ASSIGN_FETCH_TYPE(s16, u16, 1),
 	ASSIGN_FETCH_TYPE(s32, u32, 1),
 	ASSIGN_FETCH_TYPE(s64, u64, 1),
+	ASSIGN_FETCH_TYPE_ALIAS(x8,  u8,  u8,  0),
+	ASSIGN_FETCH_TYPE_ALIAS(x16, u16, u16, 0),
+	ASSIGN_FETCH_TYPE_ALIAS(x32, u32, u32, 0),
+	ASSIGN_FETCH_TYPE_ALIAS(x64, u64, u64, 0),
 
 	ASSIGN_FETCH_TYPE_END
 };
diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
index 74e80a582c28..725af9dcbdff 100644
--- a/kernel/trace/trace_probe.c
+++ b/kernel/trace/trace_probe.c
@@ -36,24 +36,28 @@ const char *reserved_field_names[] = {
 };
 
 /* Printing  in basic type function template */
-#define DEFINE_BASIC_PRINT_TYPE_FUNC(type, fmt)				\
-int PRINT_TYPE_FUNC_NAME(type)(struct trace_seq *s, const char *name,	\
+#define DEFINE_BASIC_PRINT_TYPE_FUNC(tname, type, fmt)			\
+int PRINT_TYPE_FUNC_NAME(tname)(struct trace_seq *s, const char *name,	\
 				void *data, void *ent)			\
 {									\
 	trace_seq_printf(s, " %s=" fmt, name, *(type *)data);		\
 	return !trace_seq_has_overflowed(s);				\
 }									\
-const char PRINT_TYPE_FMT_NAME(type)[] = fmt;				\
-NOKPROBE_SYMBOL(PRINT_TYPE_FUNC_NAME(type));
-
-DEFINE_BASIC_PRINT_TYPE_FUNC(u8 , "0x%x")
-DEFINE_BASIC_PRINT_TYPE_FUNC(u16, "0x%x")
-DEFINE_BASIC_PRINT_TYPE_FUNC(u32, "0x%x")
-DEFINE_BASIC_PRINT_TYPE_FUNC(u64, "0x%Lx")
-DEFINE_BASIC_PRINT_TYPE_FUNC(s8,  "%d")
-DEFINE_BASIC_PRINT_TYPE_FUNC(s16, "%d")
-DEFINE_BASIC_PRINT_TYPE_FUNC(s32, "%d")
-DEFINE_BASIC_PRINT_TYPE_FUNC(s64, "%Ld")
+const char PRINT_TYPE_FMT_NAME(tname)[] = fmt;				\
+NOKPROBE_SYMBOL(PRINT_TYPE_FUNC_NAME(tname));
+
+DEFINE_BASIC_PRINT_TYPE_FUNC(u8,  u8,  "0x%x")
+DEFINE_BASIC_PRINT_TYPE_FUNC(u16, u16, "0x%x")
+DEFINE_BASIC_PRINT_TYPE_FUNC(u32, u32, "0x%x")
+DEFINE_BASIC_PRINT_TYPE_FUNC(u64, u64, "0x%Lx")
+DEFINE_BASIC_PRINT_TYPE_FUNC(s8,  s8,  "%d")
+DEFINE_BASIC_PRINT_TYPE_FUNC(s16, s16, "%d")
+DEFINE_BASIC_PRINT_TYPE_FUNC(s32, s32, "%d")
+DEFINE_BASIC_PRINT_TYPE_FUNC(s64, s64, "%Ld")
+DEFINE_BASIC_PRINT_TYPE_FUNC(x8,  u8,  "0x%x")
+DEFINE_BASIC_PRINT_TYPE_FUNC(x16, u16, "0x%x")
+DEFINE_BASIC_PRINT_TYPE_FUNC(x32, u32, "0x%x")
+DEFINE_BASIC_PRINT_TYPE_FUNC(x64, u64, "0x%Lx")
 
 /* Print type function for string type */
 int PRINT_TYPE_FUNC_NAME(string)(struct trace_seq *s, const char *name,
diff --git a/kernel/trace/trace_probe.h b/kernel/trace/trace_probe.h
index 45400ca5ded1..f0c470a10edd 100644
--- a/kernel/trace/trace_probe.h
+++ b/kernel/trace/trace_probe.h
@@ -149,6 +149,11 @@ DECLARE_BASIC_PRINT_TYPE_FUNC(s8);
 DECLARE_BASIC_PRINT_TYPE_FUNC(s16);
 DECLARE_BASIC_PRINT_TYPE_FUNC(s32);
 DECLARE_BASIC_PRINT_TYPE_FUNC(s64);
+DECLARE_BASIC_PRINT_TYPE_FUNC(x8);
+DECLARE_BASIC_PRINT_TYPE_FUNC(x16);
+DECLARE_BASIC_PRINT_TYPE_FUNC(x32);
+DECLARE_BASIC_PRINT_TYPE_FUNC(x64);
+
 DECLARE_BASIC_PRINT_TYPE_FUNC(string);
 
 #define FETCH_FUNC_NAME(method, type)	fetch_##method##_##type
@@ -234,6 +239,10 @@ ASSIGN_FETCH_FUNC(file_offset, ftype),			\
 #define ASSIGN_FETCH_TYPE(ptype, ftype, sign)			\
 	__ASSIGN_FETCH_TYPE(#ptype, ptype, ftype, sizeof(ftype), sign, #ptype)
 
+/* If ptype is an alias of atype, use this macro (show atype in format) */
+#define ASSIGN_FETCH_TYPE_ALIAS(ptype, atype, ftype, sign)		\
+	__ASSIGN_FETCH_TYPE(#ptype, ptype, ftype, sizeof(ftype), sign, #atype)
+
 #define ASSIGN_FETCH_TYPE_END {}
 
 #define FETCH_TYPE_STRING	0
diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
index c53485441c88..7a687320f867 100644
--- a/kernel/trace/trace_uprobe.c
+++ b/kernel/trace/trace_uprobe.c
@@ -211,6 +211,10 @@ static const struct fetch_type uprobes_fetch_type_table[] = {
 	ASSIGN_FETCH_TYPE(s16, u16, 1),
 	ASSIGN_FETCH_TYPE(s32, u32, 1),
 	ASSIGN_FETCH_TYPE(s64, u64, 1),
+	ASSIGN_FETCH_TYPE_ALIAS(x8,  u8,  u8,  0),
+	ASSIGN_FETCH_TYPE_ALIAS(x16, u16, u16, 0),
+	ASSIGN_FETCH_TYPE_ALIAS(x32, u32, u32, 0),
+	ASSIGN_FETCH_TYPE_ALIAS(x64, u64, u64, 0),
 
 	ASSIGN_FETCH_TYPE_END
 };
diff --git a/tools/perf/Documentation/perf-probe.txt b/tools/perf/Documentation/perf-probe.txt
index b303bcdd8ed1..aa333258b1b7 100644
--- a/tools/perf/Documentation/perf-probe.txt
+++ b/tools/perf/Documentation/perf-probe.txt
@@ -176,13 +176,13 @@ Each probe argument follows below syntax.
 
 'NAME' specifies the name of this argument (optional). You can use the name of local variable, local data structure member (e.g. var->field, var.field2), local array with fixed index (e.g. array[1], var->array[0], var->pointer[2]), or kprobe-tracer argument format (e.g. $retval, %ax, etc). Note that the name of this argument will be set as the last member name if you specify a local data structure member (e.g. field2 for 'var->field1.field2'.)
 '$vars' and '$params' special arguments are also available for NAME, '$vars' is expanded to the local variables (including function parameters) which can access at given probe point. '$params' is expanded to only the function parameters.
-'TYPE' casts the type of this argument (optional). If omitted, perf probe automatically set the type based on debuginfo. Currently, basic types (u8/u16/u32/u64/s8/s16/s32/s64), signedness casting (u/s), "string" and bitfield are supported. (see TYPES for detail)
+'TYPE' casts the type of this argument (optional). If omitted, perf probe automatically set the type based on debuginfo. Currently, basic types (u8/u16/u32/u64/s8/s16/s32/s64), hexadecimal integers (x8/x16/x32/x64), signedness casting (u/s), "string" and bitfield are supported. (see TYPES for detail)
 
 On x86 systems %REG is always the short form of the register: for example %AX. %RAX or %EAX is not valid.
 
 TYPES
 -----
-Basic types (u8/u16/u32/u64/s8/s16/s32/s64) are integer types. Prefix 's' and 'u' means those types are signed and unsigned respectively. Traced arguments are shown in decimal (signed) or hex (unsigned). You can also use 's' or 'u' to specify only signedness and leave its size auto-detected by perf probe.
+Basic types (u8/u16/u32/u64/s8/s16/s32/s64) and hexadecimal integers (x8/x16/x32/x64) are integer types. Prefix 's' and 'u' means those types are signed and unsigned respectively, and 'x' means that is shown in hexadecimal format. Traced arguments are shown in decimal (signed) or hex (unsigned). You can also use 's' or 'u' to specify only signedness and leave its size auto-detected by perf probe.
 String type is a special type, which fetches a "null-terminated" string from kernel space. This means it will fail and store NULL if the string container has been paged out. You can specify 'string' type only for the local variable or structure member which is an array of or a pointer to 'char' or 'unsigned char' type.
 Bitfield is another special type, which takes 3 parameters, bit-width, bit-offset, and container-size (usually 32). The syntax is;
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 27/35] ftrace: probe: Add README entries for k/uprobe-events
  2016-08-23 21:03 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (25 preceding siblings ...)
  2016-08-23 21:03 ` [PATCH 26/35] ftrace: kprobe: uprobe: Add x8/x16/x32/x64 for hexadecimal types Arnaldo Carvalho de Melo
@ 2016-08-23 21:03 ` Arnaldo Carvalho de Melo
  2016-08-23 21:03 ` [PATCH 28/35] perf probe: Add supported for type casting by the running kernel Arnaldo Carvalho de Melo
                   ` (8 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-08-23 21:03 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Masami Hiramatsu, Alexander Shishkin, Hemant Kumar,
	Naohiro Aota, Peter Zijlstra, Wang Nan, Arnaldo Carvalho de Melo

From: Masami Hiramatsu <mhiramat@kernel.org>

Add README entries for kprobe-events and uprobe-events.
This allows user to check what options can be acceptable
for running kernel.
E.g. perf tools can choose correct types for the kernel.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
Cc: Naohiro Aota <naohiro.aota@hgst.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/147151069524.12957.12957179170304055028.stgit@devbox
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 kernel/trace/trace.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index dade4c9559cc..1e2ce3b52e51 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -4123,6 +4123,30 @@ static const char readme_msg[] =
 	"\t\t\t  traces\n"
 #endif
 #endif /* CONFIG_STACK_TRACER */
+#ifdef CONFIG_KPROBE_EVENT
+	"  kprobe_events\t\t- Add/remove/show the kernel dynamic events\n"
+	"\t\t\t  Write into this file to define/undefine new trace events.\n"
+#endif
+#ifdef CONFIG_UPROBE_EVENT
+	"  uprobe_events\t\t- Add/remove/show the userspace dynamic events\n"
+	"\t\t\t  Write into this file to define/undefine new trace events.\n"
+#endif
+#if defined(CONFIG_KPROBE_EVENT) || defined(CONFIG_UPROBE_EVENT)
+	"\t  accepts: event-definitions (one definition per line)\n"
+	"\t   Format: p|r[:[<group>/]<event>] <place> [<args>]\n"
+	"\t           -:[<group>/]<event>\n"
+#ifdef CONFIG_KPROBE_EVENT
+	"\t    place: [<module>:]<symbol>[+<offset>]|<memaddr>\n"
+#endif
+#ifdef CONFIG_UPROBE_EVENT
+	"\t    place: <path>:<offset>\n"
+#endif
+	"\t     args: <name>=fetcharg[:type]\n"
+	"\t fetcharg: %<register>, @<address>, @<symbol>[+|-<offset>],\n"
+	"\t           $stack<index>, $stack, $retval, $comm\n"
+	"\t     type: s8/16/32/64, u8/16/32/64, x8/16/32/64, string,\n"
+	"\t           b<bit-width>@<bit-offset>/<container-size>\n"
+#endif
 	"  events/\t\t- Directory containing all trace event subsystems:\n"
 	"      enable\t\t- Write 0/1 to enable/disable tracing of all events\n"
 	"  events/<system>/\t- Directory containing all trace events for <system>:\n"
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 28/35] perf probe: Add supported for type casting by the running kernel
  2016-08-23 21:03 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (26 preceding siblings ...)
  2016-08-23 21:03 ` [PATCH 27/35] ftrace: probe: Add README entries for k/uprobe-events Arnaldo Carvalho de Melo
@ 2016-08-23 21:03 ` Arnaldo Carvalho de Melo
  2016-08-23 21:03 ` [PATCH 29/35] perf probe: Support hexadecimal casting Arnaldo Carvalho de Melo
                   ` (7 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-08-23 21:03 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Masami Hiramatsu, Alexander Shishkin, Hemant Kumar,
	Naohiro Aota, Peter Zijlstra, Steven Rostedt, Wang Nan,
	Arnaldo Carvalho de Melo

From: Masami Hiramatsu <mhiramat@kernel.org>

Add a checking routine what types are supported by the running kernel by
finding the pattern in <debugfs>/tracing/README.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
Cc: Naohiro Aota <naohiro.aota@hgst.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/147151071172.12957.3340095690753291085.stgit@devbox
[ 'enum probe_type' has no negative entries, so ends up as 'unsigned', remove '< 0'
   test to fix the build on at least centos:5, debian:7 & ubuntu:12.04.5 ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/probe-file.c   | 57 ++++++++++++++++++++++++++++++++++++++++++
 tools/perf/util/probe-file.h   | 10 ++++++++
 tools/perf/util/probe-finder.c |  1 +
 3 files changed, 68 insertions(+)

diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c
index 9c3b9ed5b3c3..697ef66bff91 100644
--- a/tools/perf/util/probe-file.c
+++ b/tools/perf/util/probe-file.c
@@ -877,3 +877,60 @@ int probe_cache__show_all_caches(struct strfilter *filter)
 
 	return 0;
 }
+
+static struct {
+	const char *pattern;
+	bool	avail;
+	bool	checked;
+} probe_type_table[] = {
+#define DEFINE_TYPE(idx, pat, def_avail)	\
+	[idx] = {.pattern = pat, .avail = (def_avail)}
+	DEFINE_TYPE(PROBE_TYPE_U, "* u8/16/32/64,*", true),
+	DEFINE_TYPE(PROBE_TYPE_S, "* s8/16/32/64,*", true),
+	DEFINE_TYPE(PROBE_TYPE_X, "* x8/16/32/64,*", false),
+	DEFINE_TYPE(PROBE_TYPE_STRING, "* string,*", true),
+	DEFINE_TYPE(PROBE_TYPE_BITFIELD,
+		    "* b<bit-width>@<bit-offset>/<container-size>", true),
+};
+
+bool probe_type_is_available(enum probe_type type)
+{
+	FILE *fp;
+	char *buf = NULL;
+	size_t len = 0;
+	bool target_line = false;
+	bool ret = probe_type_table[type].avail;
+
+	if (type >= PROBE_TYPE_END)
+		return false;
+	/* We don't have to check the type which supported by default */
+	if (ret || probe_type_table[type].checked)
+		return ret;
+
+	if (asprintf(&buf, "%s/README", tracing_path) < 0)
+		return ret;
+
+	fp = fopen(buf, "r");
+	if (!fp)
+		goto end;
+
+	zfree(&buf);
+	while (getline(&buf, &len, fp) > 0 && !ret) {
+		if (!target_line) {
+			target_line = !!strstr(buf, " type: ");
+			if (!target_line)
+				continue;
+		} else if (strstr(buf, "\t          ") != buf)
+			break;
+		ret = strglobmatch(buf, probe_type_table[type].pattern);
+	}
+	/* Cache the result */
+	probe_type_table[type].checked = true;
+	probe_type_table[type].avail = ret;
+
+	fclose(fp);
+end:
+	free(buf);
+
+	return ret;
+}
diff --git a/tools/perf/util/probe-file.h b/tools/perf/util/probe-file.h
index 9577b5c0b487..eba44c3e9dca 100644
--- a/tools/perf/util/probe-file.h
+++ b/tools/perf/util/probe-file.h
@@ -19,6 +19,15 @@ struct probe_cache {
 	struct list_head entries;
 };
 
+enum probe_type {
+	PROBE_TYPE_U = 0,
+	PROBE_TYPE_S,
+	PROBE_TYPE_X,
+	PROBE_TYPE_STRING,
+	PROBE_TYPE_BITFIELD,
+	PROBE_TYPE_END,
+};
+
 #define PF_FL_UPROBE	1
 #define PF_FL_RW	2
 #define for_each_probe_cache_entry(entry, pcache) \
@@ -54,6 +63,7 @@ struct probe_cache_entry *probe_cache__find(struct probe_cache *pcache,
 struct probe_cache_entry *probe_cache__find_by_name(struct probe_cache *pcache,
 					const char *group, const char *event);
 int probe_cache__show_all_caches(struct strfilter *filter);
+bool probe_type_is_available(enum probe_type type);
 #else	/* ! HAVE_LIBELF_SUPPORT */
 static inline struct probe_cache *probe_cache__new(const char *tgt __maybe_unused)
 {
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index 5c290c682afe..24dbe23e010c 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -39,6 +39,7 @@
 #include "util.h"
 #include "symbol.h"
 #include "probe-finder.h"
+#include "probe-file.h"
 
 /* Kprobe tracer basic type is up to u64 */
 #define MAX_BASIC_TYPE_BITS	64
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 29/35] perf probe: Support hexadecimal casting
  2016-08-23 21:03 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (27 preceding siblings ...)
  2016-08-23 21:03 ` [PATCH 28/35] perf probe: Add supported for type casting by the running kernel Arnaldo Carvalho de Melo
@ 2016-08-23 21:03 ` Arnaldo Carvalho de Melo
  2016-08-23 21:03 ` [PATCH 30/35] perf probe: Use hexadecimal type by default if possible Arnaldo Carvalho de Melo
                   ` (6 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-08-23 21:03 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Masami Hiramatsu, Alexander Shishkin, Hemant Kumar,
	Naohiro Aota, Peter Zijlstra, Steven Rostedt, Wang Nan,
	Arnaldo Carvalho de Melo

From: Masami Hiramatsu <mhiramat@kernel.org>

Support hexadecimal unsigned integer casting by 'x'.  This allows user
to explicitly specify the output format of the probe arguments as
hexadecimal.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
Cc: Naohiro Aota <naohiro.aota@hgst.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/147151072679.12957.4458656416765710753.stgit@devbox
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Documentation/perf-probe.txt |  4 ++--
 tools/perf/util/probe-finder.c          | 17 ++++++++++-------
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/tools/perf/Documentation/perf-probe.txt b/tools/perf/Documentation/perf-probe.txt
index aa333258b1b7..d217617108a1 100644
--- a/tools/perf/Documentation/perf-probe.txt
+++ b/tools/perf/Documentation/perf-probe.txt
@@ -176,13 +176,13 @@ Each probe argument follows below syntax.
 
 'NAME' specifies the name of this argument (optional). You can use the name of local variable, local data structure member (e.g. var->field, var.field2), local array with fixed index (e.g. array[1], var->array[0], var->pointer[2]), or kprobe-tracer argument format (e.g. $retval, %ax, etc). Note that the name of this argument will be set as the last member name if you specify a local data structure member (e.g. field2 for 'var->field1.field2'.)
 '$vars' and '$params' special arguments are also available for NAME, '$vars' is expanded to the local variables (including function parameters) which can access at given probe point. '$params' is expanded to only the function parameters.
-'TYPE' casts the type of this argument (optional). If omitted, perf probe automatically set the type based on debuginfo. Currently, basic types (u8/u16/u32/u64/s8/s16/s32/s64), hexadecimal integers (x8/x16/x32/x64), signedness casting (u/s), "string" and bitfield are supported. (see TYPES for detail)
+'TYPE' casts the type of this argument (optional). If omitted, perf probe automatically set the type based on debuginfo. Currently, basic types (u8/u16/u32/u64/s8/s16/s32/s64), hexadecimal integers (x/x8/x16/x32/x64), signedness casting (u/s), "string" and bitfield are supported. (see TYPES for detail)
 
 On x86 systems %REG is always the short form of the register: for example %AX. %RAX or %EAX is not valid.
 
 TYPES
 -----
-Basic types (u8/u16/u32/u64/s8/s16/s32/s64) and hexadecimal integers (x8/x16/x32/x64) are integer types. Prefix 's' and 'u' means those types are signed and unsigned respectively, and 'x' means that is shown in hexadecimal format. Traced arguments are shown in decimal (signed) or hex (unsigned). You can also use 's' or 'u' to specify only signedness and leave its size auto-detected by perf probe.
+Basic types (u8/u16/u32/u64/s8/s16/s32/s64) and hexadecimal integers (x8/x16/x32/x64) are integer types. Prefix 's' and 'u' means those types are signed and unsigned respectively, and 'x' means that is shown in hexadecimal format. Traced arguments are shown in decimal (signed) or hex (unsigned). You can also use 's' or 'u' to specify only signedness and leave its size auto-detected by perf probe. Moreover, you can use 'x' to explicitly specify to be shown in hexadecimal (the size is also auto-detected).
 String type is a special type, which fetches a "null-terminated" string from kernel space. This means it will fail and store NULL if the string container has been paged out. You can specify 'string' type only for the local variable or structure member which is an array of or a pointer to 'char' or 'unsigned char' type.
 Bitfield is another special type, which takes 3 parameters, bit-width, bit-offset, and container-size (usually 32). The syntax is;
 
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index 24dbe23e010c..f18cd6bbada9 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -298,13 +298,13 @@ static int convert_variable_type(Dwarf_Die *vr_die,
 	char sbuf[STRERR_BUFSIZE];
 	int bsize, boffs, total;
 	int ret;
-	char sign;
+	char prefix;
 
 	/* TODO: check all types */
-	if (cast && strcmp(cast, "string") != 0 &&
+	if (cast && strcmp(cast, "string") != 0 && strcmp(cast, "x") != 0 &&
 	    strcmp(cast, "s") != 0 && strcmp(cast, "u") != 0) {
 		/* Non string type is OK */
-		/* and respect signedness cast */
+		/* and respect signedness/hexadecimal cast */
 		tvar->type = strdup(cast);
 		return (tvar->type == NULL) ? -ENOMEM : 0;
 	}
@@ -366,11 +366,14 @@ static int convert_variable_type(Dwarf_Die *vr_die,
 	}
 
 	if (cast && (strcmp(cast, "u") == 0))
-		sign = 'u';
+		prefix = 'u';
 	else if (cast && (strcmp(cast, "s") == 0))
-		sign = 's';
+		prefix = 's';
+	else if (cast && (strcmp(cast, "x") == 0) &&
+		 probe_type_is_available(PROBE_TYPE_X))
+		prefix = 'x';
 	else
-		sign = die_is_signed_type(&type) ? 's' : 'u';
+		prefix = die_is_signed_type(&type) ? 's' : 'u';
 
 	ret = dwarf_bytesize(&type);
 	if (ret <= 0)
@@ -384,7 +387,7 @@ static int convert_variable_type(Dwarf_Die *vr_die,
 			dwarf_diename(&type), MAX_BASIC_TYPE_BITS);
 		ret = MAX_BASIC_TYPE_BITS;
 	}
-	ret = snprintf(buf, 16, "%c%d", sign, ret);
+	ret = snprintf(buf, 16, "%c%d", prefix, ret);
 
 formatted:
 	if (ret < 0 || ret >= 16) {
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 30/35] perf probe: Use hexadecimal type by default if possible
  2016-08-23 21:03 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (28 preceding siblings ...)
  2016-08-23 21:03 ` [PATCH 29/35] perf probe: Support hexadecimal casting Arnaldo Carvalho de Melo
@ 2016-08-23 21:03 ` Arnaldo Carvalho de Melo
  2016-08-23 21:03 ` [PATCH 31/35] ftrace: kprobe: uprobe: Show u8/u16/u32/u64 types in decimal Arnaldo Carvalho de Melo
                   ` (5 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-08-23 21:03 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Masami Hiramatsu, Alexander Shishkin, Hemant Kumar,
	Naohiro Aota, Peter Zijlstra, Steven Rostedt, Wang Nan,
	Arnaldo Carvalho de Melo

From: Masami Hiramatsu <mhiramat@kernel.org>

Use hexadecimal type by default if it is available on current running
kernel.

This keeps the default behavior of perf probe after changing the output
format of 'u8/16/32/64' to unsigned decimal number.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
Cc: Naohiro Aota <naohiro.aota@hgst.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/147151074685.12957.16415861010796255514.stgit@devbox
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/probe-finder.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index f18cd6bbada9..ac4740f8ee3a 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -373,7 +373,8 @@ static int convert_variable_type(Dwarf_Die *vr_die,
 		 probe_type_is_available(PROBE_TYPE_X))
 		prefix = 'x';
 	else
-		prefix = die_is_signed_type(&type) ? 's' : 'u';
+		prefix = die_is_signed_type(&type) ? 's' :
+			 probe_type_is_available(PROBE_TYPE_X) ? 'x' : 'u';
 
 	ret = dwarf_bytesize(&type);
 	if (ret <= 0)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 31/35] ftrace: kprobe: uprobe: Show u8/u16/u32/u64 types in decimal
  2016-08-23 21:03 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (29 preceding siblings ...)
  2016-08-23 21:03 ` [PATCH 30/35] perf probe: Use hexadecimal type by default if possible Arnaldo Carvalho de Melo
@ 2016-08-23 21:03 ` Arnaldo Carvalho de Melo
  2016-08-23 21:03 ` [PATCH 32/35] perf tools: Fix typo: "ehough" -> "enough" Arnaldo Carvalho de Melo
                   ` (4 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-08-23 21:03 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Masami Hiramatsu, Alexander Shishkin, Hemant Kumar,
	Naohiro Aota, Peter Zijlstra, Wang Nan, Arnaldo Carvalho de Melo

From: Masami Hiramatsu <mhiramat@kernel.org>

Change kprobe/uprobe-tracer to show the arguments type-casted
with u8/u16/u32/u64 in decimal digits instead of hexadecimal.

To minimize compatibility issue, the arguments without type
casting are typed by x64 (or x32 for 32bit arch) by default.

Note: all arguments set by old perf probe without types are
shown in decimal by default.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
Cc: Naohiro Aota <naohiro.aota@hgst.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/147151076135.12957.14684546093034343894.stgit@devbox
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 Documentation/trace/kprobetrace.txt     | 5 ++++-
 Documentation/trace/uprobetracer.txt    | 5 ++++-
 kernel/trace/trace_probe.c              | 8 ++++----
 kernel/trace/trace_probe.h              | 2 +-
 tools/perf/Documentation/perf-probe.txt | 5 ++---
 5 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/Documentation/trace/kprobetrace.txt b/Documentation/trace/kprobetrace.txt
index 9109c8e8a5a1..e4991fb1eedc 100644
--- a/Documentation/trace/kprobetrace.txt
+++ b/Documentation/trace/kprobetrace.txt
@@ -54,7 +54,10 @@ Types
 -----
 Several types are supported for fetch-args. Kprobe tracer will access memory
 by given type. Prefix 's' and 'u' means those types are signed and unsigned
-respectively. Traced arguments are shown in decimal (signed) or hex (unsigned).
+respectively. 'x' prefix implies it is unsigned. Traced arguments are shown
+in decimal ('s' and 'u') or hexadecimal ('x'). Without type casting, 'x32'
+or 'x64' is used depends on the architecture (e.g. x86-32 uses x32, and
+x86-64 uses x64).
 String type is a special type, which fetches a "null-terminated" string from
 kernel space. This means it will fail and store NULL if the string container
 has been paged out.
diff --git a/Documentation/trace/uprobetracer.txt b/Documentation/trace/uprobetracer.txt
index 7e6d28c54b75..94b6b4581763 100644
--- a/Documentation/trace/uprobetracer.txt
+++ b/Documentation/trace/uprobetracer.txt
@@ -50,7 +50,10 @@ Types
 -----
 Several types are supported for fetch-args. Uprobe tracer will access memory
 by given type. Prefix 's' and 'u' means those types are signed and unsigned
-respectively. Traced arguments are shown in decimal (signed) or hex (unsigned).
+respectively. 'x' prefix implies it is unsigned. Traced arguments are shown
+in decimal ('s' and 'u') or hexadecimal ('x'). Without type casting, 'x32'
+or 'x64' is used depends on the architecture (e.g. x86-32 uses x32, and
+x86-64 uses x64).
 String type is a special type, which fetches a "null-terminated" string from
 user space.
 Bitfield is another special type, which takes 3 parameters, bit-width, bit-
diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
index 725af9dcbdff..8c0553d9afd3 100644
--- a/kernel/trace/trace_probe.c
+++ b/kernel/trace/trace_probe.c
@@ -46,10 +46,10 @@ int PRINT_TYPE_FUNC_NAME(tname)(struct trace_seq *s, const char *name,	\
 const char PRINT_TYPE_FMT_NAME(tname)[] = fmt;				\
 NOKPROBE_SYMBOL(PRINT_TYPE_FUNC_NAME(tname));
 
-DEFINE_BASIC_PRINT_TYPE_FUNC(u8,  u8,  "0x%x")
-DEFINE_BASIC_PRINT_TYPE_FUNC(u16, u16, "0x%x")
-DEFINE_BASIC_PRINT_TYPE_FUNC(u32, u32, "0x%x")
-DEFINE_BASIC_PRINT_TYPE_FUNC(u64, u64, "0x%Lx")
+DEFINE_BASIC_PRINT_TYPE_FUNC(u8,  u8,  "%u")
+DEFINE_BASIC_PRINT_TYPE_FUNC(u16, u16, "%u")
+DEFINE_BASIC_PRINT_TYPE_FUNC(u32, u32, "%u")
+DEFINE_BASIC_PRINT_TYPE_FUNC(u64, u64, "%Lu")
 DEFINE_BASIC_PRINT_TYPE_FUNC(s8,  s8,  "%d")
 DEFINE_BASIC_PRINT_TYPE_FUNC(s16, s16, "%d")
 DEFINE_BASIC_PRINT_TYPE_FUNC(s32, s32, "%d")
diff --git a/kernel/trace/trace_probe.h b/kernel/trace/trace_probe.h
index f0c470a10edd..0c0ae54d44c6 100644
--- a/kernel/trace/trace_probe.h
+++ b/kernel/trace/trace_probe.h
@@ -208,7 +208,7 @@ DEFINE_FETCH_##method(u32)		\
 DEFINE_FETCH_##method(u64)
 
 /* Default (unsigned long) fetch type */
-#define __DEFAULT_FETCH_TYPE(t) u##t
+#define __DEFAULT_FETCH_TYPE(t) x##t
 #define _DEFAULT_FETCH_TYPE(t) __DEFAULT_FETCH_TYPE(t)
 #define DEFAULT_FETCH_TYPE _DEFAULT_FETCH_TYPE(BITS_PER_LONG)
 #define DEFAULT_FETCH_TYPE_STR __stringify(DEFAULT_FETCH_TYPE)
diff --git a/tools/perf/Documentation/perf-probe.txt b/tools/perf/Documentation/perf-probe.txt
index d217617108a1..f37d123d5dac 100644
--- a/tools/perf/Documentation/perf-probe.txt
+++ b/tools/perf/Documentation/perf-probe.txt
@@ -176,13 +176,12 @@ Each probe argument follows below syntax.
 
 'NAME' specifies the name of this argument (optional). You can use the name of local variable, local data structure member (e.g. var->field, var.field2), local array with fixed index (e.g. array[1], var->array[0], var->pointer[2]), or kprobe-tracer argument format (e.g. $retval, %ax, etc). Note that the name of this argument will be set as the last member name if you specify a local data structure member (e.g. field2 for 'var->field1.field2'.)
 '$vars' and '$params' special arguments are also available for NAME, '$vars' is expanded to the local variables (including function parameters) which can access at given probe point. '$params' is expanded to only the function parameters.
-'TYPE' casts the type of this argument (optional). If omitted, perf probe automatically set the type based on debuginfo. Currently, basic types (u8/u16/u32/u64/s8/s16/s32/s64), hexadecimal integers (x/x8/x16/x32/x64), signedness casting (u/s), "string" and bitfield are supported. (see TYPES for detail)
-
+'TYPE' casts the type of this argument (optional). If omitted, perf probe automatically set the type based on debuginfo (*). Currently, basic types (u8/u16/u32/u64/s8/s16/s32/s64), hexadecimal integers (x/x8/x16/x32/x64), signedness casting (u/s), "string" and bitfield are supported. (see TYPES for detail)
 On x86 systems %REG is always the short form of the register: for example %AX. %RAX or %EAX is not valid.
 
 TYPES
 -----
-Basic types (u8/u16/u32/u64/s8/s16/s32/s64) and hexadecimal integers (x8/x16/x32/x64) are integer types. Prefix 's' and 'u' means those types are signed and unsigned respectively, and 'x' means that is shown in hexadecimal format. Traced arguments are shown in decimal (signed) or hex (unsigned). You can also use 's' or 'u' to specify only signedness and leave its size auto-detected by perf probe. Moreover, you can use 'x' to explicitly specify to be shown in hexadecimal (the size is also auto-detected).
+Basic types (u8/u16/u32/u64/s8/s16/s32/s64) and hexadecimal integers (x8/x16/x32/x64) are integer types. Prefix 's' and 'u' means those types are signed and unsigned respectively, and 'x' means that is shown in hexadecimal format. Traced arguments are shown in decimal (sNN/uNN) or hex (xNN). You can also use 's' or 'u' to specify only signedness and leave its size auto-detected by perf probe. Moreover, you can use 'x' to explicitly specify to be shown in hexadecimal (the size is also auto-detected).
 String type is a special type, which fetches a "null-terminated" string from kernel space. This means it will fail and store NULL if the string container has been paged out. You can specify 'string' type only for the local variable or structure member which is an array of or a pointer to 'char' or 'unsigned char' type.
 Bitfield is another special type, which takes 3 parameters, bit-width, bit-offset, and container-size (usually 32). The syntax is;
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 32/35] perf tools: Fix typo: "ehough" -> "enough"
  2016-08-23 21:03 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (30 preceding siblings ...)
  2016-08-23 21:03 ` [PATCH 31/35] ftrace: kprobe: uprobe: Show u8/u16/u32/u64 types in decimal Arnaldo Carvalho de Melo
@ 2016-08-23 21:03 ` Arnaldo Carvalho de Melo
  2016-08-23 21:03 ` [PATCH 33/35] perf test bpf: " Arnaldo Carvalho de Melo
                   ` (3 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-08-23 21:03 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Colin Ian King, Alexander Shishkin, He Kuang,
	Jiri Olsa, Peter Zijlstra, Wang Nan, Arnaldo Carvalho de Melo

From: Colin Ian King <colin.king@canonical.com>

Trivial typo fix in pr_debug message

Signed-off-by: Colin King <colin.king@canonical.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: He Kuang <hekuang@huawei.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/20160821141256.7530-1-colin.king@canonical.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/tests/backward-ring-buffer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/tests/backward-ring-buffer.c b/tools/perf/tests/backward-ring-buffer.c
index 615780cbfe1d..e6d1816e431a 100644
--- a/tools/perf/tests/backward-ring-buffer.c
+++ b/tools/perf/tests/backward-ring-buffer.c
@@ -97,7 +97,7 @@ int test__backward_ring_buffer(int subtest __maybe_unused)
 
 	evlist = perf_evlist__new();
 	if (!evlist) {
-		pr_debug("No ehough memory to create evlist\n");
+		pr_debug("No enough memory to create evlist\n");
 		return TEST_FAIL;
 	}
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 33/35] perf test bpf: Fix typo: "ehough" -> "enough"
  2016-08-23 21:03 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (31 preceding siblings ...)
  2016-08-23 21:03 ` [PATCH 32/35] perf tools: Fix typo: "ehough" -> "enough" Arnaldo Carvalho de Melo
@ 2016-08-23 21:03 ` Arnaldo Carvalho de Melo
  2016-08-23 21:03 ` [PATCH 34/35] perf " Arnaldo Carvalho de Melo
                   ` (2 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-08-23 21:03 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Colin Ian King, Alexander Shishkin, Peter Zijlstra,
	Wang Nan, Arnaldo Carvalho de Melo

From: Colin Ian King <colin.king@canonical.com>

Trivial typo fix in pr_debug message

Signed-off-by: Colin King <colin.king@canonical.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/20160821141603.7832-1-colin.king@canonical.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/tests/bpf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/tests/bpf.c b/tools/perf/tests/bpf.c
index fc54064b9186..2673e86ed50f 100644
--- a/tools/perf/tests/bpf.c
+++ b/tools/perf/tests/bpf.c
@@ -125,7 +125,7 @@ static int do_test(struct bpf_object *obj, int (*func)(void),
 	/* Instead of perf_evlist__new_default, don't add default events */
 	evlist = perf_evlist__new();
 	if (!evlist) {
-		pr_debug("No ehough memory to create evlist\n");
+		pr_debug("No enough memory to create evlist\n");
 		return TEST_FAIL;
 	}
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 34/35] perf bpf: Fix typo: "ehough" -> "enough"
  2016-08-23 21:03 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (32 preceding siblings ...)
  2016-08-23 21:03 ` [PATCH 33/35] perf test bpf: " Arnaldo Carvalho de Melo
@ 2016-08-23 21:03 ` Arnaldo Carvalho de Melo
  2016-08-23 21:03 ` [PATCH 35/35] perf record: Fix spelling mistake "Finshed" -> "Finished" Arnaldo Carvalho de Melo
  2016-08-24  9:09 ` [GIT PULL 00/35] perf/core improvements and fixes Ingo Molnar
  35 siblings, 0 replies; 37+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-08-23 21:03 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Colin Ian King, Alexander Shishkin,
	Alexei Starovoitov, He Kuang, Peter Zijlstra, Wang Nan,
	Arnaldo Carvalho de Melo

From: Colin Ian King <colin.king@canonical.com>

Trivial typo fix in pr_debug message

Signed-off-by: Colin King <colin.king@canonical.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexei Starovoitov <ast@plumgrid.com>
Cc: He Kuang <hekuang@huawei.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/20160821141924.8056-1-colin.king@canonical.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/bpf-loader.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/bpf-loader.c b/tools/perf/util/bpf-loader.c
index 1f12e4e40006..2b2c9b82f5ab 100644
--- a/tools/perf/util/bpf-loader.c
+++ b/tools/perf/util/bpf-loader.c
@@ -531,7 +531,7 @@ static int map_prologue(struct perf_probe_event *pev, int *mapping,
 
 	ptevs = malloc(array_sz);
 	if (!ptevs) {
-		pr_debug("No ehough memory: alloc ptevs failed\n");
+		pr_debug("No enough memory: alloc ptevs failed\n");
 		return -ENOMEM;
 	}
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 35/35] perf record: Fix spelling mistake "Finshed" -> "Finished"
  2016-08-23 21:03 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (33 preceding siblings ...)
  2016-08-23 21:03 ` [PATCH 34/35] perf " Arnaldo Carvalho de Melo
@ 2016-08-23 21:03 ` Arnaldo Carvalho de Melo
  2016-08-24  9:09 ` [GIT PULL 00/35] perf/core improvements and fixes Ingo Molnar
  35 siblings, 0 replies; 37+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-08-23 21:03 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Colin Ian King, Alexander Shishkin, Peter Zijlstra,
	Arnaldo Carvalho de Melo

From: Colin Ian King <colin.king@canonical.com>

Trivial fix to spelling mistake in pr_debug message.

Signed-off-by: Colin King <colin.king@canonical.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20160822183008.26368-1-colin.king@canonical.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-record.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index a3792e8c3e03..03251c7f14ec 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -96,7 +96,7 @@ backward_rb_find_range(void *buf, int mask, u64 head, u64 *start, u64 *end)
 	*start = head;
 	while (true) {
 		if (evt_head - head >= (unsigned int)size) {
-			pr_debug("Finshed reading backward ring buffer: rewind\n");
+			pr_debug("Finished reading backward ring buffer: rewind\n");
 			if (evt_head - head > (unsigned int)size)
 				evt_head -= pheader->size;
 			*end = evt_head;
@@ -106,7 +106,7 @@ backward_rb_find_range(void *buf, int mask, u64 head, u64 *start, u64 *end)
 		pheader = (struct perf_event_header *)(buf + (evt_head & mask));
 
 		if (pheader->size == 0) {
-			pr_debug("Finshed reading backward ring buffer: get start\n");
+			pr_debug("Finished reading backward ring buffer: get start\n");
 			*end = evt_head;
 			return 0;
 		}
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* Re: [GIT PULL 00/35] perf/core improvements and fixes
  2016-08-23 21:03 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (34 preceding siblings ...)
  2016-08-23 21:03 ` [PATCH 35/35] perf record: Fix spelling mistake "Finshed" -> "Finished" Arnaldo Carvalho de Melo
@ 2016-08-24  9:09 ` Ingo Molnar
  35 siblings, 0 replies; 37+ messages in thread
From: Ingo Molnar @ 2016-08-24  9:09 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Adrian Hunter, Alexander Shishkin,
	Alexander Yarygin, Alexey Brodkin, Alexei Starovoitov,
	Arjan van de Ven, Colin King, David Ahern, He Kuang,
	Hemant Kumar, Jiri Olsa, Masami Hiramatsu, Mathieu Poirier,
	Namhyung Kim, Naohiro Aota, Pekka Enberg, Peter Zijlstra,
	Rui Teng, Stanislav Fomichev, Steven Rostedt, Vince Weaver,
	Vineet Gupta, Wang Nan, Arnaldo Carvalho de Melo


* Arnaldo Carvalho de Melo <acme@kernel.org> wrote:

> Hi Ingo,
> 
> 	Please consider pulling, I first merged tip/perf/urgent into a
> tip/perf/core and rebased the patches I had in acme/perf/core.
> 
> - Arnaldo
> 
> Build stats at the end of this message.
> 
> The following changes since commit ce90c12d2453aa6be743719bb0a5d4040b92700f:
> 
>   Merge branch 'perf/urgent' into perf/core, to pick up fixes before merging new changes (2016-08-23 15:35:47 -0300)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo-20160823
> 
> for you to fetch changes up to 5e30d55c71de058e4156080fe32d426c22d094cb:
> 
>   perf record: Fix spelling mistake "Finshed" -> "Finished" (2016-08-23 17:06:40 -0300)
> 
> ----------------------------------------------------------------
> perf/core improvements and fixes:
> 
> User visible:
> 
> . Allow configuring the default 'perf report -s' sort order in ~/.perfconfig,
>   for instance, "sym,dso" may be more fitting for kernel developers. (Arnaldo Carvalho de Melo)
> 
> - Support x8/x16/x32/x64 hexadecimal "types" in ftrace and 'perf probe' (Masami Hiramatsu)
> 
> Infrastructure:
> 
> - Skip running the feature tests for 'make install-doc' (Rui Teng)
> 
> - Introduce tools/include/linux/time64.h with *SEC_PER_*SEC macros
>   to use in all of tools/ (Arnaldo Carvalho de Melo)
> 
> - Break down symbol__disassemble() into multiple functions, to ease
>   future work on better reporting the errors that may take place in
>   the various steps it performs (possibly decompressing kernel module
>   files, getting build-id keyed files, calling objdump, parsing its
>   output, etc) (Arnaldo Carvalho de Melo)
> 
> - Typo fixes in various places (Colin Ian King)
> 
> - Remove superfluous NULL check in the TUI code (Colin Ian King)
> 
> - Allow displaying multiple header lines in the TUI browser, prep
>   work for the 'perf c2c' browser (Jiri Olsa)
> 
> - Copy coresight-pmu.h header file needed by perf tools (Mathieu Poirier)
> 
> - Use __weak definition from linux/compiler.h (Rui Teng)
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> ----------------------------------------------------------------
> 
> Arnaldo Carvalho de Melo (16):
>       tools: Introduce tools/include/linux/time64.h for *SEC_PER_*SEC macros
>       perf bench numa: Use NSEC_PER_U?SEC
>       perf sched: Use linux/time64.h
>       perf timechart: Use NSEC_PER_U?SEC
>       perf bench sched-pipe: Use linux/time64.h, USEC_PER_SEC
>       perf stat: Use *SEC_PER_*SEC macros
>       perf bench mem: Use USEC_PER_SEC
>       perf bench sched-messaging: Use USEC_PER_MSEC
>       perf record: Use USEC_PER_MSEC
>       perf kvm: Use NSEC_PER_USEC
>       perf bench futex: Use NSEC_PER_USEC
>       perf top: Use MSEC_PER_SEC
>       perf disassemble: Move check for kallsyms + !kcore
>       perf disassemble: Simplify logic for picking the filename to disassemble
>       perf disassemble: Extract logic to find file to pass to objdump to a separate function
>       perf report: Allow configuring the default sort order in ~/.perfconfig
> 
> Colin Ian King (5):
>       perf hists browser: Remove superfluous null check on map
>       perf tools: Fix typo: "ehough" -> "enough"
>       perf test bpf: Fix typo: "ehough" -> "enough"
>       perf bpf: Fix typo: "ehough" -> "enough"
>       perf record: Fix spelling mistake "Finshed" -> "Finished"
> 
> Jiri Olsa (5):
>       perf hists: Introduce nr_header_lines into struct perf_hpp_list
>       perf hists: Add line argument into perf_hpp_fmt's header callback
>       perf tools tui: Display multiple header lines
>       perf tools stdio: Display multiple header lines
>       perf hists: Add support for header span
> 
> Masami Hiramatsu (6):
>       ftrace: kprobe: uprobe: Add x8/x16/x32/x64 for hexadecimal types
>       ftrace: probe: Add README entries for k/uprobe-events
>       perf probe: Add supported for type casting by the running kernel
>       perf probe: Support hexadecimal casting
>       perf probe: Use hexadecimal type by default if possible
>       ftrace: kprobe: uprobe: Show u8/u16/u32/u64 types in decimal
> 
> Mathieu Poirier (1):
>       tools: Copy coresight-pmu.h header file needed by perf tools
> 
> Rui Teng (2):
>       perf tools: Use __weak definition from linux/compiler.h
>       perf tools: Skip running the feature tests for 'make install-doc'
> 
>  Documentation/trace/kprobetrace.txt                |  9 ++-
>  Documentation/trace/uprobetracer.txt               |  9 ++-
>  kernel/trace/trace.c                               | 24 ++++++
>  kernel/trace/trace_kprobe.c                        |  4 +
>  kernel/trace/trace_probe.c                         | 30 ++++----
>  kernel/trace/trace_probe.h                         | 11 ++-
>  kernel/trace/trace_uprobe.c                        |  4 +
>  tools/include/linux/coresight-pmu.h                | 39 ++++++++++
>  tools/include/linux/time64.h                       | 12 +++
>  tools/perf/Documentation/perf-config.txt           |  4 +
>  tools/perf/Documentation/perf-probe.txt            |  5 +-
>  tools/perf/MANIFEST                                |  2 +
>  tools/perf/Makefile.perf                           |  5 +-
>  tools/perf/bench/futex-requeue.c                   |  5 +-
>  tools/perf/bench/futex-wake-parallel.c             |  5 +-
>  tools/perf/bench/futex-wake.c                      |  5 +-
>  tools/perf/bench/mem-functions.c                   |  3 +-
>  tools/perf/bench/numa.c                            | 53 ++++++-------
>  tools/perf/bench/sched-messaging.c                 |  5 +-
>  tools/perf/bench/sched-pipe.c                      |  9 ++-
>  tools/perf/builtin-diff.c                          |  4 +-
>  tools/perf/builtin-kvm.c                           | 11 +--
>  tools/perf/builtin-record.c                        |  8 +-
>  tools/perf/builtin-report.c                        |  4 +
>  tools/perf/builtin-sched.c                         | 37 ++++-----
>  tools/perf/builtin-script.c                        |  7 +-
>  tools/perf/builtin-stat.c                          | 19 ++---
>  tools/perf/builtin-timechart.c                     | 13 ++--
>  tools/perf/builtin-top.c                           |  3 +-
>  tools/perf/builtin-trace.c                         |  1 +
>  tools/perf/perf.h                                  |  7 --
>  tools/perf/tests/backward-ring-buffer.c            |  2 +-
>  tools/perf/tests/bpf.c                             |  2 +-
>  tools/perf/ui/browsers/hists.c                     | 50 +++++++++----
>  tools/perf/ui/gtk/hists.c                          |  2 +-
>  tools/perf/ui/hist.c                               |  4 +-
>  tools/perf/ui/stdio/hist.c                         | 45 +++++++----
>  tools/perf/util/annotate.c                         | 87 +++++++++++-----------
>  tools/perf/util/bpf-loader.c                       |  2 +-
>  tools/perf/util/debug.c                            | 10 +--
>  tools/perf/util/header.c                           |  3 +-
>  tools/perf/util/hist.h                             |  3 +-
>  tools/perf/util/probe-file.c                       | 57 ++++++++++++++
>  tools/perf/util/probe-file.h                       | 10 +++
>  tools/perf/util/probe-finder.c                     | 19 +++--
>  .../perf/util/scripting-engines/trace-event-perl.c |  5 +-
>  .../util/scripting-engines/trace-event-python.c    |  5 +-
>  tools/perf/util/sort.c                             |  9 ++-
>  tools/perf/util/sort.h                             |  2 +-
>  tools/perf/util/svghelper.c                        | 11 +--
>  tools/perf/util/util.c                             |  1 +
>  tools/perf/util/util.h                             |  4 -
>  52 files changed, 464 insertions(+), 226 deletions(-)
>  create mode 100644 tools/include/linux/coresight-pmu.h
>  create mode 100644 tools/include/linux/time64.h
> 
> Build Stats:
> 
> News:
> 
> The fedora:24-x-ARC-uClibc adds the ARC arch and the uClibc libc to the mix of
> targets tested, still with a minimal build that doesn't include even libelf,
> that will be added soon, using a more full featured pre-built toolchain provided
> by the Synopsys folks.
> 
>   [root@jouet ~]# time dm
>    1 70.304638757 alpine:3.4: Ok
>    2 24.806303766 android-ndk:r12b-arm: Ok
>    3 71.829633643 archlinux:latest: Ok
>    4 39.316551941 centos:5: Ok
>    5 59.282978228 centos:6: Ok
>    6 69.836088394 centos:7: Ok
>    7 63.476952272 debian:7: Ok
>    8 69.450110099 debian:8: Ok
>    9 72.484714796 debian:experimental: Ok
>   10 69.730035221 fedora:20: Ok
>   11 73.629813614 fedora:21: Ok
>   12 71.955425760 fedora:22: Ok
>   13 73.015579053 fedora:23: Ok
>   14 81.186943795 fedora:24: Ok
>   15 31.401503154 fedora:24-x-ARC-uClibc: Ok
>   16 78.366606942 fedora:rawhide: Ok
>   17 77.434661064 mageia:5: Ok
>   18 74.491020416 opensuse:13.2: Ok
>   19 71.673570141 opensuse:42.1: Ok
>   20 79.587415167 opensuse:tumbleweed: Ok
>   21 57.802976895 ubuntu:12.04.5: Ok
>   22 68.505810699 ubuntu:14.04.4: Ok
>   23 69.478057262 ubuntu:15.10: Ok
>   24 65.596669700 ubuntu:16.04: Ok
>   25 52.759886216 ubuntu:16.04-x-arm: Ok
>   26 52.389293077 ubuntu:16.04-x-arm64: Ok
>   27 52.319141734 ubuntu:16.04-x-powerpc64: Ok
>   28 54.378287607 ubuntu:16.04-x-powerpc64el: Ok
>   29 72.794919209 ubuntu:16.10: Ok
>   30 53.351899868 ubuntu:16.10-x-s390: Ok
>      1922.64s
> 
>   real	32m3.246s
>   user	0m1.858s
>   sys	0m2.363s
>   [root@jouet ~]#

Pulled, thanks a lot Arnaldo!

	Ingo

^ permalink raw reply	[flat|nested] 37+ messages in thread

end of thread, other threads:[~2016-08-24  9:09 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-23 21:03 [GIT PULL 00/35] perf/core improvements and fixes Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 01/35] tools: Introduce tools/include/linux/time64.h for *SEC_PER_*SEC macros Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 02/35] perf bench numa: Use NSEC_PER_U?SEC Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 03/35] perf sched: Use linux/time64.h Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 04/35] perf timechart: Use NSEC_PER_U?SEC Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 05/35] perf bench sched-pipe: Use linux/time64.h, USEC_PER_SEC Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 06/35] perf stat: Use *SEC_PER_*SEC macros Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 07/35] perf bench mem: Use USEC_PER_SEC Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 08/35] perf bench sched-messaging: Use USEC_PER_MSEC Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 09/35] perf record: " Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 10/35] perf kvm: Use NSEC_PER_USEC Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 11/35] perf bench futex: " Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 12/35] perf top: Use MSEC_PER_SEC Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 13/35] perf hists: Introduce nr_header_lines into struct perf_hpp_list Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 14/35] perf hists: Add line argument into perf_hpp_fmt's header callback Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 15/35] perf tools tui: Display multiple header lines Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 16/35] perf tools stdio: " Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 17/35] perf hists: Add support for header span Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 18/35] perf disassemble: Move check for kallsyms + !kcore Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 19/35] perf disassemble: Simplify logic for picking the filename to disassemble Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 20/35] perf disassemble: Extract logic to find file to pass to objdump to a separate function Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 21/35] tools: Copy coresight-pmu.h header file needed by perf tools Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 22/35] perf report: Allow configuring the default sort order in ~/.perfconfig Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 23/35] perf tools: Use __weak definition from linux/compiler.h Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 24/35] perf tools: Skip running the feature tests for 'make install-doc' Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 25/35] perf hists browser: Remove superfluous null check on map Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 26/35] ftrace: kprobe: uprobe: Add x8/x16/x32/x64 for hexadecimal types Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 27/35] ftrace: probe: Add README entries for k/uprobe-events Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 28/35] perf probe: Add supported for type casting by the running kernel Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 29/35] perf probe: Support hexadecimal casting Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 30/35] perf probe: Use hexadecimal type by default if possible Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 31/35] ftrace: kprobe: uprobe: Show u8/u16/u32/u64 types in decimal Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 32/35] perf tools: Fix typo: "ehough" -> "enough" Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 33/35] perf test bpf: " Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 34/35] perf " Arnaldo Carvalho de Melo
2016-08-23 21:03 ` [PATCH 35/35] perf record: Fix spelling mistake "Finshed" -> "Finished" Arnaldo Carvalho de Melo
2016-08-24  9:09 ` [GIT PULL 00/35] perf/core improvements and fixes Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).