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: <1383298146-3860-5-git-send-email-chenggang.qin@gmail.com>
Date:	Fri,  1 Nov 2013 17:29:06 +0800
From:	Chenggang Qin <chenggang.qin@...il.com>
To:	linux-kernel@...r.kernel.org
Cc:	Chenggang Qin <chenggang.qin@...il.com>,
	David Ahern <dsahern@...il.com>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Paul Mackerras <paulus@...ba.org>,
	Ingo Molnar <mingo@...hat.com>,
	Arnaldo Carvalho de Melo <acme@...stprotocols.net>,
	Arjan van de Ven <arjan@...ux.intel.com>,
	Namhyung Kim <namhyung@...il.com>,
	Yanmin Zhang <yanmin.zhang@...el.com>,
	Wu Fengguang <fengguang.wu@...el.com>,
	Mike Galbraith <efault@....de>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Chenggang Qin <chenggang.qcg@...bao.com>
Subject: [PATCH 4/4] perf tools: add the feature to assign analysis interval to perf report

Only process the samples whose timestamp is in [start, end).

Cc: David Ahern <dsahern@...il.com>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: Paul Mackerras <paulus@...ba.org>
Cc: Ingo Molnar <mingo@...hat.com>
Cc: Arnaldo Carvalho de Melo <acme@...stprotocols.net>
Cc: Arjan van de Ven <arjan@...ux.intel.com>
Cc: Namhyung Kim <namhyung@...il.com>
Cc: Yanmin Zhang <yanmin.zhang@...el.com>
Cc: Wu Fengguang <fengguang.wu@...el.com>
Cc: Mike Galbraith <efault@....de>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Signed-off-by: Chenggang Qin <chenggang.qcg@...bao.com>

---
 tools/perf/util/session.c |   43 +++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 41 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 4e9dd66..d50e29e 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -532,6 +532,9 @@ static int flush_sample_queue(struct perf_session *s,
 	bool show_progress = limit == ULLONG_MAX;
 	int ret;
 
+	if (limit > s->tend)
+		limit = s->tend;
+
 	if (!tool->ordered_samples || !limit)
 		return 0;
 
@@ -539,6 +542,9 @@ static int flush_sample_queue(struct perf_session *s,
 		if (session_done())
 			return 0;
 
+		if (iter->timestamp < s->tstart)
+			continue;
+
 		if (iter->timestamp > limit)
 			break;
 
@@ -617,7 +623,26 @@ static int process_finished_round(struct perf_tool *tool,
 				  union perf_event *event __maybe_unused,
 				  struct perf_session *session)
 {
-	int ret = flush_sample_queue(session, tool);
+	int ret = 0;
+
+	/*
+	 * The next round should be processed continue.
+	 * But, this round is skipped.
+	 */
+	if (session->ordered_samples.next_flush < session->tstart) {
+		session->ordered_samples.next_flush = session->ordered_samples.max_timestamp;
+		return ret;
+	}
+
+	/*
+	 * This round & all followed rounds are skipped.
+	 */
+	if (session->ordered_samples.min_timestamp > session->tend) {
+		session->ordered_samples.next_flush = ULLONG_MAX;
+		return ret;
+	}
+
+	ret = flush_sample_queue(session, tool);
 	if (!ret)
 		session->ordered_samples.next_flush = session->ordered_samples.max_timestamp;
 
@@ -1373,6 +1398,14 @@ more:
 		goto out_err;
 	}
 
+	/*
+	 * After process a finished round event:
+	 * The minimal timestamp in os->samples is greater than
+	 * tend, so, the followed  events couldn't be processed.
+	 */
+	if (session->ordered_samples.next_flush == ULLONG_MAX)
+		goto out_err;
+
 	head += size;
 	file_pos += size;
 
@@ -1389,8 +1422,14 @@ more:
 	if (file_pos < file_size)
 		goto more;
 
+	if (session->ordered_samples.max_timestamp < session->tstart)
+		goto out_err;
+
+	if (session->ordered_samples.min_timestamp > session->tend)
+		goto out_err;
+
 	/* do the final flush for ordered samples */
-	session->ordered_samples.next_flush = ULLONG_MAX;
+	session->ordered_samples.next_flush = session->tend;
 	err = flush_sample_queue(session, tool);
 out_err:
 	ui_progress__finish();
-- 
1.7.8.rc2.5.g815b

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