lkml.org 
[lkml]   [2014]   [Apr]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 05/15 V3] perf, c2c: Rework setup code to prepare for features
Date
On Mon, 24 Mar 2014 15:36:56 -0400, Don Zickus wrote:
> A basic patch that re-arranges some of the c2c code and adds a couple
> of small features to lay the ground work for the rest of the patch
> series.
>
> Changes include:
>
> o reworking the report path
> o replace preprocess_sample with simpler calls
> o rework raw output to handle separators
> o remove phys id gunk
> o add some generic options

[SNIP]
>
> + return fprintf(fp, fmt,
> + tag, sep,
> + reason ?: "valid record", sep,
> + sample->pid, sep,
> + sample->tid, sep,
> + sample->cpu, sep,
> + sample->ip, sep,
> + sample->addr, sep,
> + sample->weight, sep,
> + sample->data_src, sep,
> + data_src, sep,
> + map ? (map->dso ? map->dso->long_name : "???") : "???",

How about using this instead?

(map && map->dso) ? map->dso->long_name : "???".


> + mi->iaddr.sym ? mi->iaddr.sym->name : "???");
> }
>
> static int perf_c2c__process_load_store(struct perf_c2c *c2c,
> + struct addr_location *al,
> struct perf_sample *sample,
> - struct addr_location *al)
> + struct perf_evsel *evsel)
> {
> - if (c2c->raw_records)
> - perf_sample__fprintf(sample, ' ', "raw input", al, stdout);
> + struct mem_info *mi;
> +
> + mi = sample__resolve_mem(sample, al);
> + if (!mi)
> + return -ENOMEM;
> +
> + if (c2c->raw_records) {
> + perf_sample__fprintf(sample, ' ', "raw input", mi, stdout);
> + free(mi);
> + return 0;
> + }

It seems the 'mi' should be freed here as well?

>
> return 0;
> }


[SNIP]
> +static int perf_c2c__process_events(struct perf_session *session,
> + struct perf_c2c *c2c)
> +{
> + int err = -1;

No need to set.

> +
> + err = perf_session__process_events(session, &c2c->tool);
> + if (err) {
> + pr_err("Failed to process count events, error %d\n", err);
> + goto err;

Unnecessary goto.

Thanks,
Namhyung


> }
>
> +err:
> return err;
> }


\
 
 \ /
  Last update: 2014-04-08 10:01    [W:0.246 / U:34.948 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site