linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Alexey Budankov <alexey.budankov@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@kernel.org>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Namhyung Kim <namhyung@kernel.org>,
	Andi Kleen <ak@linux.intel.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v3]: perf record: enable arbitrary event names thru name= modifier
Date: Mon, 4 Jun 2018 16:16:59 -0300	[thread overview]
Message-ID: <20180604191659.GM3397@kernel.org> (raw)
In-Reply-To: <80a37269-e54d-0992-712a-ee72555a04d4@linux.intel.com>

Em Mon, Jun 04, 2018 at 06:22:43PM +0300, Alexey Budankov escreveu:
> On 04.06.2018 17:58, Arnaldo Carvalho de Melo wrote:
> > Em Mon, Jun 04, 2018 at 05:51:03PM +0300, Alexey Budankov escreveu:
> >> event names quoted there. If such cases were pointed out then they also 
> >> could be addressed along with the unit/regression testing mentioned above.

> > So lests stick to just the unit/regression testing, can you take a look
> > at that?
 
> Sure. Is it enough to run perf record with some quoted event name to make 
> sure it runs successfully?

I mentioned tools/perf/tests/attr/, for checking if the perf_event_attr
was setup the way you intended, and tools/perf/tests/parse-events.c,
which probably is what we want here, see, for instance, this cset I've
added recently to have we testing intel_pt event parsing:

$ git show b3f58c8da64bc63bd0c0a06a4e2cf258a3d20be6
commit b3f58c8da64bc63bd0c0a06a4e2cf258a3d20be6
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
Date:   Fri May 11 11:48:54 2018 -0300

    perf tests parse-events: Add intel_pt parse test
    
    To avoid regressions such as the one fixed by 4a35a9027f64 ("Revert
    "perf pmu: Fix pmu events parsing rule""), where '-e intel_pt//u' got
    broken, with this new entry in this 'perf tests' subtest, we would have
    caught it before pushing upstream.
    
    Acked-by: Jiri Olsa <jolsa@kernel.org>
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Andi Kleen <ak@linux.intel.com>
    Cc: David Ahern <dsahern@gmail.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Kan Liang <kan.liang@linux.intel.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Wang Nan <wangnan0@huawei.com>
    Link: https://lkml.kernel.org/n/tip-kw62fys9bwdgsp722so2ln1l@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c
index 18b06444f230..6829dd416a99 100644
--- a/tools/perf/tests/parse-events.c
+++ b/tools/perf/tests/parse-events.c
@@ -1309,6 +1309,14 @@ static int test__checkevent_config_cache(struct perf_evlist *evlist)
 	return 0;
 }
 
+static int test__intel_pt(struct perf_evlist *evlist)
+{
+	struct perf_evsel *evsel = perf_evlist__first(evlist);
+
+	TEST_ASSERT_VAL("wrong name setting", strcmp(evsel->name, "intel_pt//u") == 0);
+	return 0;
+}
+
 static int count_tracepoints(void)
 {
 	struct dirent *events_ent;
@@ -1637,6 +1645,11 @@ static struct evlist_test test__events[] = {
 		.check = test__checkevent_config_cache,
 		.id    = 51,
 	},
+	{
+		.name  = "intel_pt//u",
+		.check = test__intel_pt,
+		.id    = 52,
+	},
 };
 
 static struct evlist_test test__events_pmu[] = {

See also this one:

static int
test__checkevent_breakpoint_len_rw_modifier(struct perf_evlist *evlist)
{
        struct perf_evsel *evsel = perf_evlist__first(evlist);

        TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user);
        TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel);
        TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv);
        TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip);

        return test__checkevent_breakpoint_rw(evlist);
}
        {
                .name  = "mem:0/4:rw:u",
                .check = test__checkevent_breakpoint_len_rw_modifier,
                .id    = 44
        },


I.e. have as many TEST_ASSERT_VAL as you need, checking how parsing the
event name ends up setting up the evsel, evlist and perf_event_attr.

- Arnaldo

  reply	other threads:[~2018-06-04 19:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-04  6:50 [PATCH v3]: perf record: enable arbitrary event names thru name= modifier Alexey Budankov
2018-06-04  7:56 ` Jiri Olsa
2018-06-04 13:58   ` Arnaldo Carvalho de Melo
2018-06-04 14:19     ` Alexey Budankov
2018-06-04 14:23       ` Arnaldo Carvalho de Melo
2018-06-04 14:51         ` Alexey Budankov
2018-06-04 14:58           ` Arnaldo Carvalho de Melo
2018-06-04 15:22             ` Alexey Budankov
2018-06-04 19:16               ` Arnaldo Carvalho de Melo [this message]
2018-06-05  6:00                 ` Alexey Budankov
2018-06-05 15:33                   ` Arnaldo Carvalho de Melo

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=20180604191659.GM3397@kernel.org \
    --to=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=alexey.budankov@linux.intel.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    /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).