mirror of https://gitee.com/openkylin/linux.git
perf hists: Rename and move some functions
Rename functions for consistency and move callchain print function into hist_entry__fprintf(). Signed-off-by: Namhyung Kim <namhyung@kernel.org> Cc: Ingo Molnar <mingo@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1345438331-20234-3-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
7ccf4f9058
commit
000078bc3e
|
@ -586,7 +586,7 @@ static int hist_browser__show_entry(struct hist_browser *browser,
|
|||
}
|
||||
|
||||
if (row_offset == 0) {
|
||||
hist_entry__snprintf(entry, s, sizeof(s), browser->hists);
|
||||
hist_entry__sort_snprintf(entry, s, sizeof(s), browser->hists);
|
||||
percent = (entry->period * 100.0) / browser->hists->stats.total_period;
|
||||
|
||||
ui_browser__set_percent_color(&browser->b, percent, current_entry);
|
||||
|
@ -931,7 +931,7 @@ static int hist_browser__fprintf_entry(struct hist_browser *browser,
|
|||
if (symbol_conf.use_callchain)
|
||||
folded_sign = hist_entry__folded(he);
|
||||
|
||||
hist_entry__snprintf(he, s, sizeof(s), browser->hists);
|
||||
hist_entry__sort_snprintf(he, s, sizeof(s), browser->hists);
|
||||
percent = (he->period * 100.0) / browser->hists->stats.total_period;
|
||||
|
||||
if (symbol_conf.use_callchain)
|
||||
|
|
|
@ -291,7 +291,7 @@ static size_t hist_entry_callchain__fprintf(struct hist_entry *he,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int hist_entry__pcnt_snprintf(struct hist_entry *he, char *s,
|
||||
static int hist_entry__period_snprintf(struct hist_entry *he, char *s,
|
||||
size_t size, struct hists *pair_hists,
|
||||
bool show_displacement, long displacement,
|
||||
bool color, u64 total_period)
|
||||
|
@ -404,8 +404,8 @@ static int hist_entry__pcnt_snprintf(struct hist_entry *he, char *s,
|
|||
return ret;
|
||||
}
|
||||
|
||||
int hist_entry__snprintf(struct hist_entry *he, char *s, size_t size,
|
||||
struct hists *hists)
|
||||
int hist_entry__sort_snprintf(struct hist_entry *he, char *s, size_t size,
|
||||
struct hists *hists)
|
||||
{
|
||||
const char *sep = symbol_conf.field_sep;
|
||||
struct sort_entry *se;
|
||||
|
@ -423,25 +423,7 @@ int hist_entry__snprintf(struct hist_entry *he, char *s, size_t size,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int hist_entry__fprintf(struct hist_entry *he, size_t size,
|
||||
struct hists *hists, struct hists *pair_hists,
|
||||
bool show_displacement, long displacement,
|
||||
u64 total_period, FILE *fp)
|
||||
{
|
||||
char bf[512];
|
||||
int ret;
|
||||
|
||||
if (size == 0 || size > sizeof(bf))
|
||||
size = sizeof(bf);
|
||||
|
||||
ret = hist_entry__pcnt_snprintf(he, bf, size, pair_hists,
|
||||
show_displacement, displacement,
|
||||
true, total_period);
|
||||
hist_entry__snprintf(he, bf + ret, size - ret, hists);
|
||||
return fprintf(fp, "%s\n", bf);
|
||||
}
|
||||
|
||||
static size_t hist_entry__fprintf_callchain(struct hist_entry *he,
|
||||
static size_t hist_entry__callchain_fprintf(struct hist_entry *he,
|
||||
struct hists *hists,
|
||||
u64 total_period, FILE *fp)
|
||||
{
|
||||
|
@ -457,6 +439,31 @@ static size_t hist_entry__fprintf_callchain(struct hist_entry *he,
|
|||
return hist_entry_callchain__fprintf(he, total_period, left_margin, fp);
|
||||
}
|
||||
|
||||
static int hist_entry__fprintf(struct hist_entry *he, size_t size,
|
||||
struct hists *hists, struct hists *pair_hists,
|
||||
bool show_displacement, long displacement,
|
||||
u64 total_period, FILE *fp)
|
||||
{
|
||||
char bf[512];
|
||||
int ret;
|
||||
|
||||
if (size == 0 || size > sizeof(bf))
|
||||
size = sizeof(bf);
|
||||
|
||||
ret = hist_entry__period_snprintf(he, bf, size, pair_hists,
|
||||
show_displacement, displacement,
|
||||
true, total_period);
|
||||
hist_entry__sort_snprintf(he, bf + ret, size - ret, hists);
|
||||
|
||||
ret = fprintf(fp, "%s\n", bf);
|
||||
|
||||
if (symbol_conf.use_callchain)
|
||||
ret += hist_entry__callchain_fprintf(he, hists,
|
||||
total_period, fp);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
size_t hists__fprintf(struct hists *hists, struct hists *pair,
|
||||
bool show_displacement, bool show_header, int max_rows,
|
||||
int max_cols, FILE *fp)
|
||||
|
@ -608,8 +615,6 @@ size_t hists__fprintf(struct hists *hists, struct hists *pair,
|
|||
ret += hist_entry__fprintf(h, max_cols, hists, pair, show_displacement,
|
||||
displacement, total_period, fp);
|
||||
|
||||
if (symbol_conf.use_callchain)
|
||||
ret += hist_entry__fprintf_callchain(h, hists, total_period, fp);
|
||||
if (max_rows && ++nr_rows >= max_rows)
|
||||
goto out;
|
||||
|
||||
|
|
|
@ -75,8 +75,8 @@ struct hist_entry *__hists__add_entry(struct hists *self,
|
|||
struct symbol *parent, u64 period);
|
||||
int64_t hist_entry__cmp(struct hist_entry *left, struct hist_entry *right);
|
||||
int64_t hist_entry__collapse(struct hist_entry *left, struct hist_entry *right);
|
||||
int hist_entry__snprintf(struct hist_entry *self, char *bf, size_t size,
|
||||
struct hists *hists);
|
||||
int hist_entry__sort_snprintf(struct hist_entry *self, char *bf, size_t size,
|
||||
struct hists *hists);
|
||||
void hist_entry__free(struct hist_entry *);
|
||||
|
||||
struct hist_entry *__hists__add_branch_entry(struct hists *self,
|
||||
|
|
Loading…
Reference in New Issue