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:	Sun,  2 Feb 2014 22:38:56 +0100
From:	Jiri Olsa <jolsa@...hat.com>
To:	linux-kernel@...r.kernel.org
Cc:	Jiri Olsa <jolsa@...hat.com>,
	Corey Ashford <cjashfor@...ux.vnet.ibm.com>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Ingo Molnar <mingo@...e.hu>,
	Namhyung Kim <namhyung@...nel.org>,
	Paul Mackerras <paulus@...ba.org>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Arnaldo Carvalho de Melo <acme@...hat.com>,
	David Ahern <dsahern@...il.com>
Subject: [PATCH 08/22] perf tools: Implement selected logic for time sort entry

Display delta time from the selected entry. Implemented
only for the TUI browser.

Signed-off-by: Jiri Olsa <jolsa@...hat.com>
Cc: Corey Ashford <cjashfor@...ux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@...il.com>
Cc: Ingo Molnar <mingo@...e.hu>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Paul Mackerras <paulus@...ba.org>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: Arnaldo Carvalho de Melo <acme@...hat.com>
Cc: David Ahern <dsahern@...il.com>
---
 tools/perf/ui/browsers/hists.c | 13 +++++++++++++
 tools/perf/util/sort.c         |  6 +++---
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 0f6d515..e26afea 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -27,6 +27,7 @@ struct hist_browser {
 	bool		     show_dso;
 	float		     min_pcnt;
 	u64		     nr_pcnt_entries;
+	u64		     time_base;
 };
 
 extern void hist_browser__init_hpp(void);
@@ -819,12 +820,24 @@ static void ui_browser__hists_init_top(struct ui_browser *browser)
 	}
 }
 
+static void init_time_base(struct hist_browser *hb)
+{
+	struct hists *hists = hb->hists;
+
+	if (hb->time_base)
+		hists->time_base = hb->time_base;
+
+	if (hists->time_base && !hb->time_base)
+		hb->time_base = hists->time_base;
+}
+
 static unsigned int hist_browser__refresh(struct ui_browser *browser)
 {
 	unsigned row = 0;
 	struct rb_node *nd;
 	struct hist_browser *hb = container_of(browser, struct hist_browser, b);
 
+	init_time_base(hb);
 	ui_browser__hists_init_top(browser);
 
 	for (nd = browser->top; nd; nd = rb_next(nd)) {
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index b219eaf..381139d 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -90,11 +90,11 @@ sort__time_cmp(struct sort_entry *se __maybe_unused,
 	return right->time - left->time;
 }
 
-static u64 get_time_base(struct hist_entry *he)
+static u64 get_time_base(struct hist_entry *he, bool selected)
 {
 	struct hists *hists = he->hists;
 
-	if (!hists->time_base)
+	if (!hists->time_base || selected)
 		hists->time_base = he->time;
 
 	return hists->time_base;
@@ -106,7 +106,7 @@ static int hist_entry__time_snprintf(struct sort_entry *se __maybe_unused,
 				     size_t size, unsigned int width)
 {
 	char buf[100];
-	u64 time_base = get_time_base(he);
+	u64 time_base = get_time_base(he, selected);
 	unsigned long time_sec, time_usec;
 	unsigned long base_sec, base_usec;
 	long delta_sec, delta_usec;
-- 
1.8.3.1

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