Skip to content

Commit

Permalink
perf tools: Change (symbol|annotation)__calc_percent return type to void
Browse files Browse the repository at this point in the history
There's no need for symbol__calc_percent and annotation__calc_percent
functions to return any value, since it's always zero. Changing both
function to return void.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-z0gs28hh24m4gia1t1ctraye@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
  • Loading branch information
Jiri Olsa authored and Arnaldo Carvalho de Melo committed Nov 17, 2017
1 parent a7eec4c commit 9e4e0a9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
17 changes: 8 additions & 9 deletions tools/perf/util/annotate.c
Original file line number Diff line number Diff line change
Expand Up @@ -1584,8 +1584,8 @@ static void calc_percent(struct sym_hist *hist,
}
}

static int annotation__calc_percent(struct annotation *notes,
struct perf_evsel *evsel, s64 len)
static void annotation__calc_percent(struct annotation *notes,
struct perf_evsel *evsel, s64 len)
{
struct annotation_line *al, *next;

Expand All @@ -1609,15 +1609,13 @@ static int annotation__calc_percent(struct annotation *notes,
calc_percent(hist, sample, al->offset, end);
}
}

return 0;
}

int symbol__calc_percent(struct symbol *sym, struct perf_evsel *evsel)
void symbol__calc_percent(struct symbol *sym, struct perf_evsel *evsel)
{
struct annotation *notes = symbol__annotation(sym);

return annotation__calc_percent(notes, evsel, symbol__size(sym));
annotation__calc_percent(notes, evsel, symbol__size(sym));
}

int symbol__annotate(struct symbol *sym, struct map *map,
Expand Down Expand Up @@ -1656,10 +1654,11 @@ int symbol__annotate(struct symbol *sym, struct map *map,
}

err = symbol__disassemble(sym, &args);
if (err)
return err;
if (!err)
symbol__calc_percent(sym, evsel);

return err;

return symbol__calc_percent(sym, evsel);
}

static void insert_source_line(struct rb_root *root, struct annotation_line *al)
Expand Down
2 changes: 1 addition & 1 deletion tools/perf/util/annotate.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ struct annotation_line *
annotation_line__next(struct annotation_line *pos, struct list_head *head);
int disasm_line__scnprintf(struct disasm_line *dl, char *bf, size_t size, bool raw);
size_t disasm__fprintf(struct list_head *head, FILE *fp);
int symbol__calc_percent(struct symbol *sym, struct perf_evsel *evsel);
void symbol__calc_percent(struct symbol *sym, struct perf_evsel *evsel);

struct sym_hist {
u64 nr_samples;
Expand Down

0 comments on commit 9e4e0a9

Please sign in to comment.