mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: kan.liang@intel.com
Cc: acme@kernel.org, linux-kernel@vger.kernel.org, ak@linux.intel.com
Subject: Re: [PATCH v4 2/3] perf tools: parse the pmu event prefix and surfix
Date: Sat, 6 Sep 2014 21:39:00 +0200	[thread overview]
Message-ID: <20140906193900.GD6059@krava.brq.redhat.com> (raw)
In-Reply-To: <1409671770-17260-2-git-send-email-kan.liang@intel.com>

On Tue, Sep 02, 2014 at 11:29:29AM -0400, kan.liang@intel.com wrote:

SNIP

>  {
>  	YY_BUFFER_STATE buffer;
> @@ -906,7 +1006,10 @@ int parse_events(struct perf_evlist *evlist, const char *str)
>  	};
>  	int ret;
>  
> +	/* scan kernel pmu events from sysfs */
> +	scan_kernel_pmu_events_list();
>  	ret = parse_events__scanner(str, &data, PE_START_EVENTS);
> +	release_kernel_pmu_events_list();
>  	if (!ret) {
>  		int entries = data.idx - evlist->nr_entries;
>  		perf_evlist__splice_list_tail(evlist, &data.list, entries);
> diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h
> index df094b4..d06fec4 100644
> --- a/tools/perf/util/parse-events.h
> +++ b/tools/perf/util/parse-events.h
> @@ -35,6 +35,19 @@ extern int parse_filter(const struct option *opt, const char *str, int unset);
>  
>  #define EVENTS_HELP_MAX (128*1024)
>  
> +#define KERNEL_PMU_EVENT_MAX	1024

hum.. so roughly for 15 (+-) strings of size around 20 bytes we will
use 15K of memory.. seems like overkill

seems better to allocate each symbol string separatelly, and
update the release function

> +enum kernel_pmu_event_type {
> +	NONE_KERNEL_PMU_EVENT,		/* not a PMU EVENT */
> +	KERNEL_PMU_EVENT,		/* normal style PMU event */
> +	KERNEL_PMU_EVENT_PREFIX,	/* prefix of pre-suf style event */
> +	KERNEL_PMU_EVENT_SUFFIX,	/* suffix of pre-suf style event */
> +};
> +
> +struct kernel_pmu_event_symbol {
> +	char	symbol[KERNEL_PMU_EVENT_MAX];
> +	enum kernel_pmu_event_type	type;
> +};
> +

also, I think this is more pmu object related stuff.. how about:

enum perf_pmu_event_symbol_type
struct perf_pmu_event_symbol

  perf_pmu__parse_init
  perf_pmu__parse_cleanup
  perf_pmu__parse_check

with perf_pmu__parse_init being called from perf_pmu__parse_check
in case it's needed..

and perf_pmu__parse_cleanup being called from parse_events same as
release_kernel_pmu_events_list

jirka

  parent reply	other threads:[~2014-09-06 19:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-02 15:29 [PATCH v4 1/3] Revert "perf tools: Default to cpu// for events v5" kan.liang
2014-09-02 15:29 ` [PATCH v4 2/3] perf tools: parse the pmu event prefix and surfix kan.liang
2014-09-06 19:38   ` Jiri Olsa
2014-09-06 19:39   ` Jiri Olsa [this message]
2014-09-02 15:29 ` [PATCH v4 3/3] perf tools: Add support to new style format of kernel PMU event kan.liang
2014-09-06 19:39   ` Jiri Olsa
2014-09-06 19:39   ` Jiri Olsa
2014-09-08 15:09     ` Liang, Kan

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=20140906193900.GD6059@krava.brq.redhat.com \
    --to=jolsa@redhat.com \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=kan.liang@intel.com \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®