linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
To: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@redhat.com>,
	linux-kernel@vger.kernel.org, Namhyung Kim <namhyung@kernel.org>
Subject: Re: [PATCH 1/3] perf record: support duration option to run during specified time
Date: Fri, 28 Jun 2013 17:27:24 -0700	[thread overview]
Message-ID: <20130629002724.GB5117@us.ibm.com> (raw)
In-Reply-To: <1371603750-15053-1-git-send-email-iamjoonsoo.kim@lge.com>

Joonsoo Kim [iamjoonsoo.kim@lge.com] wrote:
| Currently, there is no method to quit at specified time later.
| We are used to using 'sleep N' as command argument if we need it,
| but explicitly supporting this feature maybe makes sense.
| 
| Cc: Namhyung Kim <namhyung@kernel.org>
| Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
| 
| diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
| index cdf58ec..19c65b5 100644
| --- a/tools/perf/builtin-record.c
| +++ b/tools/perf/builtin-record.c
| @@ -29,6 +29,7 @@
|  #include <sched.h>
|  #include <sys/mman.h>
| 
| +static unsigned int duration;
|  #ifndef HAVE_ON_EXIT
|  #ifndef ATEXIT_MAX
|  #define ATEXIT_MAX 32
| @@ -194,7 +195,7 @@ static void perf_record__sig_exit(int exit_status __maybe_unused, void *arg)
|  			psignal(WTERMSIG(status), rec->progname);
|  	}
| 
| -	if (signr == -1 || signr == SIGUSR1)
| +	if (signr == -1 || signr == SIGUSR1 || signr == SIGALRM)
|  		return;
| 
|  	signal(signr, SIG_DFL);
| @@ -404,6 +405,7 @@ static int __cmd_record(struct perf_record *rec, int argc, const char **argv)
|  	signal(SIGCHLD, sig_handler);
|  	signal(SIGINT, sig_handler);
|  	signal(SIGUSR1, sig_handler);
| +	signal(SIGALRM, sig_handler);
| 
|  	if (!output_name) {
|  		if (!fstat(STDOUT_FILENO, &st) && S_ISFIFO(st.st_mode))
| @@ -471,6 +473,7 @@ static int __cmd_record(struct perf_record *rec, int argc, const char **argv)
|  			goto out_delete_session;
|  	}
| 
| +	alarm(duration);
|  	if (forks) {
|  		err = perf_evlist__prepare_workload(evsel_list, &opts->target,
|  						    argv, opts->pipe_output,
| @@ -955,6 +958,7 @@ const struct option record_options[] = {
|  		     parse_branch_stack),
|  	OPT_BOOLEAN('W', "weight", &record.opts.sample_weight,
|  		    "sample by weight (on special events only)"),
| +	OPT_UINTEGER(0, "duration", &duration, "run during specified seconds"),

nit: A slight ambiguity in the help text. Would you mind changing it to:

	"run for specified duration (seconds)" ?

Sukadev


  parent reply	other threads:[~2013-06-29  0:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-19  1:02 [PATCH 1/3] perf record: support duration option to run during specified time Joonsoo Kim
2013-06-19  1:02 ` [PATCH 2/3] tools lib lk: Fix for cross build Joonsoo Kim
2013-07-12  8:50   ` [tip:perf/urgent] " tip-bot for Joonsoo Kim
2013-06-19  1:02 ` [PATCH 3/3] perf tools: include termios.h explicitly Joonsoo Kim
2013-06-19 11:33   ` Ingo Molnar
2013-06-19 12:16     ` Namhyung Kim
2013-06-20  1:45       ` Joonsoo Kim
2013-06-19 14:52   ` David Ahern
2013-07-12  8:49   ` [tip:perf/urgent] perf tools: Include " tip-bot for Joonsoo Kim
2013-06-29  0:27 ` Sukadev Bhattiprolu [this message]
2013-07-01  5:46   ` [PATCH 1/3] perf record: support duration option to run during specified time Joonsoo Kim

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=20130629002724.GB5117@us.ibm.com \
    --to=sukadev@linux.vnet.ibm.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@ghostprotocols.net \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=paulus@samba.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).