Re: [PATCH RFC V6 5/6] perf,tool: per-event callgraph support

From: Jiri Olsa
Date: Wed Jul 29 2015 - 07:49:01 EST


On Mon, Jul 27, 2015 at 08:21:38AM -0400, Kan Liang wrote:

SNIP

>
> -static void apply_config_terms(struct perf_evsel *evsel)
> +static void apply_config_terms(struct perf_evsel *evsel,
> + struct record_opts *opts)
> {
> struct perf_evsel_config_term *term;
> struct list_head *config_terms = &evsel->config_terms;
> struct perf_event_attr *attr = &evsel->attr;
> + struct callchain_param param;
> + bool callgraph_set = false;
> +
> + /* callgraph default */
> + param.record_mode = callchain_param.record_mode;
> + param.dump_size = 8192;
>
> list_for_each_entry(term, config_terms, list) {
> switch (term->type) {
> @@ -604,10 +612,49 @@ static void apply_config_terms(struct perf_evsel *evsel)
> else
> perf_evsel__reset_sample_bit(evsel, TIME);
> break;
> + case PERF_EVSEL__CONFIG_TERM_CALLGRAPH:
> + if (!strcmp(term->val.callgraph, "fp")) {
> + param.enabled = true;
> + param.record_mode = CALLCHAIN_FP;
> + } else if (!strcmp(term->val.callgraph, "dwarf")) {
> + param.enabled = true;
> + param.record_mode = CALLCHAIN_DWARF;
> + } else if (!strcmp(term->val.callgraph, "lbr")) {
> + param.enabled = true;
> + param.record_mode = CALLCHAIN_LBR;
> + } else if (!strcmp(term->val.callgraph, "no")) {
> + param.enabled = false;
> + } else {
> + pr_warning("%s is no valid callchain type.\n", term->val.callgraph);
> + }
> + callgraph_set = true;
> + break;
> + case PERF_EVSEL__CONFIG_TERM_STACK_USER:
> + param.dump_size = term->val.stack_user;
> + callgraph_set = true;
> + break;

could this get somehow unified with parse_callchain_record_opt?
it'd be nice to have this setup on single place..

jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/