* [PATCH 1/2] perf tools: Disable ordered_events for report raw dump
@ 2020-08-27 13:48 Jiri Olsa
2020-08-27 13:48 ` [PATCH 2/2] perf tools: Call test_attr__open directly Jiri Olsa
2020-09-01 15:12 ` [PATCH 1/2] perf tools: Disable ordered_events for report raw dump Arnaldo Carvalho de Melo
0 siblings, 2 replies; 5+ messages in thread
From: Jiri Olsa @ 2020-08-27 13:48 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: lkml, Ingo Molnar, Namhyung Kim, Alexander Shishkin,
Peter Zijlstra, Michael Petlan, Ian Rogers
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.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/perf/builtin-report.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index ece1cddfcd7c..3c74c9c0f3c3 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -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();
--
2.26.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] perf tools: Call test_attr__open directly
2020-08-27 13:48 [PATCH 1/2] perf tools: Disable ordered_events for report raw dump Jiri Olsa
@ 2020-08-27 13:48 ` Jiri Olsa
2020-08-27 19:32 ` [PATCHv2] " Jiri Olsa
2020-09-01 15:12 ` [PATCH 1/2] perf tools: Disable ordered_events for report raw dump Arnaldo Carvalho de Melo
1 sibling, 1 reply; 5+ messages in thread
From: Jiri Olsa @ 2020-08-27 13:48 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: lkml, Ingo Molnar, Namhyung Kim, Alexander Shishkin,
Peter Zijlstra, Michael Petlan, Ian Rogers
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.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
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(-)
diff --git a/tools/perf/perf-sys.h b/tools/perf/perf-sys.h
index 15e458e150bd..7a2264e1e4e1 100644
--- a/tools/perf/perf-sys.h
+++ b/tools/perf/perf-sys.h
@@ -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 */
diff --git a/tools/perf/tests/attr.c b/tools/perf/tests/attr.c
index a9599ab8c471..ec972e0892ab 100644
--- a/tools/perf/tests/attr.c
+++ b/tools/perf/tests/attr.c
@@ -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"
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index fd865002cbbd..6f0e23105cf8 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -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;
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index f486fdd3a538..ad737052e597 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -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 */
--
2.26.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCHv2] perf tools: Call test_attr__open directly
2020-08-27 13:48 ` [PATCH 2/2] perf tools: Call test_attr__open directly Jiri Olsa
@ 2020-08-27 19:32 ` Jiri Olsa
2020-09-10 14:59 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 5+ messages in thread
From: Jiri Olsa @ 2020-08-27 19:32 UTC (permalink / raw)
To: Jiri Olsa
Cc: Arnaldo Carvalho de Melo, lkml, Ingo Molnar, Namhyung Kim,
Alexander Shishkin, Peter Zijlstra, Michael Petlan, Ian Rogers
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.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
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(-)
diff --git a/tools/perf/perf-sys.h b/tools/perf/perf-sys.h
index 15e458e150bd..7a2264e1e4e1 100644
--- a/tools/perf/perf-sys.h
+++ b/tools/perf/perf-sys.h
@@ -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 */
diff --git a/tools/perf/tests/attr.c b/tools/perf/tests/attr.c
index a9599ab8c471..ec972e0892ab 100644
--- a/tools/perf/tests/attr.c
+++ b/tools/perf/tests/attr.c
@@ -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"
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index fd865002cbbd..6f0e23105cf8 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -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;
diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c
index 75a9b1d62bba..74f85948d101 100644
--- a/tools/perf/util/python.c
+++ b/tools/perf/util/python.c
@@ -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) \
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index f486fdd3a538..ad737052e597 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -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 */
--
2.26.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] perf tools: Disable ordered_events for report raw dump
2020-08-27 13:48 [PATCH 1/2] perf tools: Disable ordered_events for report raw dump Jiri Olsa
2020-08-27 13:48 ` [PATCH 2/2] perf tools: Call test_attr__open directly Jiri Olsa
@ 2020-09-01 15:12 ` Arnaldo Carvalho de Melo
1 sibling, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2020-09-01 15:12 UTC (permalink / raw)
To: Jiri Olsa
Cc: lkml, Ingo Molnar, Namhyung Kim, Alexander Shishkin,
Peter Zijlstra, Michael Petlan, Ian Rogers
Em Thu, Aug 27, 2020 at 03:48:29PM +0200, Jiri Olsa escreveu:
> 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.
Applied to perf/urgent,
Thanks,
- Arnaldo
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> ---
> tools/perf/builtin-report.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
> index ece1cddfcd7c..3c74c9c0f3c3 100644
> --- a/tools/perf/builtin-report.c
> +++ b/tools/perf/builtin-report.c
> @@ -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();
>
> --
> 2.26.2
>
--
- Arnaldo
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCHv2] perf tools: Call test_attr__open directly
2020-08-27 19:32 ` [PATCHv2] " Jiri Olsa
@ 2020-09-10 14:59 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2020-09-10 14:59 UTC (permalink / raw)
To: Jiri Olsa
Cc: Jiri Olsa, lkml, Ingo Molnar, Namhyung Kim, Alexander Shishkin,
Peter Zijlstra, Michael Petlan, Ian Rogers
Em Thu, Aug 27, 2020 at 09:32:01PM +0200, Jiri Olsa escreveu:
> nack.. forgot python header change :-\ v2 attached
>
> thanks,
> jirka
Thanks, applied.
>
> ---
> 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.
>
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> ---
> 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(-)
>
> diff --git a/tools/perf/perf-sys.h b/tools/perf/perf-sys.h
> index 15e458e150bd..7a2264e1e4e1 100644
> --- a/tools/perf/perf-sys.h
> +++ b/tools/perf/perf-sys.h
> @@ -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 */
> diff --git a/tools/perf/tests/attr.c b/tools/perf/tests/attr.c
> index a9599ab8c471..ec972e0892ab 100644
> --- a/tools/perf/tests/attr.c
> +++ b/tools/perf/tests/attr.c
> @@ -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"
> diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
> index fd865002cbbd..6f0e23105cf8 100644
> --- a/tools/perf/util/evsel.c
> +++ b/tools/perf/util/evsel.c
> @@ -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;
>
> diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c
> index 75a9b1d62bba..74f85948d101 100644
> --- a/tools/perf/util/python.c
> +++ b/tools/perf/util/python.c
> @@ -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) \
> diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
> index f486fdd3a538..ad737052e597 100644
> --- a/tools/perf/util/util.h
> +++ b/tools/perf/util/util.h
> @@ -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 */
> --
> 2.26.2
>
--
- Arnaldo
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-09-10 20:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-27 13:48 [PATCH 1/2] perf tools: Disable ordered_events for report raw dump Jiri Olsa
2020-08-27 13:48 ` [PATCH 2/2] perf tools: Call test_attr__open directly Jiri Olsa
2020-08-27 19:32 ` [PATCHv2] " Jiri Olsa
2020-09-10 14:59 ` Arnaldo Carvalho de Melo
2020-09-01 15:12 ` [PATCH 1/2] perf tools: Disable ordered_events for report raw dump Arnaldo Carvalho de Melo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).