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

perf tests: Support 'Session topology' test for hybrid

Force to create one event "cpu_core/cycles/" by default, otherwise in
evlist__valid_sample_type, the checking of 'if (evlist->core.nr_entries
== 1)' would be failed.

  # ./perf test 41
  41: Session topology                                                : 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-24-yao.jin@linux.intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 6081e876
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "session.h" #include "session.h"
#include "evlist.h" #include "evlist.h"
#include "debug.h" #include "debug.h"
#include "pmu.h"
#include <linux/err.h> #include <linux/err.h>
#define TEMPL "/tmp/perf-test-XXXXXX" #define TEMPL "/tmp/perf-test-XXXXXX"
...@@ -40,8 +41,16 @@ static int session_write_header(char *path) ...@@ -40,8 +41,16 @@ static int session_write_header(char *path)
session = perf_session__new(&data, false, NULL); session = perf_session__new(&data, false, NULL);
TEST_ASSERT_VAL("can't get session", !IS_ERR(session)); TEST_ASSERT_VAL("can't get session", !IS_ERR(session));
session->evlist = evlist__new_default(); if (!perf_pmu__has_hybrid()) {
TEST_ASSERT_VAL("can't get evlist", session->evlist); session->evlist = evlist__new_default();
TEST_ASSERT_VAL("can't get evlist", session->evlist);
} else {
struct parse_events_error err;
session->evlist = evlist__new();
TEST_ASSERT_VAL("can't get evlist", session->evlist);
parse_events(session->evlist, "cpu_core/cycles/", &err);
}
perf_header__set_feat(&session->header, HEADER_CPU_TOPOLOGY); perf_header__set_feat(&session->header, HEADER_CPU_TOPOLOGY);
perf_header__set_feat(&session->header, HEADER_NRCPUS); perf_header__set_feat(&session->header, HEADER_NRCPUS);
......
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