Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 29659ab4 authored by Jiri Olsa's avatar Jiri Olsa Committed by Arnaldo Carvalho de Melo
Browse files

perf hists: Add support for header span



Add span argument for header callback function.

The handling of this argument is completely in the hands of the
callback. The only thing the caller ensures is it's zeroed on the
beginning.

Omitting span skipping in hierarchy headers and gtk code.

The c2c code use this to span header lines based on the entries span
configuration.

Signed-off-by: default avatarJiri 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-6-git-send-email-jolsa@kernel.org


Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent f3705b06
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -1034,7 +1034,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)
		       int line __maybe_unused,
		       int *span __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);
+7 −3
Original line number Original line Diff line number Diff line
@@ -1514,6 +1514,7 @@ hists_browser__scnprintf_headers(struct hist_browser *browser, char *buf,
	struct perf_hpp_fmt *fmt;
	struct perf_hpp_fmt *fmt;
	size_t ret = 0;
	size_t ret = 0;
	int column = 0;
	int column = 0;
	int span = 0;


	if (symbol_conf.use_callchain) {
	if (symbol_conf.use_callchain) {
		ret = scnprintf(buf, size, "  ");
		ret = scnprintf(buf, size, "  ");
@@ -1525,10 +1526,13 @@ hists_browser__scnprintf_headers(struct hist_browser *browser, char *buf,
		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, line);
		ret = fmt->header(fmt, &dummy_hpp, hists, line, &span);
		if (advance_hpp_check(&dummy_hpp, ret))
		if (advance_hpp_check(&dummy_hpp, ret))
			break;
			break;


		if (span)
			continue;

		ret = scnprintf(dummy_hpp.buf, dummy_hpp.size, "  ");
		ret = scnprintf(dummy_hpp.buf, dummy_hpp.size, "  ");
		if (advance_hpp_check(&dummy_hpp, ret))
		if (advance_hpp_check(&dummy_hpp, ret))
			break;
			break;
@@ -1562,7 +1566,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, 0);
		ret = fmt->header(fmt, &dummy_hpp, hists, 0, NULL);
		if (advance_hpp_check(&dummy_hpp, ret))
		if (advance_hpp_check(&dummy_hpp, ret))
			break;
			break;


@@ -1599,7 +1603,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, 0);
			ret = fmt->header(fmt, &dummy_hpp, hists, 0, NULL);
			dummy_hpp.buf[ret] = '\0';
			dummy_hpp.buf[ret] = '\0';


			start = trim(dummy_hpp.buf);
			start = trim(dummy_hpp.buf);
+1 −1
Original line number Original line Diff line number Diff line
@@ -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, 0);
			fmt->header(fmt, &hpp, hists, 0, NULL);
			strcat(buf, ltrim(rtrim(hpp.buf)));
			strcat(buf, ltrim(rtrim(hpp.buf)));
		}
		}
	}
	}
+2 −1
Original line number Original line Diff line number Diff line
@@ -230,7 +230,8 @@ 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, int line __maybe_unused)
			  struct hists *hists, int line __maybe_unused,
			  int *span __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);
+8 −5
Original line number Original line Diff line number Diff line
@@ -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, 0);
		fmt->header(fmt, hpp, hists, 0, NULL);
		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,
				header_width += fprintf(fp, "+");
				header_width += fprintf(fp, "+");
			first_col = false;
			first_col = false;


			fmt->header(fmt, hpp, hists, 0);
			fmt->header(fmt, hpp, hists, 0, NULL);


			header_width += fprintf(fp, "%s", trim(hpp->buf));
			header_width += fprintf(fp, "%s", trim(hpp->buf));
		}
		}
@@ -645,17 +645,20 @@ static void fprintf_line(struct hists *hists, struct perf_hpp *hpp,
	struct perf_hpp_fmt *fmt;
	struct perf_hpp_fmt *fmt;
	const char *sep = symbol_conf.field_sep;
	const char *sep = symbol_conf.field_sep;
	bool first = true;
	bool first = true;
	int span = 0;


	hists__for_each_format(hists, fmt) {
	hists__for_each_format(hists, fmt) {
		if (perf_hpp__should_skip(fmt, hists))
		if (perf_hpp__should_skip(fmt, hists))
			continue;
			continue;


		if (!first)
		if (!first && !span)
			fprintf(fp, "%s", sep ?: "  ");
			fprintf(fp, "%s", sep ?: "  ");
		else
		else
			first = false;
			first = false;


		fmt->header(fmt, hpp, hists, line);
		fmt->header(fmt, hpp, hists, line, &span);

		if (!span)
			fprintf(fp, "%s", hpp->buf);
			fprintf(fp, "%s", hpp->buf);
	}
	}
}
}
Loading