From: Jin Yao <yao.jin@linux.intel.com>
To: acme@kernel.org, jolsa@kernel.org, peterz@infradead.org,
mingo@redhat.com, alexander.shishkin@linux.intel.com
Cc: Linux-kernel@vger.kernel.org, ak@linux.intel.com,
kan.liang@intel.com, yao.jin@intel.com,
Jin Yao <yao.jin@linux.intel.com>
Subject: [PATCH v2 2/2] perf test: Add test case for group members
Date: Mon, 25 May 2020 14:55:59 +0800 [thread overview]
Message-ID: <20200525065559.6422-2-yao.jin@linux.intel.com> (raw)
In-Reply-To: <20200525065559.6422-1-yao.jin@linux.intel.com>
The evlist may consist of some event + group combinations.
For example, perf stat -e "A,{B,C},D".
This patch testes the event in evlist to see if it has the
correct leader and correct nr_members.
Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
---
tools/perf/tests/parse-events.c | 35 ++++++++++++++++++++++++++++++++-
1 file changed, 34 insertions(+), 1 deletion(-)
diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c
index 895188b63f96..d584b77c878d 100644
--- a/tools/perf/tests/parse-events.c
+++ b/tools/perf/tests/parse-events.c
@@ -1386,6 +1386,34 @@ static int test__sym_event_dc(struct evlist *evlist)
return 0;
}
+static int test__mixed_group(struct evlist *evlist)
+{
+ struct evsel *evsel, *leader;
+
+ TEST_ASSERT_VAL("wrong number of entries", 4 == evlist->core.nr_entries);
+
+ /* cycles - leader is also itself */
+ evsel = leader = evlist__first(evlist);
+ TEST_ASSERT_VAL("wrong leader", evsel->leader == leader);
+ TEST_ASSERT_VAL("wrong nr_members", 0 == evsel->core.nr_members);
+
+ /* {cache-misses,branch-misses} - leader is cache-misses */
+ evsel = leader = evsel__next(evsel);
+ TEST_ASSERT_VAL("wrong leader", evsel->leader == leader);
+ TEST_ASSERT_VAL("wrong nr_members", 2 == evsel->core.nr_members);
+
+ evsel = evsel__next(evsel);
+ TEST_ASSERT_VAL("wrong leader", evsel->leader == leader);
+ TEST_ASSERT_VAL("wrong nr_members", 0 == evsel->core.nr_members);
+
+ /* instructions - leader is also itself */
+ evsel = leader = evlist__first(evlist);
+ TEST_ASSERT_VAL("wrong leader", evsel->leader == leader);
+ TEST_ASSERT_VAL("wrong nr_members", 0 == evsel->core.nr_members);
+
+ return 0;
+}
+
static int count_tracepoints(void)
{
struct dirent *events_ent;
@@ -1737,7 +1765,12 @@ static struct evlist_test test__events[] = {
.name = "cycles:k",
.check = test__sym_event_dc,
.id = 55,
- }
+ },
+ {
+ .name = "cycles,{cache-misses,branch-misses},instructions",
+ .check = test__mixed_group,
+ .id = 56,
+ },
};
static struct evlist_test test__events_pmu[] = {
--
2.17.1
next prev parent reply other threads:[~2020-05-25 6:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-25 6:55 [PATCH v2 1/2] perf evlist: Ensure grouped events with same cpu map Jin Yao
2020-05-25 6:55 ` Jin Yao [this message]
2020-05-26 11:51 ` Jiri Olsa
2020-05-27 3:20 ` Jin, Yao
2020-05-27 6:31 ` Jin, Yao
2020-05-27 7:26 ` Jin, Yao
2020-05-27 10:28 ` Jiri Olsa
2020-05-27 13:49 ` Jin, Yao
2020-05-27 16:28 ` Jiri Olsa
2020-05-28 1:47 ` Jin, Yao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200525065559.6422-2-yao.jin@linux.intel.com \
--to=yao.jin@linux.intel.com \
--cc=Linux-kernel@vger.kernel.org \
--cc=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@intel.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=yao.jin@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).