Commit d9da6f70 authored by Jin Yao's avatar Jin Yao Committed by Arnaldo Carvalho de Melo

perf tests: Support 'Convert perf time to TSC' test for hybrid

Since for "cycles:u' on hybrid platform, it creates two "cycles".  So
the second evsel in evlist also needs initialization.

With this patch,

  # ./perf test 71
  71: Convert perf time to TSC                                        : Ok
Signed-off-by: default avatarJin Yao <yao.jin@linux.intel.com>
Reviewed-by: default avatarJiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20210427070139.25256-25-yao.jin@linux.intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent c1020388
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "tsc.h" #include "tsc.h"
#include "mmap.h" #include "mmap.h"
#include "tests.h" #include "tests.h"
#include "pmu.h"
#define CHECK__(x) { \ #define CHECK__(x) { \
while ((x) < 0) { \ while ((x) < 0) { \
...@@ -88,6 +89,17 @@ int test__perf_time_to_tsc(struct test *test __maybe_unused, int subtest __maybe ...@@ -88,6 +89,17 @@ int test__perf_time_to_tsc(struct test *test __maybe_unused, int subtest __maybe
evsel->core.attr.disabled = 1; evsel->core.attr.disabled = 1;
evsel->core.attr.enable_on_exec = 0; evsel->core.attr.enable_on_exec = 0;
/*
* For hybrid "cycles:u", it creates two events.
* Init the second evsel here.
*/
if (perf_pmu__has_hybrid()) {
evsel = evsel__next(evsel);
evsel->core.attr.comm = 1;
evsel->core.attr.disabled = 1;
evsel->core.attr.enable_on_exec = 0;
}
CHECK__(evlist__open(evlist)); CHECK__(evlist__open(evlist));
CHECK__(evlist__mmap(evlist, UINT_MAX)); CHECK__(evlist__mmap(evlist, UINT_MAX));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment