perf tools: Disable ordered_events for report raw dump
Jiri Olsa
reviewerPATCH 1/2 perf tools: Disable ordered_events for report raw dump
Disable ordered_events for report raw dump, because for raw dump we want to see events as they are stored in the perf.data file, not sorted by time.
--- tools/perf/builtin-report.c | 3 +++ 1 file changed, 3 insertions(+)
tools/perf/builtin-report.c +3 -0
@@ -1332,6 +1332,9 @@ int cmd_report(int argc, const char **argv)if (report.mmaps_mode) report.tasks_mode = true; +if (dump_trace) + report.tool.ordered_events = false; +if (quiet)perf_quiet_option ();
Signature · 1 line
2.26.2
Jiri Olsa
reviewerPATCH 2/2 perf tools: Call test_attr__open directly
There's no longer need to have test_attr__open inside sys_perf_event_open call, because both record and stat call evsel__open_cpu, so we can call it directly from there and not polute perf-sys.h header.
--- tools/perf/perf-sys.h | 22 ++-------------------- tools/perf/tests/attr.c | 2 +- tools/perf/util/evsel.c | 5 +++++ tools/perf/util/util.h | 6 ++++++ 4 files changed, 14 insertions(+), 21 deletions(-)
tools/perf/perf-sys.h +2 -20
@@ -9,31 +9,13 @@struct perf_event_attr ; -extern bool test_attr__enabled; -void test_attr__ready (void ); -void test_attr__init (void ); -void test_attr__open (struct perf_event_attr *attr,pid_t pid,int cpu, -int fd,int group_fd,unsigned long flags); - -#ifndef HAVE_ATTR_TEST -#define HAVE_ATTR_TEST 1 -#endif -static inline int sys_perf_event_open (struct perf_event_attr *attr,pid_t pid,int cpu,int group_fd,unsigned long flags) { -int fd; - - fd =syscall (__NR_perf_event_open, attr, pid, cpu, - group_fd, flags); - -#if HAVE_ATTR_TEST -if (unlikely (test_attr__enabled)) -test_attr__open (attr, pid, cpu, fd, group_fd, flags); -#endif -return fd; +return syscall (__NR_perf_event_open, attr, pid, cpu, + group_fd, flags); }#endif /* _PERF_SYS_H */
tools/perf/tests/attr.c +1 -1
@@ -30,9 +30,9 @@#include <sys/types.h> #include <sys/stat.h> #include <unistd.h> -#include "../perf-sys.h" #include <subcmd/exec-cmd.h> #include "event.h" +#include "util.h" #include "tests.h" #define ENV "PERF_TEST_ATTR"
tools/perf/util/evsel.c +5 -0
@@ -1680,6 +1680,11 @@ static int evsel__open_cpu(struct evsel *evsel, struct perf_cpu_map *cpus,FD (evsel, cpu, thread) = fd; +if (unlikely (test_attr__enabled)) { +test_attr__open (&evsel->core.attr, pid, cpus->map[cpu], + fd, group_fd, flags); + } +if (fd <0 ) { err = -errno;
tools/perf/util/util.h +6 -0
@@ -62,4 +62,10 @@ char *perf_exe(char *buf, int len);#endif #endif +extern bool test_attr__enabled; +void test_attr__ready (void ); +void test_attr__init (void ); +struct perf_event_attr ; +void test_attr__open (struct perf_event_attr *attr,pid_t pid,int cpu, +int fd,int group_fd,unsigned long flags);#endif /* GIT_COMPAT_UTIL_H */
Signature · 1 line
2.26.2
PATCH v2 1/1 perf tools: Call test_attr__open directly
nack.. forgot python header change :-\ v2 attached
thanks,
jirka
---
There's no longer need to have test_attr__open inside sys_perf_event_open call, because both record and stat call evsel__open_cpu, so we can call it directly from there and not polute perf-sys.h header.
--- tools/perf/perf-sys.h | 22 ++-------------------- tools/perf/tests/attr.c | 2 +- tools/perf/util/evsel.c | 5 +++++ tools/perf/util/python.c | 2 +- tools/perf/util/util.h | 6 ++++++ 5 files changed, 15 insertions(+), 22 deletions(-)
tools/perf/perf-sys.h +2 -20
@@ -9,31 +9,13 @@struct perf_event_attr ; -extern bool test_attr__enabled; -void test_attr__ready (void ); -void test_attr__init (void ); -void test_attr__open (struct perf_event_attr *attr,pid_t pid,int cpu, -int fd,int group_fd,unsigned long flags); - -#ifndef HAVE_ATTR_TEST -#define HAVE_ATTR_TEST 1 -#endif -static inline int sys_perf_event_open (struct perf_event_attr *attr,pid_t pid,int cpu,int group_fd,unsigned long flags) { -int fd; - - fd =syscall (__NR_perf_event_open, attr, pid, cpu, - group_fd, flags); - -#if HAVE_ATTR_TEST -if (unlikely (test_attr__enabled)) -test_attr__open (attr, pid, cpu, fd, group_fd, flags); -#endif -return fd; +return syscall (__NR_perf_event_open, attr, pid, cpu, + group_fd, flags); }#endif /* _PERF_SYS_H */
tools/perf/tests/attr.c +1 -1
@@ -30,9 +30,9 @@#include <sys/types.h> #include <sys/stat.h> #include <unistd.h> -#include "../perf-sys.h" #include <subcmd/exec-cmd.h> #include "event.h" +#include "util.h" #include "tests.h" #define ENV "PERF_TEST_ATTR"
tools/perf/util/evsel.c +5 -0
@@ -1680,6 +1680,11 @@ static int evsel__open_cpu(struct evsel *evsel, struct perf_cpu_map *cpus,FD (evsel, cpu, thread) = fd; +if (unlikely (test_attr__enabled)) { +test_attr__open (&evsel->core.attr, pid, cpus->map[cpu], + fd, group_fd, flags); + } +if (fd <0 ) { err = -errno;
tools/perf/util/python.c +1 -1
@@ -17,7 +17,7 @@#include "mmap.h" #include "util/env.h" #include <internal/lib.h> -#include "../perf-sys.h" +#include "util.h" #if PY_MAJOR_VERSION <3 #define _PyUnicode_FromString (arg) \
tools/perf/util/util.h +6 -0
@@ -62,4 +62,10 @@ char *perf_exe(char *buf, int len);#endif #endif +extern bool test_attr__enabled; +void test_attr__ready (void ); +void test_attr__init (void ); +struct perf_event_attr ; +void test_attr__open (struct perf_event_attr *attr,pid_t pid,int cpu, +int fd,int group_fd,unsigned long flags);#endif /* GIT_COMPAT_UTIL_H */
Signature · 1 line
2.26.2
Re: [PATCHv2] perf tools: Call test_attr__open directly
Em Thu, Aug 27, 2020 at 09:32:01PM +0200, Jiri Olsa escreveu:
Quoted 4 lines
nack.. forgot python header change :-\ v2 attached
thanks,
jirka
Thanks, applied.
Quoted 116 lines
---
There's no longer need to havetest_attr__openinsidesys_perf_event_opencall, because both record and stat callevsel__open_cpu, so we can call it directly from there and not poluteperf-sys.hheader.Signed-off-by Jiri Olsa <[email protected]>--- tools/perf/perf-sys.h | 22 ++-------------------- tools/perf/tests/attr.c | 2 +- tools/perf/util/evsel.c | 5 +++++ tools/perf/util/python.c | 2 +- tools/perf/util/util.h | 6 ++++++ 5 files changed, 15 insertions(+), 22 deletions(-)tools/perf/perf-sys.h +2
-20@@ -9,31 +9,13 @@struct perf_event_attr ; -extern bool test_attr__enabled; -void test_attr__ready (void ); -void test_attr__init (void ); -void test_attr__open (struct perf_event_attr *attr,pid_t pid,int cpu, -int fd,int group_fd,unsigned long flags); - -#ifndef HAVE_ATTR_TEST -#define HAVE_ATTR_TEST 1 -#endif -static inline int sys_perf_event_open (struct perf_event_attr *attr,pid_t pid,int cpu,int group_fd,unsigned long flags) { -int fd; - - fd =syscall (__NR_perf_event_open, attr, pid, cpu, - group_fd, flags); - -#if HAVE_ATTR_TEST -if (unlikely (test_attr__enabled)) -test_attr__open (attr, pid, cpu, fd, group_fd, flags); -#endif -return fd; +return syscall (__NR_perf_event_open, attr, pid, cpu, + group_fd, flags); }#endif /* _PERF_SYS_H */ tools/perf/tests/attr.c +1
-1@@ -30,9 +30,9 @@#include <sys/types.h> #include <sys/stat.h> #include <unistd.h> -#include "../perf-sys.h" #include <subcmd/exec-cmd.h> #include "event.h" +#include "util.h" #include "tests.h" #define ENV "PERF_TEST_ATTR"tools/perf/util/evsel.c +5
-0@@ -1680,6 +1680,11 @@ static int evsel__open_cpu(struct evsel *evsel, struct perf_cpu_map *cpus,FD (evsel, cpu, thread) = fd; +if (unlikely (test_attr__enabled)) { +test_attr__open (&evsel->core.attr, pid, cpus->map[cpu], + fd, group_fd, flags); + } +if (fd <0 ) { err = -errno;tools/perf/util/python.c +1
-1@@ -17,7 +17,7 @@#include "mmap.h" #include "util/env.h" #include <internal/lib.h> -#include "../perf-sys.h" +#include "util.h" #if PY_MAJOR_VERSION <3 #define _PyUnicode_FromString (arg) \tools/perf/util/util.h +6
-0@@ -62,4 +62,10 @@ char *perf_exe(char *buf, int len);#endif #endif +extern bool test_attr__enabled; +void test_attr__ready (void ); +void test_attr__init (void ); +struct perf_event_attr ; +void test_attr__open (struct perf_event_attr *attr,pid_t pid,int cpu, +int fd,int group_fd,unsigned long flags);#endif /* GIT_COMPAT_UTIL_H */ Signature · 1 line
2.26.2
Signature · 1 line
- Arnaldo
Em Thu, Aug 27, 2020 at 03:48:29PM +0200, Jiri Olsa escreveu:
Quoted 3 lines
Disable
ordered_eventsfor report raw dump, because for raw dump we want to see events as they are stored in the perf.data file, not sorted by time.
Applied to perf/urgent,
Thanks,
- Arnaldo
Quoted 22 lines
Signed-off-by Jiri Olsa <[email protected]>--- tools/perf/builtin-report.c | 3 +++ 1 file changed, 3 insertions(+)tools/perf/builtin-report.c +3
-0@@ -1332,6 +1332,9 @@ int cmd_report(int argc, const char **argv)if (report.mmaps_mode) report.tasks_mode = true; +if (dump_trace) + report.tool.ordered_events = false; +if (quiet)perf_quiet_option ();Signature · 1 line
2.26.2
Signature · 1 line
- Arnaldo