All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <andi@firstfloor.org>,
	jolsa@kernel.org, linux-kernel@vger.kernel.org,
	kim.phillips@arm.com, Andi Kleen <ak@linux.intel.com>
Subject: Re: [PATCH v5 6/9] perf, tools, script: Make itrace script default to all calls
Date: Wed, 19 Sep 2018 15:28:37 -0300	[thread overview]
Message-ID: <20180919182837.GH31812@kernel.org> (raw)
In-Reply-To: <fa942e47-9654-dfa2-7a57-744b5fd3b790@intel.com>

Em Tue, Sep 18, 2018 at 04:24:55PM +0300, Adrian Hunter escreveu:
> On 18/09/18 15:32, Andi Kleen wrote:
> > +++ b/tools/perf/util/auxtrace.c
> > @@ -964,16 +964,23 @@ s64 perf_event__process_auxtrace(struct perf_tool *tool,
> >  #define PERF_ITRACE_DEFAULT_LAST_BRANCH_SZ	64
> >  #define PERF_ITRACE_MAX_LAST_BRANCH_SZ		1024
> >  
> > -void itrace_synth_opts__set_default(struct itrace_synth_opts *synth_opts)
> > +void itrace_synth_opts__set_default(struct itrace_synth_opts *synth_opts,
> > +				    bool no_sample)
> 
> Rather than pass no_sample, what about passing the whole of the tool's
> options i.e.

This can be done on top, right? Or will you need the other options on
work you're doing right now and that would be an advantage to do this
right now?

- Arnaldo
 
> diff --git a/tools/perf/util/auxtrace.c b/tools/perf/util/auxtrace.c
> index db1511359c5e..d4db61626a5f 100644
> --- a/tools/perf/util/auxtrace.c
> +++ b/tools/perf/util/auxtrace.c
> @@ -964,8 +964,14 @@ s64 perf_event__process_auxtrace(struct perf_tool *tool,
>  #define PERF_ITRACE_DEFAULT_LAST_BRANCH_SZ	64
>  #define PERF_ITRACE_MAX_LAST_BRANCH_SZ		1024
>  
> -void itrace_synth_opts__set_default(struct itrace_synth_opts *synth_opts)
> +bool itrace_synth_opts__set_default(struct itrace_synth_opts *synth_opts,
> +				    const struct itrace_synth_opts *tool_synth_opts)
>  {
> +	if (tool_synth_opts && tool_synth_opts->set) {
> +		*synth_opts = *tool_synth_opts;
> +		return false;
> +	}
> +
>  	synth_opts->instructions = true;
>  	synth_opts->branches = true;
>  	synth_opts->transactions = true;
> @@ -977,6 +983,8 @@ void itrace_synth_opts__set_default(struct itrace_synth_opts *synth_opts)
>  	synth_opts->callchain_sz = PERF_ITRACE_DEFAULT_CALLCHAIN_SZ;
>  	synth_opts->last_branch_sz = PERF_ITRACE_DEFAULT_LAST_BRANCH_SZ;
>  	synth_opts->initial_skip = 0;
> +
> +	return true;
>  }
>  
>  /*
> @@ -1001,7 +1009,7 @@ int itrace_parse_synth_opts(const struct option *opt, const char *str,
>  	}
>  
>  	if (!str) {
> -		itrace_synth_opts__set_default(synth_opts);
> +		itrace_synth_opts__set_default(synth_opts, NULL);
>  		return 0;
>  	}
>  
> diff --git a/tools/perf/util/auxtrace.h b/tools/perf/util/auxtrace.h
> index a516a891d7ea..172c92a8c596 100644
> --- a/tools/perf/util/auxtrace.h
> +++ b/tools/perf/util/auxtrace.h
> @@ -528,7 +528,8 @@ int perf_event__process_auxtrace_error(struct perf_tool *tool,
>  				       struct perf_session *session);
>  int itrace_parse_synth_opts(const struct option *opt, const char *str,
>  			    int unset);
> -void itrace_synth_opts__set_default(struct itrace_synth_opts *synth_opts);
> +bool itrace_synth_opts__set_default(struct itrace_synth_opts *synth_opts,
> +				    const struct itrace_synth_opts *tool_synth_opts);
>  
>  size_t perf_event__fprintf_auxtrace_error(union perf_event *event, FILE *fp);
>  void perf_session__auxtrace_error_inc(struct perf_session *session,
> diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
> index 2ae640257fdb..45b9a2b9f473 100644
> --- a/tools/perf/util/cs-etm.c
> +++ b/tools/perf/util/cs-etm.c
> @@ -1429,12 +1429,9 @@ int cs_etm__process_auxtrace_info(union perf_event *event,
>  		return 0;
>  	}
>  
> -	if (session->itrace_synth_opts && session->itrace_synth_opts->set) {
> -		etm->synth_opts = *session->itrace_synth_opts;
> -	} else {
> -		itrace_synth_opts__set_default(&etm->synth_opts);
> +	if (itrace_synth_opts__set_default(&etm->synth_opts,
> +					   session->itrace_synth_opts))
>  		etm->synth_opts.callchain = false;
> -	}
>  
>  	err = cs_etm__synth_events(etm, session);
>  	if (err)
> diff --git a/tools/perf/util/intel-bts.c b/tools/perf/util/intel-bts.c
> index 7f0c83b6332b..2d96f4743789 100644
> --- a/tools/perf/util/intel-bts.c
> +++ b/tools/perf/util/intel-bts.c
> @@ -907,12 +907,9 @@ int intel_bts_process_auxtrace_info(union perf_event *event,
>  	if (dump_trace)
>  		return 0;
>  
> -	if (session->itrace_synth_opts && session->itrace_synth_opts->set) {
> -		bts->synth_opts = *session->itrace_synth_opts;
> -	} else {
> -		itrace_synth_opts__set_default(&bts->synth_opts);
> -		if (session->itrace_synth_opts)
> -			bts->synth_opts.thread_stack =
> +	if (itrace_synth_opts__set_default(&bts->synth_opts,
> +					   session->itrace_synth_opts)) {
> +		bts->synth_opts.thread_stack =
>  				session->itrace_synth_opts->thread_stack;
>  	}
>  
> diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c
> index aec68908d604..b6ac8ac2f4c3 100644
> --- a/tools/perf/util/intel-pt.c
> +++ b/tools/perf/util/intel-pt.c
> @@ -2551,10 +2551,8 @@ int intel_pt_process_auxtrace_info(union perf_event *event,
>  		goto err_delete_thread;
>  	}
>  
> -	if (session->itrace_synth_opts && session->itrace_synth_opts->set) {
> -		pt->synth_opts = *session->itrace_synth_opts;
> -	} else {
> -		itrace_synth_opts__set_default(&pt->synth_opts);
> +	if (itrace_synth_opts__set_default(&pt->synth_opts,
> +					   session->itrace_synth_opts)) {
>  		if (use_browser != -1) {
>  			pt->synth_opts.branches = false;
>  			pt->synth_opts.callchain = true;

  reply	other threads:[~2018-09-19 18:28 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-18 12:32 Make perf script easier to use for itrace Andi Kleen
2018-09-18 12:32 ` [PATCH v5 1/9] perf tools: Report itrace options in help Andi Kleen
2018-09-19 18:13   ` Arnaldo Carvalho de Melo
2018-09-18 12:32 ` [PATCH v5 2/9] tools, pager: Support overwriting the pager Andi Kleen
2018-09-19 18:17   ` Arnaldo Carvalho de Melo
2018-09-26  8:44   ` [tip:perf/core] tools lib subcmd: " tip-bot for Andi Kleen
2018-09-18 12:32 ` [PATCH v5 3/9] tools, perf, script: Add --insn-trace for instruction decoding Andi Kleen
2018-09-18 12:32 ` [PATCH v5 4/9] perf, tools, script: Allow sym and dso without ip, addr Andi Kleen
2018-09-19 18:24   ` Arnaldo Carvalho de Melo
2018-09-26  8:44   ` [tip:perf/core] perf " tip-bot for Andi Kleen
2018-09-18 12:32 ` [PATCH v5 5/9] perf, tools, script: Print DSO for callindent Andi Kleen
2018-09-19 18:26   ` Arnaldo Carvalho de Melo
2018-09-26  8:45   ` [tip:perf/core] perf " tip-bot for Andi Kleen
2018-09-18 12:32 ` [PATCH v5 6/9] perf, tools, script: Make itrace script default to all calls Andi Kleen
2018-09-18 13:24   ` Adrian Hunter
2018-09-19 18:28     ` Arnaldo Carvalho de Melo [this message]
2018-09-18 12:32 ` [PATCH v5 7/9] tools, perf, script: Add --call-trace and --call-ret-trace Andi Kleen
2018-09-18 12:32 ` [PATCH v5 8/9] tools, perf, script: Implement --graph-function Andi Kleen
2018-09-18 12:32 ` [PATCH v5 9/9] perf, tools, script: Support total cycles count Andi Kleen
2018-09-19 18:31   ` Arnaldo Carvalho de Melo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180919182837.GH31812@kernel.org \
    --to=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=ak@linux.intel.com \
    --cc=andi@firstfloor.org \
    --cc=jolsa@kernel.org \
    --cc=kim.phillips@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.