Skip to content

Commit

Permalink
perf c2c report: Add --no-source option
Browse files Browse the repository at this point in the history
Add a possibility to disable source line column with new --no-source
option. It source line data could take lot of time to retrieve, so it
could be a performance burden for big data.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Joe Mario <jmario@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/n/tip-8p6s2727fq8nbsm3it5gix3p@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 Oct 21, 2016
1 parent 465f27a commit 18f278d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
3 changes: 3 additions & 0 deletions tools/perf/Documentation/perf-c2c.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ REPORT OPTIONS
--full-symbols::
Display full length of symbols.

--no-source::
Do not display Source:Line column.

C2C RECORD
----------
The perf c2c record command setup options related to HITM cacheline analysis
Expand Down
13 changes: 8 additions & 5 deletions tools/perf/builtin-c2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -2404,7 +2404,7 @@ static int setup_display(const char *str)
for (__tok = strtok_r(__buf, __sep, &__tmp); __tok; \
__tok = strtok_r(NULL, __sep, &__tmp))

static int build_cl_output(char *cl_sort)
static int build_cl_output(char *cl_sort, bool no_source)
{
char *tok, *tmp, *buf = strdup(cl_sort);
bool add_pid = false;
Expand All @@ -2426,7 +2426,7 @@ static int build_cl_output(char *cl_sort)
add_iaddr = true;
add_sym = true;
add_dso = true;
add_src = true;
add_src = no_source ? false : true;
} else if (!strcmp(tok, "dso")) {
add_dso = true;
} else if (strcmp(tok, "offset")) {
Expand Down Expand Up @@ -2462,14 +2462,14 @@ static int build_cl_output(char *cl_sort)
return 0;
}

static int setup_coalesce(const char *coalesce)
static int setup_coalesce(const char *coalesce, bool no_source)
{
const char *c = coalesce ?: coalesce_default;

if (asprintf(&c2c.cl_sort, "offset,%s", c) < 0)
return -ENOMEM;

if (build_cl_output(c2c.cl_sort))
if (build_cl_output(c2c.cl_sort, no_source))
return -1;

if (asprintf(&c2c.cl_resort, "offset,%s",
Expand All @@ -2494,6 +2494,7 @@ static int perf_c2c__report(int argc, const char **argv)
char callchain_default_opt[] = CALLCHAIN_DEFAULT_OPT;
const char *display = NULL;
const char *coalesce = NULL;
bool no_source = false;
const struct option c2c_options[] = {
OPT_STRING('k', "vmlinux", &symbol_conf.vmlinux_name,
"file", "vmlinux pathname"),
Expand All @@ -2510,6 +2511,8 @@ static int perf_c2c__report(int argc, const char **argv)
"Use the stdio interface"),
OPT_BOOLEAN(0, "full-symbols", &c2c.symbol_full,
"Display full length of symbols"),
OPT_BOOLEAN(0, "no-source", &no_source,
"Do not display Source Line column"),
OPT_CALLBACK_DEFAULT('g', "call-graph", &callchain_param,
"print_type,threshold[,print_limit],order,sort_key[,branch],value",
callchain_help, &parse_callchain_opt,
Expand Down Expand Up @@ -2545,7 +2548,7 @@ static int perf_c2c__report(int argc, const char **argv)
if (err)
goto out;

err = setup_coalesce(coalesce);
err = setup_coalesce(coalesce, no_source);
if (err) {
pr_debug("Failed to initialize hists\n");
goto out;
Expand Down

0 comments on commit 18f278d

Please sign in to comment.