|
@@ -45,7 +45,8 @@ static struct perf_read_values show_threads_values;
|
|
|
static const char default_pretty_printing_style[] = "normal";
|
|
|
static const char *pretty_printing_style = default_pretty_printing_style;
|
|
|
|
|
|
-static char callchain_default_opt[] = "fractal,0.5";
|
|
|
+static char callchain_default_opt[] = "fractal,0.5,callee";
|
|
|
+static bool inverted_callchain;
|
|
|
static symbol_filter_t annotate_init;
|
|
|
|
|
|
static int perf_session__add_hist_entry(struct perf_session *session,
|
|
@@ -386,13 +387,29 @@ parse_callchain_opt(const struct option *opt __used, const char *arg,
|
|
|
if (!tok)
|
|
|
goto setup;
|
|
|
|
|
|
- tok2 = strtok(NULL, ",");
|
|
|
callchain_param.min_percent = strtod(tok, &endptr);
|
|
|
if (tok == endptr)
|
|
|
return -1;
|
|
|
|
|
|
- if (tok2)
|
|
|
+ /* get the print limit */
|
|
|
+ tok2 = strtok(NULL, ",");
|
|
|
+ if (!tok2)
|
|
|
+ goto setup;
|
|
|
+
|
|
|
+ if (tok2[0] != 'c') {
|
|
|
callchain_param.print_limit = strtod(tok2, &endptr);
|
|
|
+ tok2 = strtok(NULL, ",");
|
|
|
+ if (!tok2)
|
|
|
+ goto setup;
|
|
|
+ }
|
|
|
+
|
|
|
+ /* get the call chain order */
|
|
|
+ if (!strcmp(tok2, "caller"))
|
|
|
+ callchain_param.order = ORDER_CALLER;
|
|
|
+ else if (!strcmp(tok2, "callee"))
|
|
|
+ callchain_param.order = ORDER_CALLEE;
|
|
|
+ else
|
|
|
+ return -1;
|
|
|
setup:
|
|
|
if (callchain_register_param(&callchain_param) < 0) {
|
|
|
fprintf(stderr, "Can't register callchain params\n");
|
|
@@ -436,9 +453,10 @@ static const struct option options[] = {
|
|
|
"regex filter to identify parent, see: '--sort parent'"),
|
|
|
OPT_BOOLEAN('x', "exclude-other", &symbol_conf.exclude_other,
|
|
|
"Only display entries with parent-match"),
|
|
|
- OPT_CALLBACK_DEFAULT('g', "call-graph", NULL, "output_type,min_percent",
|
|
|
- "Display callchains using output_type (graph, flat, fractal, or none) and min percent threshold. "
|
|
|
- "Default: fractal,0.5", &parse_callchain_opt, callchain_default_opt),
|
|
|
+ OPT_CALLBACK_DEFAULT('g', "call-graph", NULL, "output_type,min_percent, call_order",
|
|
|
+ "Display callchains using output_type (graph, flat, fractal, or none) , min percent threshold and callchain order. "
|
|
|
+ "Default: fractal,0.5,callee", &parse_callchain_opt, callchain_default_opt),
|
|
|
+ OPT_BOOLEAN('G', "inverted", &inverted_callchain, "alias for inverted call graph"),
|
|
|
OPT_STRING('d', "dsos", &symbol_conf.dso_list_str, "dso[,dso...]",
|
|
|
"only consider symbols in these dsos"),
|
|
|
OPT_STRING('C', "comms", &symbol_conf.comm_list_str, "comm[,comm...]",
|
|
@@ -467,6 +485,9 @@ int cmd_report(int argc, const char **argv, const char *prefix __used)
|
|
|
else if (use_tui)
|
|
|
use_browser = 1;
|
|
|
|
|
|
+ if (inverted_callchain)
|
|
|
+ callchain_param.order = ORDER_CALLER;
|
|
|
+
|
|
|
if (strcmp(input_name, "-") != 0)
|
|
|
setup_browser(true);
|
|
|
else
|