perf/core improvements and fixes
Subsystems (4)
Arnaldo Carvalho de Melo
maintainerHi 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)
----------------------------------------------------------------
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 ~]#
Arnaldo Carvalho de Melo
maintainerPATCH 1/35 tools: Introduce tools/include/linux/time64.h for *SEC_PER_*SEC macros
From: Arnaldo Carvalho de Melo <[email protected]>
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.
--- 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
tools/include/linux/time64.h new file +12 -0
@@ -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 */
tools/perf/MANIFEST +1 -0
@@ -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
tools/perf/builtin-kvm.c +1 -0
@@ -24,6 +24,7 @@#include <sys/timerfd.h> #endif +#include <linux/time64.h> #include <termios.h> #include <semaphore.h> #include <pthread.h>
tools/perf/builtin-script.c +4 -3
@@ -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
tools/perf/builtin-stat.c +4 -3
@@ -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; }
tools/perf/builtin-trace.c +1 -0
@@ -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
tools/perf/perf.h +0 -7
@@ -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;
tools/perf/util/debug.c +4 -6
@@ -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);
tools/perf/util/scripting-engines/trace-event-perl.c +3 -2
@@ -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;
tools/perf/util/scripting-engines/trace-event-python.c +3 -2
@@ -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;
tools/perf/util/util.c +1 -0
@@ -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"
tools/perf/util/util.h +0 -4
@@ -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 ];
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 2/35 perf bench numa: Use NSEC_PER_U?SEC
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
Following kernel practices, using linux/time64.h
--- tools/perf/bench/numa.c | 53 +++++++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 26 deletions(-)
tools/perf/bench/numa.c +27 -26
@@ -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" ); } }
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 3/35 perf sched: Use linux/time64.h
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
Probably the next step is to introduce linux/time.h and use timespec_to_ns(), etc.
--- tools/perf/builtin-sched.c | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-)
tools/perf/builtin-sched.c +19 -18
@@ -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" );
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 4/35 perf timechart: Use NSEC_PER_U?SEC
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
Following kernel practices, using linux/time64.h
--- tools/perf/builtin-timechart.c | 13 +++++++------ tools/perf/util/svghelper.c | 11 ++++++----- 2 files changed, 13 insertions(+), 11 deletions(-)
tools/perf/builtin-timechart.c +7 -6
@@ -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" ;
tools/perf/util/svghelper.c +6 -5
@@ -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);
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 5/35 perf bench sched-pipe: Use linux/time64.h, USEC_PER_SEC
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
Following kernel practices.
--- tools/perf/bench/sched-pipe.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
tools/perf/bench/sched-pipe.c +5 -4
@@ -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_unuprintf ("# 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 :
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 6/35 perf stat: Use *SEC_PER_*SEC macros
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
To match how this is done in the kernel.
--- tools/perf/builtin-stat.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
tools/perf/builtin-stat.c +6 -6
@@ -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),
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 7/35 perf bench mem: Use USEC_PER_SEC
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
Following kernel practices, using linux/time64.h
--- tools/perf/bench/mem-functions.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/bench/mem-functions.c +2 -1
@@ -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 { \
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 8/35 perf bench sched-messaging: Use USEC_PER_MSEC
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
--- tools/perf/bench/sched-messaging.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
tools/perf/bench/sched-messaging.c +3 -2
@@ -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 */
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 9/35 perf record: Use USEC_PER_MSEC
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
Instead of a naked 1000.
--- tools/perf/builtin-record.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/builtin-record.c +2 -2
@@ -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); }
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 10/35 perf kvm: Use NSEC_PER_USEC
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
Following kernel practices and better documenting units of time.
--- tools/perf/builtin-kvm.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
tools/perf/builtin-kvm.c +5 -5
@@ -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);
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 11/35 perf bench futex: Use NSEC_PER_USEC
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
Following kernel practices and better documentin
--- 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(-)
tools/perf/bench/futex-requeue.c +3 -2
@@ -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 */
tools/perf/bench/futex-wake-parallel.c +3 -2
@@ -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)); }
tools/perf/bench/futex-wake.c +3 -2
@@ -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++) {
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 12/35 perf top: Use MSEC_PER_SEC
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
--- tools/perf/builtin-top.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/builtin-top.c +2 -1
@@ -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);
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 13/35 perf hists: Introduce nr_header_lines into struct perf_hpp_list
In reply to Arnaldo Carvalho de MeloFrom: Jiri Olsa <[email protected]>
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.
--- 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(-)
tools/perf/ui/browsers/hists.c +12 -3
@@ -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);
tools/perf/ui/hist.c +1 -0
@@ -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
tools/perf/util/hist.h +1 -0
@@ -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;
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 14/35 perf hists: Add line argument into perf_hpp_fmt's header callback
In reply to Arnaldo Carvalho de MeloFrom: Jiri Olsa <[email protected]>
Adding line argument into perf_hpp_fmt's header callback to be able to request specific header line.
--- 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(-)
tools/perf/builtin-diff.c +2 -1
@@ -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);
tools/perf/ui/browsers/hists.c +3 -3
@@ -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 *browsif (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);
tools/perf/ui/gtk/hists.c +1 -1
@@ -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))); } }
tools/perf/ui/hist.c +1 -1
@@ -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);
tools/perf/ui/stdio/hist.c +3 -3
@@ -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); }
tools/perf/util/hist.h +1 -1
@@ -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,
tools/perf/util/sort.c +3 -2
@@ -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;
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 15/35 perf tools tui: Display multiple header lines
In reply to Arnaldo Carvalho de MeloFrom: Jiri Olsa <[email protected]>
Display multiple header lines in TUI browser, if it's configured within struct perf_hpp_list::nr_header_lines.
--- tools/perf/ui/browsers/hists.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-)
tools/perf/ui/browsers/hists.c +17 -8
@@ -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)
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 16/35 perf tools stdio: Display multiple header lines
In reply to Arnaldo Carvalho de MeloFrom: Jiri Olsa <[email protected]>
Display multiple header lines in stdio output , if it's configured within struct perf_hpp_list::nr_header_lines.
--- tools/perf/ui/stdio/hist.c | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-)
tools/perf/ui/stdio/hist.c +25 -9
@@ -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)
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 17/35 perf hists: Add support for header span
In reply to Arnaldo Carvalho de MeloFrom: Jiri Olsa <[email protected]>
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.
--- 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(-)
tools/perf/builtin-diff.c +2 -1
@@ -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);
tools/perf/ui/browsers/hists.c +7 -3
@@ -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 *browsif (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);
tools/perf/ui/gtk/hists.c +1 -1
@@ -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))); } }
tools/perf/ui/hist.c +2 -1
@@ -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);
tools/perf/ui/stdio/hist.c +8 -5
@@ -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); } }
tools/perf/util/hist.h +1 -1
@@ -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,
tools/perf/util/sort.c +4 -2
@@ -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;
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 18/35 perf disassemble: Move check for kallsyms + !kcore
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
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.
--- tools/perf/util/annotate.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
tools/perf/util/annotate.c +8 -8
@@ -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:
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 19/35 perf disassemble: Simplify logic for picking the filename to disassemble
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
Lots of changes to support kcore, compressed modules, build-id files left us with some spaguetti code, simplify it a bit, more to come.
--- tools/perf/util/annotate.c | 41 ++++++++++++++++------------------------- 1 file changed, 16 insertions(+), 25 deletions(-)
tools/perf/util/annotate.c +16 -25
@@ -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;
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 20/35 perf disassemble: Extract logic to find file to pass to objdump to a separate function
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
Disentangling this a bit further, more to come.
--- tools/perf/util/annotate.c | 54 +++++++++++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 22 deletions(-)
tools/perf/util/annotate.c +32 -22
@@ -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));
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 21/35 tools: Copy coresight-pmu.h header file needed by perf tools
In reply to Arnaldo Carvalho de MeloFrom: Mathieu Poirier <[email protected]>
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.
--- 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
tools/include/linux/coresight-pmu.h new file +39 -0
@@ -0,0 +1,39 @@ +/* +* Copyright(C) 2015 Linaro Limited. All rights reserved. +* Author: Mathieu Poirier <[email protected]> +* +* 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
tools/perf/MANIFEST +1 -0
@@ -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
tools/perf/Makefile.perf +3 -0
@@ -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)
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 22/35 perf report: Allow configuring the default sort order in ~/.perfconfig
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
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.
--- 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(-)
tools/perf/Documentation/perf-config.txt +4 -0
@@ -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
tools/perf/builtin-report.c +4 -0
@@ -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 ; }
tools/perf/util/sort.c +1 -1
@@ -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" ;
tools/perf/util/sort.h +1 -1
@@ -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;
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 23/35 perf tools: Use __weak definition from linux/compiler.h
In reply to Arnaldo Carvalho de MeloFrom: Rui Teng <[email protected]>
Replace __attribute__((weak)) with __weak definition
--- tools/perf/util/header.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
tools/perf/util/header.c +1 -2
@@ -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 ; }
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 24/35 perf tools: Skip running the feature tests for 'make install-doc'
In reply to Arnaldo Carvalho de MeloFrom: Rui Teng <[email protected]>
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
--- tools/perf/Makefile.perf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/Makefile.perf +1 -1
@@ -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)),)
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 25/35 perf hists browser: Remove superfluous null check on map
In reply to Arnaldo Carvalho de MeloFrom: Colin Ian King <[email protected]>
'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.
--- tools/perf/ui/browsers/hists.c | 2 -- 1 file changed, 2 deletions(-)
tools/perf/ui/browsers/hists.c +0 -2
@@ -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;
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 26/35 ftrace: kprobe: uprobe: Add x8/x16/x32/x64 for hexadecimal types
In reply to Arnaldo Carvalho de MeloFrom: Masami Hiramatsu <[email protected]>
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.
--- 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(-)
Documentation/trace/kprobetrace.txt +2 -2
@@ -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.
Documentation/trace/uprobetracer.txt +2 -2
@@ -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.
kernel/trace/trace_kprobe.c +4 -0
@@ -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 };
kernel/trace/trace_probe.c +17 -13
@@ -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,
kernel/trace/trace_probe.h +9 -0
@@ -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
kernel/trace/trace_uprobe.c +4 -0
@@ -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 };
tools/perf/Documentation/perf-probe.txt +2 -2
@@ -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;
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 27/35 ftrace: probe: Add README entries for k/uprobe-events
In reply to Arnaldo Carvalho de MeloFrom: Masami Hiramatsu <[email protected]>
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.
--- kernel/trace/trace.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
kernel/trace/trace.c +24 -0
@@ -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"
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 28/35 perf probe: Add supported for type casting by the running kernel
In reply to Arnaldo Carvalho de MeloFrom: Masami Hiramatsu <[email protected]>
Add a checking routine what types are supported by the running kernel by finding the pattern in <debugfs>/tracing/README.
[ '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 ]
--- 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(+)
tools/perf/util/probe-file.c +57 -0
@@ -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; +}
tools/perf/util/probe-file.h +10 -0
@@ -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 ) {
tools/perf/util/probe-finder.c +1 -0
@@ -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
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 29/35 perf probe: Support hexadecimal casting
In reply to Arnaldo Carvalho de MeloFrom: Masami Hiramatsu <[email protected]>
Support hexadecimal unsigned integer casting by 'x'. This allows user to explicitly specify the output format of the probe arguments as hexadecimal.
--- tools/perf/Documentation/perf-probe.txt | 4 ++-- tools/perf/util/probe-finder.c | 17 ++++++++++------- 2 files changed, 12 insertions(+), 9 deletions(-)
tools/perf/Documentation/perf-probe.txt +2 -2
@@ -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;
tools/perf/util/probe-finder.c +10 -7
@@ -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 ) {
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 30/35 perf probe: Use hexadecimal type by default if possible
In reply to Arnaldo Carvalho de MeloFrom: Masami Hiramatsu <[email protected]>
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.
--- tools/perf/util/probe-finder.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/util/probe-finder.c +2 -1
@@ -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 )
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 31/35 ftrace: kprobe: uprobe: Show u8/u16/u32/u64 types in decimal
In reply to Arnaldo Carvalho de MeloFrom: Masami Hiramatsu <[email protected]>
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.
--- 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(-)
Documentation/trace/kprobetrace.txt +4 -1
@@ -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.
Documentation/trace/uprobetracer.txt +4 -1
@@ -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-
kernel/trace/trace_probe.c +4 -4
@@ -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" )
kernel/trace/trace_probe.h +1 -1
@@ -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)
tools/perf/Documentation/perf-probe.txt +2 -3
@@ -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;
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 32/35 perf tools: Fix typo: "ehough" -> "enough"
In reply to Arnaldo Carvalho de MeloFrom: Colin Ian King <[email protected]>
Trivial typo fix in pr_debug message
--- tools/perf/tests/backward-ring-buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/tests/backward-ring-buffer.c +1 -1
@@ -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 ; }
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 33/35 perf test bpf: Fix typo: "ehough" -> "enough"
In reply to Arnaldo Carvalho de MeloFrom: Colin Ian King <[email protected]>
Trivial typo fix in pr_debug message
--- tools/perf/tests/bpf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/tests/bpf.c +1 -1
@@ -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 ; }
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 34/35 perf bpf: Fix typo: "ehough" -> "enough"
In reply to Arnaldo Carvalho de MeloFrom: Colin Ian King <[email protected]>
Trivial typo fix in pr_debug message
--- tools/perf/util/bpf-loader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/bpf-loader.c +1 -1
@@ -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 ; }
Signature · 1 line
2.7.4
Arnaldo Carvalho de Melo
maintainerPATCH 35/35 perf record: Fix spelling mistake "Finshed" -> "Finished"
In reply to Arnaldo Carvalho de MeloFrom: Colin Ian King <[email protected]>
Trivial fix to spelling mistake in pr_debug message.
--- tools/perf/builtin-record.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/builtin-record.c +2 -2
@@ -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 ; }
Signature · 1 line
2.7.4
Quoted 202 lines · 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.gittags/perf-core-for-mingo-20160823for 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.hwith *SEC_PER_*SEC macros to use in all oftools/(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.hheader file needed by perf tools (Mathieu Poirier)- Use
__weakdefinition fromlinux/compiler.h(Rui Teng)Signed-off-by Arnaldo Carvalho de Melo <[email protected]>----------------------------------------------------------------
Arnaldo Carvalho de Melo (16):
tools: Introducetools/include/linux/time64.hfor *SEC_PER_*SEC macros perf bench numa: Use NSEC_PER_U?SEC
perf sched: Uselinux/time64.h
perf timechart: Use NSEC_PER_U?SEC
perf bench sched-pipe: Uselinux/time64.h,USEC_PER_SEC
perf stat: Use *SEC_PER_*SEC macros
perf bench mem: UseUSEC_PER_SEC
perf bench sched-messaging: UseUSEC_PER_MSEC
perf record: UseUSEC_PER_MSEC
perf kvm: UseNSEC_PER_USEC
perf bench futex: UseNSEC_PER_USEC
perf top: UseMSEC_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 ~/.perfconfigColin 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: Introducenr_header_linesinto structperf_hpp_listperf 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 spanMasami 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 decimalMathieu Poirier (1):
tools: Copycoresight-pmu.hheader file needed by perf toolsRui Teng (2):
perf tools: Use__weakdefinition fromlinux/compiler.hperf 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.hBuild 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
Quoted 6 lines
1922.64sreal 32m3.246s
user 0m1.858s
sys 0m2.363s
[root@jouet ~]#
Pulled, thanks a lot Arnaldo!
Ingo