Re: [PATCH 8/9] perf, tools, test: Add test case for alias and JSON parsing v2

From: Jiri Olsa
Date: Wed Jul 09 2014 - 18:21:17 EST


On Fri, Jun 27, 2014 at 04:16:03PM -0700, Andi Kleen wrote:
> From: Andi Kleen <ak@xxxxxxxxxxxxxxx>
>
> Add a simple test case to perf test that runs perf download and parses
> all the available events, including json events.
>
> This needs adding an all event iterator to pmu.c
>

SNIP

> +
> +int pmu_iterate_events(int (*func)(const char *name))
> +{
> + int ret = 0;
> + struct perf_pmu *pmu;
> + struct perf_pmu_alias *alias;
> +
> + perf_pmu__find("cpu"); /* Load PMUs */
> + pmu = NULL;
> + while ((pmu = perf_pmu__scan(pmu)) != NULL) {
> + list_for_each_entry(alias, &pmu->aliases, list) {
> + ret = func(alias->name);
> + if (ret != 0)
> + break;
> + }
> + }
> + return ret;
> +}
> diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h
> index 583d21e..a8ed283 100644
> --- a/tools/perf/util/pmu.h
> +++ b/tools/perf/util/pmu.h
> @@ -47,5 +47,7 @@ bool pmu_have_event(const char *pname, const char *name);
>
> int perf_pmu__test(void);
>
> +int pmu_iterate_events(int (*func)(const char *name));
> +

this new pmu interface needs to go to separated patchset

jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/