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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sat, 6 Jun 2020 22:30:49 +0800
From:   Changbin Du <changbin.du@...il.com>
To:     Arnaldo Carvalho de Melo <arnaldo.melo@...il.com>
Cc:     Changbin Du <changbin.du@...il.com>, Jiri Olsa <jolsa@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Namhyung Kim <namhyung@...nel.org>,
        Steven Rostedt <rostedt@...dmis.org>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 17/19] perf ftrace: add option -d/--delay to delay tracing

On Wed, May 20, 2020 at 06:13:31PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Sun, May 10, 2020 at 11:06:26PM +0800, Changbin Du escreveu:
> > This adds an option '-d/--delay' to allow us to start tracing some
> > times later after workload is launched.
> 
> [acme@...e perf]$ perf record -h delay
> 
>  Usage: perf record [<options>] [<command>]
>     or: perf record [<options>] -- <command> [<options>]
> 
>     -D, --delay <n>       ms to wait before starting measurement after program start
> 
> [acme@...e perf]$
>
Sure, will change the short option name.

> > Signed-off-by: Changbin Du <changbin.du@...il.com>
> > ---
> >  tools/perf/builtin-ftrace.c | 19 ++++++++++++++++---
> >  1 file changed, 16 insertions(+), 3 deletions(-)
> > 
> > diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c
> > index 8d04e5afe2d3..d376b37c53fc 100644
> > --- a/tools/perf/builtin-ftrace.c
> > +++ b/tools/perf/builtin-ftrace.c
> > @@ -49,6 +49,7 @@ struct perf_ftrace {
> >  	bool			trace_children;
> >  	unsigned		buffer_size_kb;
> >  	bool			no_pager;
> > +	unsigned		initial_delay;
> >  };
> >  
> >  struct filter_entry {
> > @@ -617,13 +618,23 @@ static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv)
> >  	/* display column headers */
> >  	read_tracing_file_to_stdout("trace");
> >  
> > -	if (write_tracing_file("tracing_on", "1") < 0) {
> > -		pr_err("can't enable tracing\n");
> > -		goto out_close_fd;
> > +	if (!ftrace->initial_delay) {
> > +		if (write_tracing_file("tracing_on", "1") < 0) {
> > +			pr_err("can't enable tracing\n");
> > +			goto out_close_fd;
> > +		}
> >  	}
> >  
> >  	perf_evlist__start_workload(ftrace->evlist);
> >  
> > +	if (ftrace->initial_delay) {
> > +		usleep(ftrace->initial_delay * 1000);
> > +		if (write_tracing_file("tracing_on", "1") < 0) {
> > +			pr_err("can't enable tracing\n");
> > +			goto out_close_fd;
> > +		}
> > +	}
> > +
> >  	while (!done) {
> >  		if (poll(&pollfd, 1, -1) < 0)
> >  			break;
> > @@ -747,6 +758,8 @@ int cmd_ftrace(int argc, const char **argv)
> >  		     "size of per cpu buffer in kb"),
> >  	OPT_BOOLEAN('P', "no-pager", &ftrace.no_pager,
> >  		    "Do not use pager"),
> > +	OPT_UINTEGER('d', "delay", &ftrace.initial_delay,
> > +		     "Wait <n> ms before tracing"),
> >  	OPT_END()
> >  	};
> >  
> > -- 
> > 2.25.1
> > 
> 
> -- 
> 
> - Arnaldo

-- 
Cheers,
Changbin Du

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ