perf hists: Replace perf_evsel arg perf_hpp_fmt's width callback
Replacing perf_evsel arg perf_hpp_fmt's width callback with hists object. This will be helpful in future for non evsel related hist browsers. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: David Ahern <dsahern@gmail.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1465928361-2442-11-git-send-email-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
committed by
Arnaldo Carvalho de Melo
parent
0537217360
commit
da1b0407c8
@@ -1056,7 +1056,7 @@ static int hpp__header(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
|
|||||||
|
|
||||||
static int hpp__width(struct perf_hpp_fmt *fmt,
|
static int hpp__width(struct perf_hpp_fmt *fmt,
|
||||||
struct perf_hpp *hpp __maybe_unused,
|
struct perf_hpp *hpp __maybe_unused,
|
||||||
struct perf_evsel *evsel __maybe_unused)
|
struct hists *hists __maybe_unused)
|
||||||
{
|
{
|
||||||
struct diff_hpp_fmt *dfmt =
|
struct diff_hpp_fmt *dfmt =
|
||||||
container_of(fmt, struct diff_hpp_fmt, fmt);
|
container_of(fmt, struct diff_hpp_fmt, fmt);
|
||||||
|
|||||||
@@ -1470,7 +1470,7 @@ static int hist_browser__show_no_entry(struct hist_browser *browser,
|
|||||||
column++ < browser->b.horiz_scroll)
|
column++ < browser->b.horiz_scroll)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ret = fmt->width(fmt, NULL, hists_to_evsel(browser->hists));
|
ret = fmt->width(fmt, NULL, browser->hists);
|
||||||
|
|
||||||
if (first) {
|
if (first) {
|
||||||
/* for folded sign */
|
/* for folded sign */
|
||||||
|
|||||||
@@ -215,9 +215,10 @@ static int __hpp__sort_acc(struct hist_entry *a, struct hist_entry *b,
|
|||||||
|
|
||||||
static int hpp__width_fn(struct perf_hpp_fmt *fmt,
|
static int hpp__width_fn(struct perf_hpp_fmt *fmt,
|
||||||
struct perf_hpp *hpp __maybe_unused,
|
struct perf_hpp *hpp __maybe_unused,
|
||||||
struct perf_evsel *evsel)
|
struct hists *hists)
|
||||||
{
|
{
|
||||||
int len = fmt->user_len ?: fmt->len;
|
int len = fmt->user_len ?: fmt->len;
|
||||||
|
struct perf_evsel *evsel = hists_to_evsel(hists);
|
||||||
|
|
||||||
if (symbol_conf.event_group)
|
if (symbol_conf.event_group)
|
||||||
len = max(len, evsel->nr_members * fmt->len);
|
len = max(len, evsel->nr_members * fmt->len);
|
||||||
@@ -231,7 +232,7 @@ static int hpp__width_fn(struct perf_hpp_fmt *fmt,
|
|||||||
static int hpp__header_fn(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
|
static int hpp__header_fn(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
|
||||||
struct hists *hists)
|
struct hists *hists)
|
||||||
{
|
{
|
||||||
int len = hpp__width_fn(fmt, hpp, hists_to_evsel(hists));
|
int len = hpp__width_fn(fmt, hpp, hists);
|
||||||
return scnprintf(hpp->buf, hpp->size, "%*s", len, fmt->name);
|
return scnprintf(hpp->buf, hpp->size, "%*s", len, fmt->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -632,7 +633,7 @@ unsigned int hists__sort_list_width(struct hists *hists)
|
|||||||
else
|
else
|
||||||
ret += 2;
|
ret += 2;
|
||||||
|
|
||||||
ret += fmt->width(fmt, &dummy_hpp, hists_to_evsel(hists));
|
ret += fmt->width(fmt, &dummy_hpp, hists);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (verbose && hists__has(hists, sym)) /* Addr + origin */
|
if (verbose && hists__has(hists, sym)) /* Addr + origin */
|
||||||
@@ -657,7 +658,7 @@ unsigned int hists__overhead_width(struct hists *hists)
|
|||||||
else
|
else
|
||||||
ret += 2;
|
ret += 2;
|
||||||
|
|
||||||
ret += fmt->width(fmt, &dummy_hpp, hists_to_evsel(hists));
|
ret += fmt->width(fmt, &dummy_hpp, hists);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
@@ -590,7 +590,7 @@ static int print_hierarchy_header(struct hists *hists, struct perf_hpp *hpp,
|
|||||||
fprintf(fp, "%s", sep ?: "..");
|
fprintf(fp, "%s", sep ?: "..");
|
||||||
first_col = false;
|
first_col = false;
|
||||||
|
|
||||||
width = fmt->width(fmt, hpp, hists_to_evsel(hists));
|
width = fmt->width(fmt, hpp, hists);
|
||||||
fprintf(fp, "%.*s", width, dots);
|
fprintf(fp, "%.*s", width, dots);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -607,7 +607,7 @@ static int print_hierarchy_header(struct hists *hists, struct perf_hpp *hpp,
|
|||||||
width++; /* for '+' sign between column header */
|
width++; /* for '+' sign between column header */
|
||||||
first_col = false;
|
first_col = false;
|
||||||
|
|
||||||
width += fmt->width(fmt, hpp, hists_to_evsel(hists));
|
width += fmt->width(fmt, hpp, hists);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (width > header_width)
|
if (width > header_width)
|
||||||
@@ -682,7 +682,7 @@ hists__fprintf_standard_headers(struct hists *hists,
|
|||||||
else
|
else
|
||||||
first = false;
|
first = false;
|
||||||
|
|
||||||
width = fmt->width(fmt, hpp, hists_to_evsel(hists));
|
width = fmt->width(fmt, hpp, hists);
|
||||||
for (i = 0; i < width; i++)
|
for (i = 0; i < width; i++)
|
||||||
fprintf(fp, ".");
|
fprintf(fp, ".");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1081,7 +1081,7 @@ int hist_entry__snprintf_alignment(struct hist_entry *he, struct perf_hpp *hpp,
|
|||||||
struct perf_hpp_fmt *fmt, int printed)
|
struct perf_hpp_fmt *fmt, int printed)
|
||||||
{
|
{
|
||||||
if (!list_is_last(&fmt->list, &he->hists->hpp_list->fields)) {
|
if (!list_is_last(&fmt->list, &he->hists->hpp_list->fields)) {
|
||||||
const int width = fmt->width(fmt, hpp, hists_to_evsel(he->hists));
|
const int width = fmt->width(fmt, hpp, he->hists);
|
||||||
if (printed < width) {
|
if (printed < width) {
|
||||||
advance_hpp(hpp, printed);
|
advance_hpp(hpp, printed);
|
||||||
printed = scnprintf(hpp->buf, hpp->size, "%-*s", width - printed, " ");
|
printed = scnprintf(hpp->buf, hpp->size, "%-*s", width - printed, " ");
|
||||||
|
|||||||
@@ -217,7 +217,7 @@ struct perf_hpp_fmt {
|
|||||||
int (*header)(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
|
int (*header)(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
|
||||||
struct hists *hists);
|
struct hists *hists);
|
||||||
int (*width)(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
|
int (*width)(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
|
||||||
struct perf_evsel *evsel);
|
struct hists *hists);
|
||||||
int (*color)(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
|
int (*color)(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
|
||||||
struct hist_entry *he);
|
struct hist_entry *he);
|
||||||
int (*entry)(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
|
int (*entry)(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
|
||||||
|
|||||||
@@ -1503,7 +1503,7 @@ static int __sort__hpp_header(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
|
|||||||
|
|
||||||
static int __sort__hpp_width(struct perf_hpp_fmt *fmt,
|
static int __sort__hpp_width(struct perf_hpp_fmt *fmt,
|
||||||
struct perf_hpp *hpp __maybe_unused,
|
struct perf_hpp *hpp __maybe_unused,
|
||||||
struct perf_evsel *evsel)
|
struct hists *hists)
|
||||||
{
|
{
|
||||||
struct hpp_sort_entry *hse;
|
struct hpp_sort_entry *hse;
|
||||||
size_t len = fmt->user_len;
|
size_t len = fmt->user_len;
|
||||||
@@ -1511,7 +1511,7 @@ static int __sort__hpp_width(struct perf_hpp_fmt *fmt,
|
|||||||
hse = container_of(fmt, struct hpp_sort_entry, hpp);
|
hse = container_of(fmt, struct hpp_sort_entry, hpp);
|
||||||
|
|
||||||
if (!len)
|
if (!len)
|
||||||
len = hists__col_len(evsel__hists(evsel), hse->se->se_width_idx);
|
len = hists__col_len(hists, hse->se->se_width_idx);
|
||||||
|
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
@@ -1808,7 +1808,7 @@ static int __sort__hde_header(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
|
|||||||
|
|
||||||
static int __sort__hde_width(struct perf_hpp_fmt *fmt,
|
static int __sort__hde_width(struct perf_hpp_fmt *fmt,
|
||||||
struct perf_hpp *hpp __maybe_unused,
|
struct perf_hpp *hpp __maybe_unused,
|
||||||
struct perf_evsel *evsel __maybe_unused)
|
struct hists *hists __maybe_unused)
|
||||||
{
|
{
|
||||||
struct hpp_dynamic_entry *hde;
|
struct hpp_dynamic_entry *hde;
|
||||||
size_t len = fmt->user_len;
|
size_t len = fmt->user_len;
|
||||||
|
|||||||
Reference in New Issue
Block a user