lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130629002724.GB5117@us.ibm.com>
Date:	Fri, 28 Jun 2013 17:27:24 -0700
From:	Sukadev Bhattiprolu <sukadev@...ux.vnet.ibm.com>
To:	Joonsoo Kim <iamjoonsoo.kim@....com>
Cc:	Arnaldo Carvalho de Melo <acme@...stprotocols.net>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Paul Mackerras <paulus@...ba.org>,
	Ingo Molnar <mingo@...hat.com>, linux-kernel@...r.kernel.org,
	Namhyung Kim <namhyung@...nel.org>
Subject: Re: [PATCH 1/3] perf record: support duration option to run during
 specified time

Joonsoo Kim [iamjoonsoo.kim@....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@...nel.org>
| Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@....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

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ