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]
Date:	Wed, 05 Jun 2013 19:33:05 -0600
From:	David Ahern <dsahern@...il.com>
To:	Namhyung Kim <namhyung@...nel.org>
CC:	Arnaldo Carvalho de Melo <acme@...stprotocols.net>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Paul Mackerras <paulus@...ba.org>,
	Ingo Molnar <mingo@...nel.org>,
	Namhyung Kim <namhyung.kim@....com>,
	LKML <linux-kernel@...r.kernel.org>,
	Andi Kleen <andi@...stfloor.org>, Jiri Olsa <jolsa@...hat.com>,
	Stephane Eranian <eranian@...gle.com>,
	Joonsoo Kim <iamjoonsoo.kim@....com>
Subject: Re: [PATCH v2 3/4] perf report: Add --time-filter option

On 6/2/13 10:44 PM, Namhyung Kim wrote:
> From: Namhyung Kim <namhyung.kim@....com>
>
> The --time-filter option is for limiting samples within a range of
> time.  A time range looks like <time1>-<time2> and at most one of them
> can be omitted.  This can be useful when analyzing a part of a huge
> data only.
>
> Cc: Joonsoo Kim <iamjoonsoo.kim@....com>
> Cc: David Ahern <dsahern@...il.com>
> Signed-off-by: Namhyung Kim <namhyung@...nel.org>

Acked-Tested-by: David Ahern <dsahern@...il.com>


> ---
>   tools/perf/Documentation/perf-report.txt |  7 +++++++
>   tools/perf/builtin-report.c              | 27 +++++++++++++++++++++++++++
>   2 files changed, 34 insertions(+)
>
> diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt
> index 66dab7410c1d..04a96f657ca7 100644
> --- a/tools/perf/Documentation/perf-report.txt
> +++ b/tools/perf/Documentation/perf-report.txt
> @@ -214,6 +214,13 @@ OPTIONS
>   	Do not show entries which have an overhead under that percent.
>   	(Default: 0).
>
> +-X::
> +--time-filter::
> +	Report samples within a range of time only. A time range can be given
> +	like 'time1-time2' and treated as a start time and end time
> +	respectively. The time format is like "<sec>.<usec>". Either of time1
> +	or time2 can be omitted.
> +
>   SEE ALSO
>   --------
>   linkperf:perf-stat[1], linkperf:perf-annotate[1]
> diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
> index ca98d34cd58b..e09e1bdb1401 100644
> --- a/tools/perf/builtin-report.c
> +++ b/tools/perf/builtin-report.c
> @@ -53,6 +53,7 @@ struct perf_report {
>   	const char		*cpu_list;
>   	const char		*symbol_filter_str;
>   	float			min_percent;
> +	u64			time_start, time_end;
>   	DECLARE_BITMAP(cpu_bitmap, MAX_NR_CPUS);
>   };
>
> @@ -318,6 +319,12 @@ static int process_sample_event(struct perf_tool *tool,
>   	if (rep->cpu_list && !test_bit(sample->cpu, rep->cpu_bitmap))
>   		return 0;
>
> +	if (rep->time_start && rep->time_start > sample->time)
> +		return 0;
> +
> +	if (rep->time_end && rep->time_end < sample->time)
> +		return 0;
> +
>   	if (sort__mode == SORT_MODE__BRANCH) {
>   		ret = perf_report__add_branch_hist_entry(tool, &al, sample,
>   							 evsel, machine);
> @@ -714,6 +721,24 @@ parse_percent_limit(const struct option *opt, const char *str,
>   	return 0;
>   }
>
> +static int
> +parse_time_filter(const struct option *opt, const char *str,
> +		  int unset __maybe_unused)
> +{
> +	struct perf_report *rep = opt->value;
> +	char *sep;
> +
> +	sep = strchr(str, '-');
> +	if (sep == NULL)
> +		return parse_nsec_time(str, &rep->time_start);
> +	else if (sep == str)
> +		return parse_nsec_time(++str, &rep->time_end);
> +
> +	*sep++ = '\0';
> +	return parse_nsec_time(str, &rep->time_start) ||
> +		parse_nsec_time(sep , &rep->time_end);
> +}
> +
>   int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
>   {
>   	struct perf_session *session;
> @@ -825,6 +850,8 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
>   	OPT_BOOLEAN(0, "mem-mode", &report.mem_mode, "mem access profile"),
>   	OPT_CALLBACK(0, "percent-limit", &report, "percent",
>   		     "Don't show entries under that percent", parse_percent_limit),
> +	OPT_CALLBACK('X', "time-filter", &report, "time[-time]",
> +		     "Only display entries in the time range", parse_time_filter),
>   	OPT_END()
>   	};
>
>

--
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