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: <20200520210914.GC32678@kernel.org>
Date:   Wed, 20 May 2020 18:09:14 -0300
From:   Arnaldo Carvalho de Melo <acme@...nel.org>
To:     Changbin Du <changbin.du@...il.com>
Cc:     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 14/19] perf ftrace: add option -P/--no-pager to disable
 pager

Em Sun, May 10, 2020 at 11:06:23PM +0800, Changbin Du escreveu:
> Sometimes we want perf displays trace immediately. So this adds an option
> '-P/--no-pager' to disable pager if needed.


Try:

perf record sleep 5
perf script

Then:

perf --no-pager script

I.e. its there already.

- Arnaldo

> 
> Signed-off-by: Changbin Du <changbin.du@...il.com>
> ---
>  tools/perf/builtin-ftrace.c | 17 ++++++++++++++---
>  1 file changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c
> index a93fbdac6aa4..64c22f367ba2 100644
> --- a/tools/perf/builtin-ftrace.c
> +++ b/tools/perf/builtin-ftrace.c
> @@ -48,6 +48,7 @@ struct perf_ftrace {
>  	unsigned		tracing_thresh;
>  	bool			trace_children;
>  	unsigned		buffer_size_kb;
> +	bool			no_pager;
>  };
>  
>  struct filter_entry {
> @@ -56,6 +57,7 @@ struct filter_entry {
>  };
>  
>  static volatile int workload_exec_errno;
> +static bool interrupted;
>  static bool done;
>  
>  static void sig_handler(int sig __maybe_unused)
> @@ -63,6 +65,12 @@ static void sig_handler(int sig __maybe_unused)
>  	done = true;
>  }
>  
> +static void sig_handler_int(int sig __maybe_unused)
> +{
> +	sig_handler(sig);
> +	interrupted = 1;
> +}
> +
>  /*
>   * perf_evlist__prepare_workload will send a SIGUSR1 if the fork fails, since
>   * we asked by setting its exec_error to the function below,
> @@ -492,7 +500,7 @@ static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv)
>  		return -1;
>  	}
>  
> -	signal(SIGINT, sig_handler);
> +	signal(SIGINT, sig_handler_int);
>  	signal(SIGUSR1, sig_handler);
>  	signal(SIGCHLD, sig_handler);
>  	signal(SIGPIPE, sig_handler);
> @@ -585,7 +593,8 @@ static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv)
>  		goto out_reset;
>  	}
>  
> -	setup_pager();
> +	if (!ftrace->no_pager)
> +		setup_pager();
>  
>  	trace_file = get_tracing_file("trace_pipe");
>  	if (!trace_file) {
> @@ -636,7 +645,7 @@ static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv)
>  	}
>  
>  	/* read remaining buffer contents */
> -	while (true) {
> +	while (true && !interrupted) {
>  		int n = read(trace_fd, buf, sizeof(buf));
>  		if (n <= 0)
>  			break;
> @@ -731,6 +740,8 @@ int cmd_ftrace(int argc, const char **argv)
>  		    "Trace children processes"),
>  	OPT_UINTEGER('b', "buffer-size", &ftrace.buffer_size_kb,
>  		     "size of per cpu buffer in kb"),
> +	OPT_BOOLEAN('P', "no-pager", &ftrace.no_pager,
> +		    "Do not use pager"),
>  	OPT_END()
>  	};
>  
> -- 
> 2.25.1
> 

-- 

- Arnaldo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ