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: <20160121005245.GM18367@kernel.org>
Date:	Wed, 20 Jan 2016 21:52:45 -0300
From:	Arnaldo Carvalho de Melo <acme@...nel.org>
To:	Namhyung Kim <namhyung@...nel.org>
Cc:	Ingo Molnar <mingo@...nel.org>,
	Peter Zijlstra <peterz@...radead.org>,
	Jiri Olsa <jolsa@...nel.org>,
	LKML <linux-kernel@...r.kernel.org>,
	David Ahern <dsahern@...il.com>,
	Stephane Eranian <eranian@...gle.com>,
	Andi Kleen <andi@...stfloor.org>,
	Wang Nan <wangnan0@...wei.com>
Subject: Re: [PATCH 08/17] perf hists browser: Fix context menu item

Em Sun, Jan 17, 2016 at 01:03:08AM +0900, Namhyung Kim escreveu:
> When symbol sort key is not given, it doesn't show any item other than
> exit.  Check sort key to select possible items.  Also check items more
> strictly using sort key information.

So, without this patch when I press enter on 'perf top' I can zoom into
threads, with it I lose that option.

- Arnaldo
 
> Signed-off-by: Namhyung Kim <namhyung@...nel.org>
> ---
>  tools/perf/ui/browsers/hists.c | 50 ++++++++++++++++++++++++------------------
>  tools/perf/util/sort.c         |  3 +++
>  tools/perf/util/sort.h         |  2 ++
>  3 files changed, 34 insertions(+), 21 deletions(-)
> 
> diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
> index 08c09ad755d2..cd6349ebd0d6 100644
> --- a/tools/perf/ui/browsers/hists.c
> +++ b/tools/perf/ui/browsers/hists.c
> @@ -2263,10 +2263,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
>  			continue;
>  		}
>  
> -		if (!sort__has_sym)
> -			goto add_exit_option;
> -
> -		if (browser->selection == NULL)
> +		if (!sort__has_sym || browser->selection == NULL)
>  			goto skip_annotation;
>  
>  		if (sort__mode == SORT_MODE__BRANCH) {
> @@ -2294,23 +2291,33 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
>  						       browser->selection->sym);
>  		}
>  skip_annotation:
> -		nr_options += add_thread_opt(browser, &actions[nr_options],
> -					     &options[nr_options], thread);
> -		nr_options += add_dso_opt(browser, &actions[nr_options],
> -					  &options[nr_options], map);
> -		nr_options += add_map_opt(browser, &actions[nr_options],
> -					  &options[nr_options],
> -					  browser->selection ?
> -						browser->selection->map : NULL);
> -		nr_options += add_socket_opt(browser, &actions[nr_options],
> -					     &options[nr_options],
> -					     socked_id);
> +		if (sort__has_thread) {
> +			nr_options += add_thread_opt(browser, &actions[nr_options],
> +						     &options[nr_options], thread);
> +		}
> +		if (sort__has_dso) {
> +			nr_options += add_dso_opt(browser, &actions[nr_options],
> +						  &options[nr_options], map);
> +			nr_options += add_map_opt(browser, &actions[nr_options],
> +						  &options[nr_options],
> +						  browser->selection ?
> +						  browser->selection->map : NULL);
> +		}
> +		if (sort__has_socket) {
> +			nr_options += add_socket_opt(browser, &actions[nr_options],
> +						     &options[nr_options],
> +						     socked_id);
> +		}
> +
>  		/* perf script support */
>  		if (browser->he_selection) {
> -			nr_options += add_script_opt(browser,
> -						     &actions[nr_options],
> -						     &options[nr_options],
> -						     thread, NULL);
> +			if (sort__has_thread) {
> +				nr_options += add_script_opt(browser,
> +							     &actions[nr_options],
> +							     &options[nr_options],
> +							     thread, NULL);
> +			}
> +
>  			/*
>  			 * Note that browser->selection != NULL
>  			 * when browser->he_selection is not NULL,
> @@ -2320,16 +2327,17 @@ skip_annotation:
>  			 *
>  			 * See hist_browser__show_entry.
>  			 */
> -			nr_options += add_script_opt(browser,
> +			if (sort__has_sym && browser->selection->sym) {
> +				nr_options += add_script_opt(browser,
>  						     &actions[nr_options],
>  						     &options[nr_options],
>  						     NULL, browser->selection->sym);
> +			}
>  		}
>  		nr_options += add_script_opt(browser, &actions[nr_options],
>  					     &options[nr_options], NULL, NULL);
>  		nr_options += add_switch_opt(browser, &actions[nr_options],
>  					     &options[nr_options]);
> -add_exit_option:
>  		nr_options += add_exit_opt(browser, &actions[nr_options],
>  					   &options[nr_options]);
>  
> diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
> index 4632475bc5e4..8ff873ee39a8 100644
> --- a/tools/perf/util/sort.c
> +++ b/tools/perf/util/sort.c
> @@ -21,6 +21,7 @@ const char	*field_order;
>  regex_t		ignore_callees_regex;
>  int		have_ignore_callees = 0;
>  int		sort__need_collapse = 0;
> +int		sort__has_thread = 0;
>  int		sort__has_parent = 0;
>  int		sort__has_sym = 0;
>  int		sort__has_dso = 0;
> @@ -2249,6 +2250,8 @@ static int sort_dimension__add(const char *tok,
>  			sort__has_dso = 1;
>  		} else if (sd->entry == &sort_socket) {
>  			sort__has_socket = 1;
> +		} else if (sd->entry == &sort_comm || sd->entry == &sort_thread) {
> +			sort__has_thread = 1;
>  		}
>  
>  		return __sort_dimension__add(sd);
> diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
> index 051739615847..879513e61dba 100644
> --- a/tools/perf/util/sort.h
> +++ b/tools/perf/util/sort.h
> @@ -32,7 +32,9 @@ extern const char default_sort_order[];
>  extern regex_t ignore_callees_regex;
>  extern int have_ignore_callees;
>  extern int sort__need_collapse;
> +extern int sort__has_thread;
>  extern int sort__has_parent;
> +extern int sort__has_dso;
>  extern int sort__has_sym;
>  extern int sort__has_socket;
>  extern enum sort_mode sort__mode;
> -- 
> 2.6.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ