All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: Wang Nan <wangnan0@huawei.com>
Cc: acme@kernel.org, linux-kernel@vger.kernel.org, pi3orama@163.com,
	Adrian Hunter <adrian.hunter@intel.com>,
	He Kuang <hekuang@huawei.com>, Jiri Olsa <jolsa@kernel.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>, Zefan Li <lizefan@huawei.com>
Subject: Re: [PATCH v5 1/6] perf tools: Derive trigger class from auxtrace_snapshot
Date: Wed, 20 Apr 2016 09:46:10 +0200	[thread overview]
Message-ID: <20160420074610.GB25541@krava.redhat.com> (raw)
In-Reply-To: <1460991332-185772-2-git-send-email-wangnan0@huawei.com>

On Mon, Apr 18, 2016 at 02:55:27PM +0000, Wang Nan wrote:

SNIP

> -static volatile int auxtrace_snapshot_err;
>  static volatile int auxtrace_record__snapshot_started;
> +static DEFINE_TRIGGER(auxtrace_snapshot);
>  
>  static void sig_handler(int sig)
>  {
> @@ -282,11 +247,12 @@ static void record__read_auxtrace_snapshot(struct record *rec)
>  {
>  	pr_debug("Recording AUX area tracing snapshot\n");
>  	if (record__auxtrace_read_snapshot_all(rec) < 0) {
> -		auxtrace_snapshot_err = -1;
> +		auxtrace_snapshot_error();
>  	} else {
> -		auxtrace_snapshot_err = auxtrace_record__snapshot_finish(rec->itr);
> -		if (!auxtrace_snapshot_err)
> -			auxtrace_snapshot_enable();
> +		if (auxtrace_record__snapshot_finish(rec->itr))
> +			auxtrace_snapshot_error();
> +		else
> +			auxtrace_snapshot_ready();
>  	}
>  }
>  
> @@ -815,21 +781,21 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
>  		perf_evlist__enable(rec->evlist);
>  	}
>  
> -	auxtrace_snapshot_enable();
> +	auxtrace_snapshot_ready();
>  	for (;;) {
>  		unsigned long long hits = rec->samples;
>  
>  		if (record__mmap_read_all(rec) < 0) {
> -			auxtrace_snapshot_disable();
> +			auxtrace_snapshot_error();
>  			err = -1;
>  			goto out_child;
>  		}
>  
>  		if (auxtrace_record__snapshot_started) {
>  			auxtrace_record__snapshot_started = 0;

I'm ok with the chenge, however what I wanted to understand
is why we need auxtrace_record__snapshot_started ;-)

could we get rid of it like in the patch below?

thanks,
jirka


---
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index ad37f6937410..e220bd5eea0e 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -128,7 +128,6 @@ static volatile int done;
 static volatile int signr = -1;
 static volatile int child_finished;
 
-static volatile int auxtrace_record__snapshot_started;
 static DEFINE_TRIGGER(auxtrace_snapshot);
 
 static void sig_handler(int sig)
@@ -791,8 +790,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
 			goto out_child;
 		}
 
-		if (auxtrace_record__snapshot_started) {
-			auxtrace_record__snapshot_started = 0;
+		if (auxtrace_snapshot_is_toggled()) {
 			if (!auxtrace_snapshot_is_error())
 				record__read_auxtrace_snapshot(rec);
 			if (auxtrace_snapshot_is_error()) {
@@ -1416,7 +1414,6 @@ static void snapshot_sig_handler(int sig __maybe_unused)
 	if (!auxtrace_snapshot_is_ready())
 		return;
 	auxtrace_snapshot_toggle();
-	auxtrace_record__snapshot_started = 1;
 	if (auxtrace_record__snapshot_start(record.itr))
 		auxtrace_snapshot_error();
 }

  reply	other threads:[~2016-04-20  7:46 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-18 14:55 [PATCH v5 0/6] perf tools: Use SIGUSR2 control data dumpping Wang Nan
2016-04-18 14:55 ` [PATCH v5 1/6] perf tools: Derive trigger class from auxtrace_snapshot Wang Nan
2016-04-20  7:46   ` Jiri Olsa [this message]
2016-04-20 13:20   ` Namhyung Kim
2016-04-18 14:55 ` [PATCH v5 2/6] perf record: Split output into multiple files via '--switch-output' Wang Nan
2016-04-20  7:54   ` Jiri Olsa
2016-04-18 14:55 ` [PATCH v5 3/6] perf record: Force enable --timestamp-filename when --switch-output is provided Wang Nan
2016-04-20  7:59   ` Jiri Olsa
2016-04-20  8:21     ` Wangnan (F)
2016-04-20 12:29       ` Jiri Olsa
2016-04-18 14:55 ` [PATCH v5 4/6] perf record: Disable buildid cache options by default in switch output mode Wang Nan
2016-04-18 14:55 ` [PATCH v5 5/6] perf record: Re-synthesize tracking events after output switching Wang Nan
2016-04-18 14:55 ` [PATCH v5 6/6] perf record: Generate tracking events for process forked by perf Wang Nan

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=20160420074610.GB25541@krava.redhat.com \
    --to=jolsa@redhat.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=hekuang@huawei.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=mhiramat@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=pi3orama@163.com \
    --cc=wangnan0@huawei.com \
    /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.