[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150528124612.GM12392@krava.redhat.com>
Date: Thu, 28 May 2015 14:46:12 +0200
From: Jiri Olsa <jolsa@...hat.com>
To: Sukadev Bhattiprolu <sukadev@...ux.vnet.ibm.com>
Cc: mingo@...hat.com, ak@...ux.intel.com,
Michael Ellerman <mpe@...erman.id.au>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Paul Mackerras <paulus@...ba.org>, namhyung@...nel.org,
linuxppc-dev@...ts.ozlabs.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 03/10] Use pmu_events_map table to create event aliases
On Wed, May 27, 2015 at 02:23:22PM -0700, Sukadev Bhattiprolu wrote:
> At run time, (i.e when perf is starting up), locate the specific events
> table for the current CPU and create event aliases for each of the events.
>
> Use these aliases to parse user's specified perf event.
>
> Signed-off-by: Sukadev Bhattiprolu <sukadev@...ux.vnet.ibm.com>
please prefix the subject with 'perf tools'
SNIP
> +/*
> + * From the pmu_events_map, find the table of PMU events that corresponds
> + * to the current running CPU. Then, add all PMU events from that table
> + * as aliases.
> + */
> +static int pmu_add_cpu_aliases(void *data)
> +{
> + struct list_head *head = (struct list_head *)data;
> + int i;
> + struct pmu_events_map *map;
> + struct pmu_event *pe;
> + char *cpuid;
> +
> + cpuid = get_cpuid_str();
> + if (!cpuid)
> + return 0;
> +
> + i = 0;
> + while (1) {
> + map = &pmu_events_map[i++];
> + if (!map->table)
> + return 0;
leaking cpuid
> +
> + if (!strcmp(map->cpuid, cpuid))
> + break;
> + }
> +
> + /*
> + * Found a matching PMU events table. Create aliases
> + */
> + i = 0;
> + while (1) {
> + pe = &map->table[i++];
> + if (!pe->name)
> + break;
> +
> + /* need type casts to override 'const' */
> + __perf_pmu__new_alias(head, (char *)pe->name, NULL,
> + (char *)pe->desc, (char *)pe->event);
> + }
> +
> + free(cpuid);
> +
> + return 0;
> +}
SNIP
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists