[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170526123141.20900-2-jolsa@kernel.org>
Date: Fri, 26 May 2017 14:31:41 +0200
From: Jiri Olsa <jolsa@...nel.org>
To: Arnaldo Carvalho de Melo <acme@...nel.org>
Cc: lkml <linux-kernel@...r.kernel.org>,
Ingo Molnar <mingo@...nel.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Namhyung Kim <namhyung@...nel.org>,
David Ahern <dsahern@...il.com>,
Andi Kleen <ak@...ux.intel.com>
Subject: [PATCH 2/2] perf tests: Rename cycles event to HW event
The 'hardware' suits better now when we could also
use instructions event in addition to cycles.
Link: http://lkml.kernel.org/n/tip-rfaab0tmwh6oepsqtm75z946@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@...nel.org>
---
tools/perf/tests/switch-tracking.c | 64 +++++++++++++++++++-------------------
1 file changed, 32 insertions(+), 32 deletions(-)
diff --git a/tools/perf/tests/switch-tracking.c b/tools/perf/tests/switch-tracking.c
index e519819ea2e5..bce1056ecdde 100644
--- a/tools/perf/tests/switch-tracking.c
+++ b/tools/perf/tests/switch-tracking.c
@@ -52,13 +52,13 @@ static int spin_sleep(void)
struct switch_tracking {
struct perf_evsel *switch_evsel;
- struct perf_evsel *cycles_evsel;
+ struct perf_evsel *hw_evsel;
pid_t *tids;
int nr_tids;
int comm_seen[4];
- int cycles_before_comm_1;
- int cycles_between_comm_2_and_comm_3;
- int cycles_after_comm_4;
+ int hw_before_comm_1;
+ int hw_between_comm_2_and_comm_3;
+ int hw_after_comm_4;
};
static int check_comm(struct switch_tracking *switch_tracking,
@@ -148,15 +148,15 @@ static int process_sample_event(struct perf_evlist *evlist,
switch_tracking->tids[cpu] = next_tid;
}
- if (evsel == switch_tracking->cycles_evsel) {
- pr_debug3("cycles event\n");
+ if (evsel == switch_tracking->hw_evsel) {
+ pr_debug3("hw event\n");
if (!switch_tracking->comm_seen[0])
- switch_tracking->cycles_before_comm_1 = 1;
+ switch_tracking->hw_before_comm_1 = 1;
if (switch_tracking->comm_seen[1] &&
!switch_tracking->comm_seen[2])
- switch_tracking->cycles_between_comm_2_and_comm_3 = 1;
+ switch_tracking->hw_between_comm_2_and_comm_3 = 1;
if (switch_tracking->comm_seen[3])
- switch_tracking->cycles_after_comm_4 = 1;
+ switch_tracking->hw_after_comm_4 = 1;
}
return 0;
@@ -316,7 +316,7 @@ static const char *get_hw_counter(void)
if (!strcmp("GenuineIntel-15-4", cpuid))
counter = "instructions:u";
- pr_debug("using '%s' HW counter");
+ pr_debug("using '%s' as HW counter", counter);
return counter;
}
@@ -345,7 +345,7 @@ int test__switch_tracking(int subtest __maybe_unused)
struct thread_map *threads = NULL;
struct cpu_map *cpus = NULL;
struct perf_evlist *evlist = NULL;
- struct perf_evsel *evsel, *cpu_clocks_evsel, *cycles_evsel;
+ struct perf_evsel *evsel, *cpu_clocks_evsel, *hw_evsel;
struct perf_evsel *switch_evsel, *tracking_evsel;
const char *comm;
int err = -1;
@@ -386,7 +386,7 @@ int test__switch_tracking(int subtest __maybe_unused)
goto out_err;
}
- cycles_evsel = perf_evlist__last(evlist);
+ hw_evsel = perf_evlist__last(evlist);
/* Third event */
if (!perf_evlist__can_select_event(evlist, sched_switch)) {
@@ -411,18 +411,18 @@ int test__switch_tracking(int subtest __maybe_unused)
switch_evsel->immediate = true;
/* Test moving an event to the front */
- if (cycles_evsel == perf_evlist__first(evlist)) {
- pr_debug("cycles event already at front");
+ if (hw_evsel == perf_evlist__first(evlist)) {
+ pr_debug("HW event already at front");
goto out_err;
}
- perf_evlist__to_front(evlist, cycles_evsel);
- if (cycles_evsel != perf_evlist__first(evlist)) {
- pr_debug("Failed to move cycles event to front");
+ perf_evlist__to_front(evlist, hw_evsel);
+ if (hw_evsel != perf_evlist__first(evlist)) {
+ pr_debug("Failed to move HW event to front");
goto out_err;
}
- perf_evsel__set_sample_bit(cycles_evsel, CPU);
- perf_evsel__set_sample_bit(cycles_evsel, TIME);
+ perf_evsel__set_sample_bit(hw_evsel, CPU);
+ perf_evsel__set_sample_bit(hw_evsel, TIME);
/* Fourth event */
err = parse_events(evlist, "dummy:u", NULL);
@@ -444,7 +444,7 @@ int test__switch_tracking(int subtest __maybe_unused)
perf_evlist__config(evlist, &opts, NULL);
/* Check moved event is still at the front */
- if (cycles_evsel != perf_evlist__first(evlist)) {
+ if (hw_evsel != perf_evlist__first(evlist)) {
pr_debug("Front event no longer at front");
goto out_err;
}
@@ -498,7 +498,7 @@ int test__switch_tracking(int subtest __maybe_unused)
goto out_err;
}
- err = perf_evsel__disable(cycles_evsel);
+ err = perf_evsel__disable(hw_evsel);
if (err) {
pr_debug("perf_evlist__disable_event failed!\n");
goto out_err;
@@ -524,7 +524,7 @@ int test__switch_tracking(int subtest __maybe_unused)
goto out_err;
}
- err = perf_evsel__enable(cycles_evsel);
+ err = perf_evsel__enable(hw_evsel);
if (err) {
pr_debug("perf_evlist__disable_event failed!\n");
goto out_err;
@@ -546,7 +546,7 @@ int test__switch_tracking(int subtest __maybe_unused)
perf_evlist__disable(evlist);
switch_tracking.switch_evsel = switch_evsel;
- switch_tracking.cycles_evsel = cycles_evsel;
+ switch_tracking.hw_evsel = hw_evsel;
err = process_events(evlist, &switch_tracking);
@@ -562,21 +562,21 @@ int test__switch_tracking(int subtest __maybe_unused)
goto out_err;
}
- /* Check cycles event got enabled */
- if (!switch_tracking.cycles_before_comm_1) {
- pr_debug("Missing cycles events\n");
+ /* Check HW event got enabled */
+ if (!switch_tracking.hw_before_comm_1) {
+ pr_debug("Missing HW events\n");
goto out_err;
}
- /* Check cycles event got disabled */
- if (switch_tracking.cycles_between_comm_2_and_comm_3) {
- pr_debug("cycles events even though event was disabled\n");
+ /* Check HW event got disabled */
+ if (switch_tracking.hw_between_comm_2_and_comm_3) {
+ pr_debug("HW events even though event was disabled\n");
goto out_err;
}
- /* Check cycles event got enabled again */
- if (!switch_tracking.cycles_after_comm_4) {
- pr_debug("Missing cycles events\n");
+ /* Check HW event got enabled again */
+ if (!switch_tracking.hw_after_comm_4) {
+ pr_debug("Missing HW events\n");
goto out_err;
}
out:
--
2.9.4
Powered by blists - more mailing lists