提交 74bb43f2 编写于 作者: J Jiri Olsa 提交者: Arnaldo Carvalho de Melo

perf hists: Add line argument into perf_hpp_fmt's header callback

Adding line argument into perf_hpp_fmt's header callback to be able to
request specific header line.
Signed-off-by: NJiri 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/1470583710-1649-3-git-send-email-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 f8e6710d
...@@ -1033,7 +1033,8 @@ static int hpp__entry_global(struct perf_hpp_fmt *_fmt, struct perf_hpp *hpp, ...@@ -1033,7 +1033,8 @@ static int hpp__entry_global(struct perf_hpp_fmt *_fmt, struct perf_hpp *hpp,
} }
static int hpp__header(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, static int hpp__header(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
struct hists *hists __maybe_unused) struct hists *hists __maybe_unused,
int line __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);
......
...@@ -1523,7 +1523,7 @@ static int hists_browser__scnprintf_headers(struct hist_browser *browser, char * ...@@ -1523,7 +1523,7 @@ static int hists_browser__scnprintf_headers(struct hist_browser *browser, char *
if (perf_hpp__should_skip(fmt, hists) || column++ < browser->b.horiz_scroll) if (perf_hpp__should_skip(fmt, hists) || column++ < browser->b.horiz_scroll)
continue; continue;
ret = fmt->header(fmt, &dummy_hpp, hists); ret = fmt->header(fmt, &dummy_hpp, hists, 0);
if (advance_hpp_check(&dummy_hpp, ret)) if (advance_hpp_check(&dummy_hpp, ret))
break; break;
...@@ -1560,7 +1560,7 @@ static int hists_browser__scnprintf_hierarchy_headers(struct hist_browser *brows ...@@ -1560,7 +1560,7 @@ static int hists_browser__scnprintf_hierarchy_headers(struct hist_browser *brows
if (column++ < browser->b.horiz_scroll) if (column++ < browser->b.horiz_scroll)
continue; continue;
ret = fmt->header(fmt, &dummy_hpp, hists); ret = fmt->header(fmt, &dummy_hpp, hists, 0);
if (advance_hpp_check(&dummy_hpp, ret)) if (advance_hpp_check(&dummy_hpp, ret))
break; break;
...@@ -1597,7 +1597,7 @@ static int hists_browser__scnprintf_hierarchy_headers(struct hist_browser *brows ...@@ -1597,7 +1597,7 @@ static int hists_browser__scnprintf_hierarchy_headers(struct hist_browser *brows
} }
first_col = false; first_col = false;
ret = fmt->header(fmt, &dummy_hpp, hists); ret = fmt->header(fmt, &dummy_hpp, hists, 0);
dummy_hpp.buf[ret] = '\0'; dummy_hpp.buf[ret] = '\0';
start = trim(dummy_hpp.buf); start = trim(dummy_hpp.buf);
......
...@@ -549,7 +549,7 @@ static void perf_gtk__show_hierarchy(GtkWidget *window, struct hists *hists, ...@@ -549,7 +549,7 @@ static void perf_gtk__show_hierarchy(GtkWidget *window, struct hists *hists,
strcat(buf, "+"); strcat(buf, "+");
first_col = false; first_col = false;
fmt->header(fmt, &hpp, hists); fmt->header(fmt, &hpp, hists, 0);
strcat(buf, ltrim(rtrim(hpp.buf))); strcat(buf, ltrim(rtrim(hpp.buf)));
} }
} }
......
...@@ -230,7 +230,7 @@ static int hpp__width_fn(struct perf_hpp_fmt *fmt, ...@@ -230,7 +230,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 line __maybe_unused)
{ {
int len = hpp__width_fn(fmt, hpp, 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);
......
...@@ -549,7 +549,7 @@ static int print_hierarchy_header(struct hists *hists, struct perf_hpp *hpp, ...@@ -549,7 +549,7 @@ static int print_hierarchy_header(struct hists *hists, struct perf_hpp *hpp,
struct perf_hpp_list_node, list); struct perf_hpp_list_node, list);
perf_hpp_list__for_each_format(&fmt_node->hpp, fmt) { perf_hpp_list__for_each_format(&fmt_node->hpp, fmt) {
fmt->header(fmt, hpp, hists); fmt->header(fmt, hpp, hists, 0);
fprintf(fp, "%s%s", hpp->buf, sep ?: " "); fprintf(fp, "%s%s", hpp->buf, sep ?: " ");
} }
...@@ -569,7 +569,7 @@ static int print_hierarchy_header(struct hists *hists, struct perf_hpp *hpp, ...@@ -569,7 +569,7 @@ static int print_hierarchy_header(struct hists *hists, struct perf_hpp *hpp,
header_width += fprintf(fp, "+"); header_width += fprintf(fp, "+");
first_col = false; first_col = false;
fmt->header(fmt, hpp, hists); fmt->header(fmt, hpp, hists, 0);
header_width += fprintf(fp, "%s", trim(hpp->buf)); header_width += fprintf(fp, "%s", trim(hpp->buf));
} }
...@@ -658,7 +658,7 @@ hists__fprintf_standard_headers(struct hists *hists, ...@@ -658,7 +658,7 @@ hists__fprintf_standard_headers(struct hists *hists,
else else
first = false; first = false;
fmt->header(fmt, hpp, hists); fmt->header(fmt, hpp, hists, 0);
fprintf(fp, "%s", hpp->buf); fprintf(fp, "%s", hpp->buf);
} }
......
...@@ -230,7 +230,7 @@ struct perf_hpp { ...@@ -230,7 +230,7 @@ struct perf_hpp {
struct perf_hpp_fmt { struct perf_hpp_fmt {
const char *name; const char *name;
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 line);
int (*width)(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, int (*width)(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
struct hists *hists); 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,
......
...@@ -1492,7 +1492,7 @@ void perf_hpp__reset_sort_width(struct perf_hpp_fmt *fmt, struct hists *hists) ...@@ -1492,7 +1492,7 @@ void perf_hpp__reset_sort_width(struct perf_hpp_fmt *fmt, struct hists *hists)
} }
static int __sort__hpp_header(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, static int __sort__hpp_header(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
struct hists *hists) struct hists *hists, int line __maybe_unused)
{ {
struct hpp_sort_entry *hse; struct hpp_sort_entry *hse;
size_t len = fmt->user_len; size_t len = fmt->user_len;
...@@ -1797,7 +1797,8 @@ static void update_dynamic_len(struct hpp_dynamic_entry *hde, ...@@ -1797,7 +1797,8 @@ static void update_dynamic_len(struct hpp_dynamic_entry *hde,
} }
static int __sort__hde_header(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp, static int __sort__hde_header(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
struct hists *hists __maybe_unused) struct hists *hists __maybe_unused,
int line __maybe_unused)
{ {
struct hpp_dynamic_entry *hde; struct hpp_dynamic_entry *hde;
size_t len = fmt->user_len; size_t len = fmt->user_len;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册