From: jolsa@redhat.com (Jiri Olsa)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 5/9] perf utils: add support for arch standard events
Date: Thu, 8 Feb 2018 14:54:59 +0100 [thread overview]
Message-ID: <20180208135459.GF10234@krava> (raw)
In-Reply-To: <1517939104-230881-6-git-send-email-john.garry@huawei.com>
On Wed, Feb 07, 2018 at 01:45:00AM +0800, John Garry wrote:
SNIP
> /* Call func with each event in the json file */
> int json_events(const char *fn,
> int (*func)(void *data, char *name, char *event, char *desc,
> @@ -442,6 +550,7 @@ int json_events(const char *fn,
> char *metric_expr = NULL;
> char *metric_name = NULL;
> char *metric_group = NULL;
> + char *arch_std = NULL;
> unsigned long long eventcode = 0;
> struct msrmap *msr = NULL;
> jsmntok_t *msrval = NULL;
> @@ -527,6 +636,10 @@ int json_events(const char *fn,
> addfield(map, &metric_expr, "", "", val);
> for (s = metric_expr; *s; s++)
> *s = tolower(*s);
> + } else if (json_streq(map, field, "ArchStdEvent")) {
> + addfield(map, &arch_std, "", "", val);
> + for (s = arch_std; *s; s++)
> + *s = tolower(*s);
> }
> /* ignore unknown fields */
> }
> @@ -538,7 +651,7 @@ int json_events(const char *fn,
> addfield(map, &extra_desc, " ",
> "(Precise event)", NULL);
> }
> - snprintf(buf, sizeof buf, "event=%#llx", eventcode);
> + snprintf(buf, sizeof(buf), "%s%#llx", EVENT_PREFIX, eventcode);
> addfield(map, &event, ",", buf, NULL);
> if (desc && extra_desc)
> addfield(map, &desc, " ", extra_desc, NULL);
> @@ -550,9 +663,21 @@ int json_events(const char *fn,
> addfield(map, &event, ",", msr->pname, msrval);
> if (name)
> fixname(name);
> -
> - err = func(data, name, real_event(name, event), desc, long_desc,
> - pmu, unit, perpkg, metric_expr, metric_name, metric_group);
> + err = 0;
> + if (arch_std) {
> + /*
> + * An arch standard event is referenced, so try to
> + * fixup any unassigned values.
> + */
> + err = try_fixup(fn, arch_std, &event, &desc, &name,
> + &long_desc, &pmu, &filter, &perpkg,
> + &unit, &metric_expr, &metric_name,
> + &metric_group);
> + }
> + if (!err)
> + err = func(data, name, real_event(name, event), desc,
> + long_desc, pmu, unit, perpkg, metric_expr,
> + metric_name, metric_group);
> free(event);
> free(desc);
> free(name);
> @@ -565,6 +690,7 @@ int json_events(const char *fn,
> free(metric_expr);
> free(metric_name);
> free(metric_group);
> +
should you call free(arch_std) in here?
jirka
next prev parent reply other threads:[~2018-02-08 13:54 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-06 17:44 [PATCH 0/9] perf events patches for improved ARM64 support John Garry
2018-02-06 17:44 ` [PATCH 1/9] perf vendor events: drop incomplete multiple mapfile support John Garry
2018-02-08 13:55 ` Jiri Olsa
2018-02-06 17:44 ` [PATCH 2/9] perf utils: add support for pmu events vendor sub-directory John Garry
2018-02-08 13:55 ` Jiri Olsa
2018-02-06 17:44 ` [PATCH 3/9] perf vendor events arm64: Relocate ThunderX2 JSON John Garry
2018-02-06 17:44 ` [PATCH 4/9] perf vendor events arm64: Relocate Cortex A53 JSONs John Garry
2018-02-06 17:45 ` [PATCH 5/9] perf utils: add support for arch standard events John Garry
2018-02-08 13:54 ` Jiri Olsa
2018-02-08 15:57 ` John Garry
2018-02-08 13:54 ` Jiri Olsa
2018-02-08 13:54 ` Jiri Olsa
2018-02-08 14:02 ` Alan Cox
2018-02-08 15:31 ` John Garry
2018-02-08 13:54 ` Jiri Olsa
2018-02-08 13:54 ` Jiri Olsa
2018-02-08 13:54 ` Jiri Olsa [this message]
2018-02-08 13:55 ` Jiri Olsa
2018-02-08 14:45 ` John Garry
2018-02-08 14:54 ` Jiri Olsa
2018-02-08 13:55 ` Jiri Olsa
2018-02-08 13:55 ` Jiri Olsa
2018-02-08 15:25 ` John Garry
2018-02-09 8:53 ` Jiri Olsa
2018-02-08 13:55 ` Jiri Olsa
2018-02-08 14:59 ` John Garry
2018-02-06 17:45 ` [PATCH 6/9] perf utils: add armv8-recommended.json John Garry
2018-02-06 17:45 ` [PATCH 7/9] perf utils: fixup Cavium ThunderX2 JSON to use ARMv8 recommended events John Garry
2018-02-06 17:45 ` [PATCH 8/9] perf utils: fixup ARM Cortex A53 JSONs " John Garry
2018-02-06 17:45 ` [PATCH 9/9] perf utils: add HiSilicon hip08 JSON file John Garry
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=20180208135459.GF10234@krava \
--to=jolsa@redhat.com \
--cc=linux-arm-kernel@lists.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).