Re: [PATCH 01/21] perf c2c: Shared data analyser
From: Arnaldo Carvalho de Melo
Date: Tue Feb 11 2014 - 10:42:19 EST
Em Tue, Feb 11, 2014 at 09:36:43AM -0500, Don Zickus escreveu:
> On Tue, Feb 11, 2014 at 08:31:27AM -0300, Arnaldo Carvalho de Melo wrote:
> > Em Mon, Feb 10, 2014 at 02:10:04PM -0800, Davidlohr Bueso escreveu:
> > > On Mon, 2014-02-10 at 14:18 -0500, Don Zickus wrote:
> > > > From: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
> > > >
> > > > This is the start of a new perf tool that will collect information about
> > > > memory accesses and analyse it to find things like hot cachelines, etc.
> > > >
> > > > This is basically trying to get a prototype written by Richard Fowles
> > > > written using the tools/perf coding style and libraries.
> > > >
> > > > Start it from 'perf sched', this patch starts the process by adding the
> > > > 'record' subcommand to collect the needed mem loads and stores samples.
> > > >
> > > > It also have the basic 'report' skeleton, resolving the sample address
> > > > and hooking the events found in a perf.data file with methods to handle
> > > > them, right now just printing the resolved perf_sample data structure
> > > > after each event name.
> > >
> > > What tree/branch is this developed against? I'm getting the following
> > > with Linus' latest and tip tree:
> >
> > I'll try refreshing it on top of my perf/core branch today
>
> Sorry for the trouble. I guess I missed all the function cleanups from
> last month. Attached is a patch that gets things to compile.
>
> I'll split this patch up to the right spots on my next refresh.
I go cleaning up the libraries trying to simplify its use as I go seeing
how new tools use the core, hopefully making it easier/less
boilerplate'ish.
Will look at how you used it to see what can be folded into the
libraries, thanks!
- Arnaldo
> Cheers,
> Don
>
> diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c
> index a73535a..b55f281 100644
> --- a/tools/perf/builtin-c2c.c
> +++ b/tools/perf/builtin-c2c.c
> @@ -1009,15 +1009,20 @@ static int perf_c2c__process_sample(struct perf_tool *tool,
> struct c2c_entry *entry;
> sample_handler f;
> int err = -1;
> + struct addr_location al = {
> + .machine = machine,
> + .cpumode = cpumode,
> + };
>
> - if (evsel->handler.func == NULL)
> + if (evsel->handler == NULL)
> return 0;
>
> thread = machine__find_thread(machine, sample->pid);
> if (thread == NULL)
> goto err;
>
> - mi = machine__resolve_mem(machine, thread, sample, cpumode);
> + al.thread = thread;
> + mi = sample__resolve_mem(sample, &al);
> if (mi == NULL)
> goto err;
>
> @@ -1031,7 +1036,7 @@ static int perf_c2c__process_sample(struct perf_tool *tool,
> if (entry == NULL)
> goto err_mem;
>
> - f = evsel->handler.func;
> + f = evsel->handler;
> err = f(c2c, sample, entry);
> if (err)
> goto err_entry;
> @@ -1040,8 +1045,8 @@ static int perf_c2c__process_sample(struct perf_tool *tool,
> if (symbol_conf.use_callchain && sample->callchain) {
> callchain_init(entry->callchain);
>
> - err = machine__resolve_callchain(machine, evsel, thread,
> - sample, &parent, NULL);
> + err = sample__resolve_callchain(sample, &parent, evsel, &al,
> + PERF_MAX_STACK_DEPTH);
> if (!err)
> err = callchain_append(entry->callchain,
> &callchain_cursor,
> @@ -1198,7 +1203,7 @@ struct refs {
> struct list_head list;
> int nr;
> const char *name;
> - char *long_name;
> + const char *long_name;
> };
>
> static int update_ref_tree(struct c2c_entry *entry)
> @@ -2732,8 +2737,12 @@ static int perf_c2c__read_events(struct perf_c2c *c2c)
> {
> int err = -1;
> struct perf_session *session;
> + struct perf_data_file file = {
> + .path = input_name,
> + .mode = PERF_DATA_MODE_READ,
> + };
>
> - session = perf_session__new(input_name, O_RDONLY, 0, false, &c2c->tool);
> + session = perf_session__new(&file, 0, &c2c->tool);
> if (session == NULL) {
> pr_debug("No memory for session\n");
> goto out;
> diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
> index faf29b0..49e0328 100644
> --- a/tools/perf/util/evlist.c
> +++ b/tools/perf/util/evlist.c
> @@ -1270,10 +1270,10 @@ int __perf_evlist__set_handlers(struct perf_evlist *evlist,
> if (evsel == NULL)
> continue;
>
> - if (evsel->handler.func != NULL)
> + if (evsel->handler != NULL)
> goto out;
>
> - evsel->handler.func = assocs[i].handler;
> + evsel->handler = assocs[i].handler;
> }
>
> err = 0;
--
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/