linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] perf: Add option to specify time window of interest
@ 2016-11-25 21:39 David Ahern
  2016-11-25 21:39 ` [PATCH 1/6] perf tool: Add time-based utility functions David Ahern
                   ` (5 more replies)
  0 siblings, 6 replies; 18+ messages in thread
From: David Ahern @ 2016-11-25 21:39 UTC (permalink / raw)
  To: acme; +Cc: mingo, peterz, namhyung, jolsa, linux-kernel, David Ahern

From: David Ahern <dsahern@gmail.com>

This series allows users to collect data and analyze a time window of
interest within the file.

David Ahern (6):
  perf tool: Add time-based utility functions
  perf tool: Move parse_nsec_time to time-utils.c
  perf script: Add option to specify time window of interest
  perf sched timehist: Add option to specify time window of interest
  perf kmem: Add option to specify time window of interest
  perf report: Add option to specify time window of interest

 tools/perf/Documentation/perf-kmem.txt   |   7 ++
 tools/perf/Documentation/perf-report.txt |   7 ++
 tools/perf/Documentation/perf-sched.txt  |   8 +++
 tools/perf/Documentation/perf-script.txt |   7 ++
 tools/perf/builtin-kmem.c                |  24 +++++++
 tools/perf/builtin-report.c              |  14 +++-
 tools/perf/builtin-sched.c               |  51 +++++++++++--
 tools/perf/builtin-script.c              |  15 +++-
 tools/perf/util/Build                    |   1 +
 tools/perf/util/time-utils.c             | 118 +++++++++++++++++++++++++++++++
 tools/perf/util/time-utils.h             |  14 ++++
 tools/perf/util/util.c                   |  33 ---------
 tools/perf/util/util.h                   |   2 -
 13 files changed, 258 insertions(+), 43 deletions(-)
 create mode 100644 tools/perf/util/time-utils.c
 create mode 100644 tools/perf/util/time-utils.h

-- 
2.7.4 (Apple Git-66)

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 1/6] perf tool: Add time-based utility functions
  2016-11-25 21:39 [PATCH 0/6] perf: Add option to specify time window of interest David Ahern
@ 2016-11-25 21:39 ` David Ahern
  2016-11-28 13:58   ` Jiri Olsa
                     ` (2 more replies)
  2016-11-25 21:39 ` [PATCH 2/6] perf tool: Move parse_nsec_time to time-utils.c David Ahern
                   ` (4 subsequent siblings)
  5 siblings, 3 replies; 18+ messages in thread
From: David Ahern @ 2016-11-25 21:39 UTC (permalink / raw)
  To: acme; +Cc: mingo, peterz, namhyung, jolsa, linux-kernel, David Ahern

From: David Ahern <dsahern@gmail.com>

Add function to parse a user time string of the form <start>,<stop>
where start and stop are time in sec.nsec format. Both start and stop
times are optional.

Add function to determine if a sample time is within a given time
time window of interest.

Signed-off-by: David Ahern <dsahern@gmail.com>
---
 tools/perf/util/Build        |  1 +
 tools/perf/util/time-utils.c | 85 ++++++++++++++++++++++++++++++++++++++++++++
 tools/perf/util/time-utils.h | 12 +++++++
 3 files changed, 98 insertions(+)
 create mode 100644 tools/perf/util/time-utils.c
 create mode 100644 tools/perf/util/time-utils.h

diff --git a/tools/perf/util/Build b/tools/perf/util/Build
index 1dc67efad634..78f139978e7a 100644
--- a/tools/perf/util/Build
+++ b/tools/perf/util/Build
@@ -87,6 +87,7 @@ libperf-y += help-unknown-cmd.o
 libperf-y += mem-events.o
 libperf-y += vsprintf.o
 libperf-y += drv_configs.o
+libperf-y += time-utils.o
 
 libperf-$(CONFIG_LIBBPF) += bpf-loader.o
 libperf-$(CONFIG_BPF_PROLOGUE) += bpf-prologue.o
diff --git a/tools/perf/util/time-utils.c b/tools/perf/util/time-utils.c
new file mode 100644
index 000000000000..e584aeae9834
--- /dev/null
+++ b/tools/perf/util/time-utils.c
@@ -0,0 +1,85 @@
+#include <string.h>
+#include <sys/time.h>
+#include <time.h>
+#include <errno.h>
+#include <inttypes.h>
+
+#include "../perf.h"
+#include "debug.h"
+#include "time-utils.h"
+#include "util.h"
+
+static int parse_timestr_sec_nsec(struct perf_time *ptime,
+				  char *start_str, char *end_str)
+{
+	if (start_str && (*start_str != '\0') &&
+	    (parse_nsec_time(start_str, &ptime->start) != 0)) {
+		return -1;
+	}
+
+	if (end_str && (*end_str != '\0') &&
+	    (parse_nsec_time(end_str, &ptime->end) != 0)) {
+		return -1;
+	}
+
+	return 0;
+}
+
+int perf_time__parse_str(struct perf_time *ptime, const char *ostr)
+{
+	char *start_str, *end_str;
+	char *d, *str;
+	int rc = 0;
+
+	if (ostr == NULL || *ostr == '\0')
+		return 0;
+
+	/* copy original string because we need to modify it */
+	str = strdup(ostr);
+	if (str == NULL)
+		return -ENOMEM;
+
+	ptime->start = 0;
+	ptime->end = 0;
+
+	/* str has the format: <start>,<stop>
+	 * variations: <start>,
+	 *             ,<stop>
+	 *             ,
+	 */
+	start_str = str;
+	d = strchr(start_str, ',');
+	if (d) {
+		*d = '\0';
+		++d;
+	}
+	end_str = d;
+
+	rc = parse_timestr_sec_nsec(ptime, start_str, end_str);
+
+	free(str);
+
+	/* make sure end time is after start time if it was given */
+	if (rc == 0 && ptime->end && ptime->end < ptime->start)
+		return -EINVAL;
+
+	pr_debug("start time %" PRIu64 ", ", ptime->start);
+	pr_debug("end time %" PRIu64 "\n", ptime->end);
+
+	return rc;
+}
+
+bool perf_time__skip_sample(struct perf_time *ptime, u64 timestamp)
+{
+	/* if time is not set don't drop sample */
+	if (timestamp == 0)
+		return false;
+
+	/* otherwise compare sample time to time window */
+	if ((ptime->start && timestamp < ptime->start) ||
+	    (ptime->end && timestamp > ptime->end)) {
+		return true;
+	}
+
+	return false;
+}
diff --git a/tools/perf/util/time-utils.h b/tools/perf/util/time-utils.h
new file mode 100644
index 000000000000..4368a481251d
--- /dev/null
+++ b/tools/perf/util/time-utils.h
@@ -0,0 +1,12 @@
+#ifndef _TIME_UTILS_H_
+#define _TIME_UTILS_H_
+
+struct perf_time {
+	u64 start, end;
+};
+
+int perf_time__parse_str(struct perf_time *ptime, const char *ostr);
+
+bool perf_time__skip_sample(struct perf_time *ptime, u64 timestamp);
+
+#endif
-- 
2.7.4 (Apple Git-66)

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 2/6] perf tool: Move parse_nsec_time to time-utils.c
  2016-11-25 21:39 [PATCH 0/6] perf: Add option to specify time window of interest David Ahern
  2016-11-25 21:39 ` [PATCH 1/6] perf tool: Add time-based utility functions David Ahern
@ 2016-11-25 21:39 ` David Ahern
  2016-11-28 13:58   ` Jiri Olsa
  2016-11-25 21:39 ` [PATCH 3/6] perf script: Add option to specify time window of interest David Ahern
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 18+ messages in thread
From: David Ahern @ 2016-11-25 21:39 UTC (permalink / raw)
  To: acme; +Cc: mingo, peterz, namhyung, jolsa, linux-kernel, David Ahern

From: David Ahern <dsahern@gmail.com>

Code move only; no functional change intended.

Signed-off-by: David Ahern <dsahern@gmail.com>
---
 tools/perf/util/time-utils.c | 35 ++++++++++++++++++++++++++++++++++-
 tools/perf/util/time-utils.h |  2 ++
 tools/perf/util/util.c       | 33 ---------------------------------
 tools/perf/util/util.h       |  2 --
 4 files changed, 36 insertions(+), 36 deletions(-)

diff --git a/tools/perf/util/time-utils.c b/tools/perf/util/time-utils.c
index e584aeae9834..0453a7beeef4 100644
--- a/tools/perf/util/time-utils.c
+++ b/tools/perf/util/time-utils.c
@@ -1,5 +1,6 @@
 #include <string.h>
 #include <sys/time.h>
+#include <linux/time64.h>
 #include <time.h>
 #include <errno.h>
 #include <inttypes.h>
@@ -7,7 +8,39 @@
 #include "../perf.h"
 #include "debug.h"
 #include "time-utils.h"
-#include "util.h"
+
+int parse_nsec_time(const char *str, u64 *ptime)
+{
+	u64 time_sec, time_nsec;
+	char *end;
+
+	time_sec = strtoul(str, &end, 10);
+	if (*end != '.' && *end != '\0')
+		return -1;
+
+	if (*end == '.') {
+		int i;
+		char nsec_buf[10];
+
+		if (strlen(++end) > 9)
+			return -1;
+
+		strncpy(nsec_buf, end, 9);
+		nsec_buf[9] = '\0';
+
+		/* make it nsec precision */
+		for (i = strlen(nsec_buf); i < 9; i++)
+			nsec_buf[i] = '0';
+
+		time_nsec = strtoul(nsec_buf, &end, 10);
+		if (*end != '\0')
+			return -1;
+	} else
+		time_nsec = 0;
+
+	*ptime = time_sec * NSEC_PER_SEC + time_nsec;
+	return 0;
+}
 
 static int parse_timestr_sec_nsec(struct perf_time *ptime,
 				  char *start_str, char *end_str)
diff --git a/tools/perf/util/time-utils.h b/tools/perf/util/time-utils.h
index 4368a481251d..d110d4d98854 100644
--- a/tools/perf/util/time-utils.h
+++ b/tools/perf/util/time-utils.h
@@ -5,6 +5,8 @@ struct perf_time {
 	u64 start, end;
 };
 
+int parse_nsec_time(const char *str, u64 *ptime);
+
 int perf_time__parse_str(struct perf_time *ptime, const char *ostr);
 
 bool perf_time__skip_sample(struct perf_time *ptime, u64 timestamp);
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index 67ac765da27a..9ddd98827d12 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -400,39 +400,6 @@ void sighandler_dump_stack(int sig)
 	raise(sig);
 }
 
-int parse_nsec_time(const char *str, u64 *ptime)
-{
-	u64 time_sec, time_nsec;
-	char *end;
-
-	time_sec = strtoul(str, &end, 10);
-	if (*end != '.' && *end != '\0')
-		return -1;
-
-	if (*end == '.') {
-		int i;
-		char nsec_buf[10];
-
-		if (strlen(++end) > 9)
-			return -1;
-
-		strncpy(nsec_buf, end, 9);
-		nsec_buf[9] = '\0';
-
-		/* make it nsec precision */
-		for (i = strlen(nsec_buf); i < 9; i++)
-			nsec_buf[i] = '0';
-
-		time_nsec = strtoul(nsec_buf, &end, 10);
-		if (*end != '\0')
-			return -1;
-	} else
-		time_nsec = 0;
-
-	*ptime = time_sec * NSEC_PER_SEC + time_nsec;
-	return 0;
-}
-
 int timestamp__scnprintf_usec(u64 timestamp, char *buf, size_t sz)
 {
 	u64  sec = timestamp / NSEC_PER_SEC;
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 79662d67891e..1d639e38aa82 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -179,8 +179,6 @@ static inline void *zalloc(size_t size)
 #undef tolower
 #undef toupper
 
-int parse_nsec_time(const char *str, u64 *ptime);
-
 extern unsigned char sane_ctype[256];
 #define GIT_SPACE		0x01
 #define GIT_DIGIT		0x02
-- 
2.7.4 (Apple Git-66)

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 3/6] perf script: Add option to specify time window of interest
  2016-11-25 21:39 [PATCH 0/6] perf: Add option to specify time window of interest David Ahern
  2016-11-25 21:39 ` [PATCH 1/6] perf tool: Add time-based utility functions David Ahern
  2016-11-25 21:39 ` [PATCH 2/6] perf tool: Move parse_nsec_time to time-utils.c David Ahern
@ 2016-11-25 21:39 ` David Ahern
  2016-11-25 21:39 ` [PATCH 4/6] perf sched timehist: " David Ahern
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 18+ messages in thread
From: David Ahern @ 2016-11-25 21:39 UTC (permalink / raw)
  To: acme; +Cc: mingo, peterz, namhyung, jolsa, linux-kernel, David Ahern

From: David Ahern <dsahern@gmail.com>

Add option to allow user to control analysis window. e.g., collect data
for some amount of time and analyze a segment of interest within that
window.

Signed-off-by: David Ahern <dsahern@gmail.com>
---
 tools/perf/Documentation/perf-script.txt |  7 +++++++
 tools/perf/builtin-script.c              | 15 ++++++++++++++-
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/tools/perf/Documentation/perf-script.txt b/tools/perf/Documentation/perf-script.txt
index 0f6ee09f7256..5dc5c6a09ac4 100644
--- a/tools/perf/Documentation/perf-script.txt
+++ b/tools/perf/Documentation/perf-script.txt
@@ -292,6 +292,13 @@ include::itrace.txt[]
 --force::
 	Don't do ownership validation.
 
+--time::
+	Only analyze samples within given time window: <start>,<stop>. Times
+	have the format seconds.microseconds. If start is not given (i.e., time
+	string is ',x.y') then analysis starts at the beginning of the file. If
+	stop time is not given (i.e, time string is 'x.y,') then analysis goes
+	to end of file.
+
 SEE ALSO
 --------
 linkperf:perf-record[1], linkperf:perf-script-perl[1],
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 066b4bf73780..52d6a020346a 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -22,6 +22,7 @@
 #include "util/thread_map.h"
 #include "util/stat.h"
 #include "util/thread-stack.h"
+#include "util/time-utils.h"
 #include <linux/bitmap.h>
 #include <linux/stringify.h>
 #include <linux/time64.h>
@@ -833,6 +834,8 @@ struct perf_script {
 	struct cpu_map		*cpus;
 	struct thread_map	*threads;
 	int			name_width;
+	const char              *time_str;
+	struct                  perf_time ptime;
 };
 
 static int perf_evlist__max_name_len(struct perf_evlist *evlist)
@@ -1014,6 +1017,9 @@ static int process_sample_event(struct perf_tool *tool,
 	struct perf_script *scr = container_of(tool, struct perf_script, tool);
 	struct addr_location al;
 
+	if (perf_time__skip_sample(&scr->ptime, sample->time))
+		return 0;
+
 	if (debug_mode) {
 		if (sample->time < last_timestamp) {
 			pr_err("Samples misordered, previous: %" PRIu64
@@ -2186,7 +2192,8 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
 			"Enable symbol demangling"),
 	OPT_BOOLEAN(0, "demangle-kernel", &symbol_conf.demangle_kernel,
 			"Enable kernel symbol demangling"),
-
+	OPT_STRING(0, "time", &script.time_str, "str",
+		   "Time span of interest (start,stop)"),
 	OPT_END()
 	};
 	const char * const script_subcommands[] = { "record", "report", NULL };
@@ -2465,6 +2472,12 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
 	if (err < 0)
 		goto out_delete;
 
+	/* needs to be parsed after looking up reference time */
+	if (perf_time__parse_str(&script.ptime, script.time_str) != 0) {
+		pr_err("Invalid time string\n");
+		return -EINVAL;
+	}
+
 	err = __cmd_script(&script);
 
 	flush_scripting();
-- 
2.7.4 (Apple Git-66)

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 4/6] perf sched timehist: Add option to specify time window of interest
  2016-11-25 21:39 [PATCH 0/6] perf: Add option to specify time window of interest David Ahern
                   ` (2 preceding siblings ...)
  2016-11-25 21:39 ` [PATCH 3/6] perf script: Add option to specify time window of interest David Ahern
@ 2016-11-25 21:39 ` David Ahern
  2016-11-25 21:39 ` [PATCH 5/6] perf kmem: " David Ahern
  2016-11-25 21:39 ` [PATCH 6/6] perf report: " David Ahern
  5 siblings, 0 replies; 18+ messages in thread
From: David Ahern @ 2016-11-25 21:39 UTC (permalink / raw)
  To: acme; +Cc: mingo, peterz, namhyung, jolsa, linux-kernel, David Ahern

From: David Ahern <dsahern@gmail.com>

Add option to allow user to control analysis window. e.g., collect data
for time window and analyze a segment of interest within that window.

Signed-off-by: David Ahern <dsahern@gmail.com>
---
 tools/perf/Documentation/perf-sched.txt |  8 ++++++
 tools/perf/builtin-sched.c              | 51 +++++++++++++++++++++++++++++----
 2 files changed, 53 insertions(+), 6 deletions(-)

diff --git a/tools/perf/Documentation/perf-sched.txt b/tools/perf/Documentation/perf-sched.txt
index 121c60da03e5..7775b1eb2bee 100644
--- a/tools/perf/Documentation/perf-sched.txt
+++ b/tools/perf/Documentation/perf-sched.txt
@@ -132,6 +132,14 @@ OPTIONS for 'perf sched timehist'
 --migrations::
 	Show migration events.
 
+--time::
+	Only analyze samples within given time window: <start>,<stop>. Times
+	have the format seconds.microseconds. If start is not given (i.e., time
+	string is ',x.y') then analysis starts at the beginning of the file. If
+	stop time is not given (i.e, time string is 'x.y,') then analysis goes
+	to end of file.
+
+
 SEE ALSO
 --------
 linkperf:perf-record[1]
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 4f9e7cba4ebf..1656f2c9f638 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -15,6 +15,7 @@
 #include "util/color.h"
 #include "util/stat.h"
 #include "util/callchain.h"
+#include "util/time-utils.h"
 
 #include <subcmd/parse-options.h>
 #include "util/trace-event.h"
@@ -205,6 +206,8 @@ struct perf_sched {
 	bool		show_wakeups;
 	bool		show_migrations;
 	u64		skipped_samples;
+	const char	*time_str;
+	struct perf_time ptime;
 };
 
 /* per thread run time data */
@@ -1837,13 +1840,14 @@ static void timehist_header(struct perf_sched *sched)
 static void timehist_print_sample(struct perf_sched *sched,
 				  struct perf_sample *sample,
 				  struct addr_location *al,
-				  struct thread *thread)
+				  struct thread *thread,
+				  u64 t)
 {
 	struct thread_runtime *tr = thread__priv(thread);
 	u32 max_cpus = sched->max_cpu + 1;
 	char tstr[64];
 
-	timestamp__scnprintf_usec(sample->time, tstr, sizeof(tstr));
+	timestamp__scnprintf_usec(t, tstr, sizeof(tstr));
 	printf("%15s [%04d] ", tstr, sample->cpu);
 
 	if (sched->show_cpu_visual) {
@@ -2194,7 +2198,8 @@ static int timehist_sched_wakeup_event(struct perf_tool *tool,
 		tr->ready_to_run = sample->time;
 
 	/* show wakeups if requested */
-	if (sched->show_wakeups)
+	if (sched->show_wakeups &&
+	    !perf_time__skip_sample(&sched->ptime, sample->time))
 		timehist_print_wakeup_event(sched, sample, machine, thread);
 
 	return 0;
@@ -2288,10 +2293,11 @@ static int timehist_sched_change_event(struct perf_tool *tool,
 				       struct machine *machine)
 {
 	struct perf_sched *sched = container_of(tool, struct perf_sched, tool);
+	struct perf_time *ptime = &sched->ptime;
 	struct addr_location al;
 	struct thread *thread;
 	struct thread_runtime *tr = NULL;
-	u64 tprev;
+	u64 tprev, t = sample->time;
 	int rc = 0;
 
 	if (machine__resolve(machine, &al, sample) < 0) {
@@ -2318,9 +2324,35 @@ static int timehist_sched_change_event(struct perf_tool *tool,
 
 	tprev = perf_evsel__get_time(evsel, sample->cpu);
 
-	timehist_update_runtime_stats(tr, sample->time, tprev);
+	/*
+	 * If start time given:
+	 * - sample time is under window user cares about - skip sample
+	 * - tprev is under window user cares about  - reset to start of window
+	 */
+	if (ptime->start && ptime->start > t)
+		goto out;
+
+	if (ptime->start > tprev)
+		tprev = ptime->start;
+
+	/*
+	 * If end time given:
+	 * - previous sched event is out of window - we are done
+	 * - sample time is beyond window user cares about - reset it
+	 *   to close out stats for time window interest
+	 */
+	if (ptime->end) {
+		if (tprev > ptime->end)
+			goto out;
+
+		if (t > ptime->end)
+			t = ptime->end;
+	}
+
+	timehist_update_runtime_stats(tr, t, tprev);
+
 	if (!sched->summary_only)
-		timehist_print_sample(sched, sample, &al, thread);
+		timehist_print_sample(sched, sample, &al, thread, t);
 
 out:
 	if (tr) {
@@ -2583,6 +2615,11 @@ static int perf_sched__timehist(struct perf_sched *sched)
 
 	symbol__init(&session->header.env);
 
+	if (perf_time__parse_str(&sched->ptime, sched->time_str) != 0) {
+		pr_err("Invalid time string\n");
+		return -EINVAL;
+	}
+
 	if (timehist_check_attr(sched, evlist) != 0)
 		goto out;
 
@@ -2997,6 +3034,8 @@ int cmd_sched(int argc, const char **argv, const char *prefix __maybe_unused)
 	OPT_BOOLEAN('w', "wakeups", &sched.show_wakeups, "Show wakeup events"),
 	OPT_BOOLEAN('M', "migrations", &sched.show_migrations, "Show migration events"),
 	OPT_BOOLEAN('V', "cpu-visual", &sched.show_cpu_visual, "Add CPU visual"),
+	OPT_STRING(0, "time", &sched.time_str, "str",
+		   "Time span for analysis (start,stop)"),
 	OPT_PARENT(sched_options)
 	};
 
-- 
2.7.4 (Apple Git-66)

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 5/6] perf kmem: Add option to specify time window of interest
  2016-11-25 21:39 [PATCH 0/6] perf: Add option to specify time window of interest David Ahern
                   ` (3 preceding siblings ...)
  2016-11-25 21:39 ` [PATCH 4/6] perf sched timehist: " David Ahern
@ 2016-11-25 21:39 ` David Ahern
  2016-11-25 21:39 ` [PATCH 6/6] perf report: " David Ahern
  5 siblings, 0 replies; 18+ messages in thread
From: David Ahern @ 2016-11-25 21:39 UTC (permalink / raw)
  To: acme; +Cc: mingo, peterz, namhyung, jolsa, linux-kernel, David Ahern

From: David Ahern <dsahern@gmail.com>

Add option to allow user to control analysis window. e.g., collect data
for time window and analyze a segment of interest within that window.

Signed-off-by: David Ahern <dsahern@gmail.com>
---
 tools/perf/Documentation/perf-kmem.txt |  7 +++++++
 tools/perf/builtin-kmem.c              | 24 ++++++++++++++++++++++++
 2 files changed, 31 insertions(+)

diff --git a/tools/perf/Documentation/perf-kmem.txt b/tools/perf/Documentation/perf-kmem.txt
index ff0f433b3fce..479fc3261a50 100644
--- a/tools/perf/Documentation/perf-kmem.txt
+++ b/tools/perf/Documentation/perf-kmem.txt
@@ -61,6 +61,13 @@ OPTIONS
 	default, but this option shows live (currently allocated) pages
 	instead.  (This option works with --page option only)
 
+--time::
+	Only analyze samples within given time window: <start>,<stop>. Times
+	have the format seconds.microseconds. If start is not given (i.e., time
+	string is ',x.y') then analysis starts at the beginning of the file. If
+	stop time is not given (i.e, time string is 'x.y,') then analysis goes
+	to end of file.
+
 SEE ALSO
 --------
 linkperf:perf-record[1]
diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c
index d426dcb18ce9..f184ecf9b0b3 100644
--- a/tools/perf/builtin-kmem.c
+++ b/tools/perf/builtin-kmem.c
@@ -11,6 +11,7 @@
 #include "util/session.h"
 #include "util/tool.h"
 #include "util/callchain.h"
+#include "util/time-utils.h"
 
 #include <subcmd/parse-options.h>
 #include "util/trace-event.h"
@@ -65,6 +66,10 @@ static struct rb_root root_caller_sorted;
 static unsigned long total_requested, total_allocated;
 static unsigned long nr_allocs, nr_cross_allocs;
 
+/* filters for controlling start and stop of time of analysis */
+static struct perf_time ptime;
+const char *time_str;
+
 static int insert_alloc_stat(unsigned long call_site, unsigned long ptr,
 			     int bytes_req, int bytes_alloc, int cpu)
 {
@@ -907,6 +912,15 @@ static int perf_evsel__process_page_free_event(struct perf_evsel *evsel,
 	return 0;
 }
 
+static bool perf_kmem__skip_sample(struct perf_sample *sample)
+{
+	/* skip sample based on time? */
+	if (perf_time__skip_sample(&ptime, sample->time))
+		return true;
+
+	return false;
+}
+
 typedef int (*tracepoint_handler)(struct perf_evsel *evsel,
 				  struct perf_sample *sample);
 
@@ -926,6 +940,9 @@ static int process_sample_event(struct perf_tool *tool __maybe_unused,
 		return -1;
 	}
 
+	if (perf_kmem__skip_sample(sample))
+		return 0;
+
 	dump_printf(" ... thread: %s:%d\n", thread__comm_str(thread), thread->tid);
 
 	if (evsel->handler != NULL) {
@@ -1884,6 +1901,8 @@ int cmd_kmem(int argc, const char **argv, const char *prefix __maybe_unused)
 	OPT_CALLBACK_NOOPT(0, "page", NULL, NULL, "Analyze page allocator",
 			   parse_page_opt),
 	OPT_BOOLEAN(0, "live", &live_page, "Show live page stat"),
+	OPT_STRING(0, "time", &time_str, "str",
+		   "Time span of interest (start,stop)"),
 	OPT_END()
 	};
 	const char *const kmem_subcommands[] = { "record", "stat", NULL };
@@ -1944,6 +1963,11 @@ int cmd_kmem(int argc, const char **argv, const char *prefix __maybe_unused)
 
 	symbol__init(&session->header.env);
 
+	if (perf_time__parse_str(&ptime, time_str) != 0) {
+		pr_err("Invalid time string\n");
+		return -EINVAL;
+	}
+
 	if (!strcmp(argv[0], "stat")) {
 		setlocale(LC_ALL, "");
 
-- 
2.7.4 (Apple Git-66)

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 6/6] perf report: Add option to specify time window of interest
  2016-11-25 21:39 [PATCH 0/6] perf: Add option to specify time window of interest David Ahern
                   ` (4 preceding siblings ...)
  2016-11-25 21:39 ` [PATCH 5/6] perf kmem: " David Ahern
@ 2016-11-25 21:39 ` David Ahern
  5 siblings, 0 replies; 18+ messages in thread
From: David Ahern @ 2016-11-25 21:39 UTC (permalink / raw)
  To: acme; +Cc: mingo, peterz, namhyung, jolsa, linux-kernel, David Ahern

From: David Ahern <dsahern@gmail.com>

Add option to allow user to control analysis window. e.g., collect data
for time window and analyze a segment of interest within that window.

Signed-off-by: David Ahern <dsahern@gmail.com>
---
 tools/perf/Documentation/perf-report.txt |  7 +++++++
 tools/perf/builtin-report.c              | 14 +++++++++++++-
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt
index 2d1746295abf..3a166ae4a4d3 100644
--- a/tools/perf/Documentation/perf-report.txt
+++ b/tools/perf/Documentation/perf-report.txt
@@ -382,6 +382,13 @@ OPTIONS
 --header-only::
 	Show only perf.data header (forces --stdio).
 
+--time::
+	Only analyze samples within given time window: <start>,<stop>. Times
+	have the format seconds.microseconds. If start is not given (i.e., time
+	string is ',x.y') then analysis starts at the beginning of the file. If
+	stop time is not given (i.e, time string is 'x.y,') then analysis goes
+	to end of file.
+
 --itrace::
 	Options for decoding instruction tracing data. The options are:
 
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 3dfbfffe2ecd..6565a263a275 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -36,7 +36,7 @@
 #include "util/hist.h"
 #include "util/data.h"
 #include "arch/common.h"
-
+#include "util/time-utils.h"
 #include "util/auxtrace.h"
 
 #include <dlfcn.h>
@@ -59,6 +59,8 @@ struct report {
 	const char		*pretty_printing_style;
 	const char		*cpu_list;
 	const char		*symbol_filter_str;
+	const char              *time_str;
+	struct                  perf_time ptime;
 	float			min_percent;
 	u64			nr_entries;
 	u64			queue_size;
@@ -158,6 +160,9 @@ static int process_sample_event(struct perf_tool *tool,
 	};
 	int ret = 0;
 
+	if (perf_time__skip_sample(&rep->ptime, sample->time))
+		return 0;
+
 	if (machine__resolve(machine, &al, sample) < 0) {
 		pr_debug("problem processing %d event, skipping it.\n",
 			 event->header.type);
@@ -830,6 +835,8 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
 	OPT_CALLBACK_DEFAULT(0, "stdio-color", NULL, "mode",
 			     "'always' (default), 'never' or 'auto' only applicable to --stdio mode",
 			     stdio__config_color, "always"),
+	OPT_STRING(0, "time", &report.time_str, "str",
+		   "Time span of interest (start,stop)"),
 	OPT_END()
 	};
 	struct perf_data_file file = {
@@ -1015,6 +1022,11 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
 	if (symbol__init(&session->header.env) < 0)
 		goto error;
 
+	if (perf_time__parse_str(&report.ptime, report.time_str) != 0) {
+		pr_err("Invalid time string\n");
+		return -EINVAL;
+	}
+
 	sort__setup_elide(stdout);
 
 	ret = __cmd_report(&report);
-- 
2.7.4 (Apple Git-66)

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/6] perf tool: Move parse_nsec_time to time-utils.c
  2016-11-25 21:39 ` [PATCH 2/6] perf tool: Move parse_nsec_time to time-utils.c David Ahern
@ 2016-11-28 13:58   ` Jiri Olsa
  2016-11-28 17:31     ` David Ahern
  0 siblings, 1 reply; 18+ messages in thread
From: Jiri Olsa @ 2016-11-28 13:58 UTC (permalink / raw)
  To: David Ahern
  Cc: acme, mingo, peterz, namhyung, jolsa, linux-kernel, David Ahern

On Fri, Nov 25, 2016 at 02:39:55PM -0700, David Ahern wrote:

SNIP

> -
> -		time_nsec = strtoul(nsec_buf, &end, 10);
> -		if (*end != '\0')
> -			return -1;
> -	} else
> -		time_nsec = 0;
> -
> -	*ptime = time_sec * NSEC_PER_SEC + time_nsec;
> -	return 0;
> -}
> -
>  int timestamp__scnprintf_usec(u64 timestamp, char *buf, size_t sz)
>  {
>  	u64  sec = timestamp / NSEC_PER_SEC;
> diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
> index 79662d67891e..1d639e38aa82 100644
> --- a/tools/perf/util/util.h
> +++ b/tools/perf/util/util.h
> @@ -179,8 +179,6 @@ static inline void *zalloc(size_t size)
>  #undef tolower
>  #undef toupper
>  
> -int parse_nsec_time(const char *str, u64 *ptime);

strange, can't see any current user of this function other than in your patch

could you please also add some automated tests for this function?

thanks,
jirka

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 1/6] perf tool: Add time-based utility functions
  2016-11-25 21:39 ` [PATCH 1/6] perf tool: Add time-based utility functions David Ahern
@ 2016-11-28 13:58   ` Jiri Olsa
  2016-11-28 17:35     ` David Ahern
  2016-11-28 13:58   ` Jiri Olsa
  2016-11-28 13:58   ` Jiri Olsa
  2 siblings, 1 reply; 18+ messages in thread
From: Jiri Olsa @ 2016-11-28 13:58 UTC (permalink / raw)
  To: David Ahern
  Cc: acme, mingo, peterz, namhyung, jolsa, linux-kernel, David Ahern

On Fri, Nov 25, 2016 at 02:39:54PM -0700, David Ahern wrote:
> From: David Ahern <dsahern@gmail.com>
> 
> Add function to parse a user time string of the form <start>,<stop>
> where start and stop are time in sec.nsec format. Both start and stop
> times are optional.
> 
> Add function to determine if a sample time is within a given time
> time window of interest.
> 
> Signed-off-by: David Ahern <dsahern@gmail.com>
> ---
>  tools/perf/util/Build        |  1 +
>  tools/perf/util/time-utils.c | 85 ++++++++++++++++++++++++++++++++++++++++++++
>  tools/perf/util/time-utils.h | 12 +++++++
>  3 files changed, 98 insertions(+)
>  create mode 100644 tools/perf/util/time-utils.c
>  create mode 100644 tools/perf/util/time-utils.h
> 
> diff --git a/tools/perf/util/Build b/tools/perf/util/Build
> index 1dc67efad634..78f139978e7a 100644
> --- a/tools/perf/util/Build
> +++ b/tools/perf/util/Build
> @@ -87,6 +87,7 @@ libperf-y += help-unknown-cmd.o
>  libperf-y += mem-events.o
>  libperf-y += vsprintf.o
>  libperf-y += drv_configs.o
> +libperf-y += time-utils.o

I think we should call it just time.c, it's already in 'util' directory

jirka

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 1/6] perf tool: Add time-based utility functions
  2016-11-25 21:39 ` [PATCH 1/6] perf tool: Add time-based utility functions David Ahern
  2016-11-28 13:58   ` Jiri Olsa
@ 2016-11-28 13:58   ` Jiri Olsa
  2016-11-28 13:58   ` Jiri Olsa
  2 siblings, 0 replies; 18+ messages in thread
From: Jiri Olsa @ 2016-11-28 13:58 UTC (permalink / raw)
  To: David Ahern
  Cc: acme, mingo, peterz, namhyung, jolsa, linux-kernel, David Ahern

On Fri, Nov 25, 2016 at 02:39:54PM -0700, David Ahern wrote:
> From: David Ahern <dsahern@gmail.com>
> 
> Add function to parse a user time string of the form <start>,<stop>
> where start and stop are time in sec.nsec format. Both start and stop
> times are optional.
> 
> Add function to determine if a sample time is within a given time
> time window of interest.
> 
> Signed-off-by: David Ahern <dsahern@gmail.com>
> ---
>  tools/perf/util/Build        |  1 +
>  tools/perf/util/time-utils.c | 85 ++++++++++++++++++++++++++++++++++++++++++++
>  tools/perf/util/time-utils.h | 12 +++++++
>  3 files changed, 98 insertions(+)
>  create mode 100644 tools/perf/util/time-utils.c
>  create mode 100644 tools/perf/util/time-utils.h
> 
> diff --git a/tools/perf/util/Build b/tools/perf/util/Build
> index 1dc67efad634..78f139978e7a 100644
> --- a/tools/perf/util/Build
> +++ b/tools/perf/util/Build
> @@ -87,6 +87,7 @@ libperf-y += help-unknown-cmd.o
>  libperf-y += mem-events.o
>  libperf-y += vsprintf.o
>  libperf-y += drv_configs.o
> +libperf-y += time-utils.o
>  
>  libperf-$(CONFIG_LIBBPF) += bpf-loader.o
>  libperf-$(CONFIG_BPF_PROLOGUE) += bpf-prologue.o
> diff --git a/tools/perf/util/time-utils.c b/tools/perf/util/time-utils.c
> new file mode 100644
> index 000000000000..e584aeae9834
> --- /dev/null
> +++ b/tools/perf/util/time-utils.c
> @@ -0,0 +1,85 @@
> +#include <string.h>
> +#include <sys/time.h>
> +#include <time.h>
> +#include <errno.h>
> +#include <inttypes.h>
> +
> +#include "../perf.h"

could be just "perf.h"

jirka

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 1/6] perf tool: Add time-based utility functions
  2016-11-25 21:39 ` [PATCH 1/6] perf tool: Add time-based utility functions David Ahern
  2016-11-28 13:58   ` Jiri Olsa
  2016-11-28 13:58   ` Jiri Olsa
@ 2016-11-28 13:58   ` Jiri Olsa
  2016-11-28 17:27     ` David Ahern
  2 siblings, 1 reply; 18+ messages in thread
From: Jiri Olsa @ 2016-11-28 13:58 UTC (permalink / raw)
  To: David Ahern
  Cc: acme, mingo, peterz, namhyung, jolsa, linux-kernel, David Ahern

On Fri, Nov 25, 2016 at 02:39:54PM -0700, David Ahern wrote:

SNIP

> diff --git a/tools/perf/util/time-utils.h b/tools/perf/util/time-utils.h
> new file mode 100644
> index 000000000000..4368a481251d
> --- /dev/null
> +++ b/tools/perf/util/time-utils.h
> @@ -0,0 +1,12 @@
> +#ifndef _TIME_UTILS_H_
> +#define _TIME_UTILS_H_
> +
> +struct perf_time {
> +	u64 start, end;
> +};

hum, it's more interval rather than 'time'
would perf_interval, perf_time_interval suit better?

thanks,
jirka

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 1/6] perf tool: Add time-based utility functions
  2016-11-28 13:58   ` Jiri Olsa
@ 2016-11-28 17:27     ` David Ahern
  2016-11-29 16:02       ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 18+ messages in thread
From: David Ahern @ 2016-11-28 17:27 UTC (permalink / raw)
  To: Jiri Olsa, David Ahern; +Cc: acme, mingo, peterz, namhyung, jolsa, linux-kernel

On 11/28/16 6:58 AM, Jiri Olsa wrote:
> On Fri, Nov 25, 2016 at 02:39:54PM -0700, David Ahern wrote:
> 
> SNIP
> 
>> diff --git a/tools/perf/util/time-utils.h b/tools/perf/util/time-utils.h
>> new file mode 100644
>> index 000000000000..4368a481251d
>> --- /dev/null
>> +++ b/tools/perf/util/time-utils.h
>> @@ -0,0 +1,12 @@
>> +#ifndef _TIME_UTILS_H_
>> +#define _TIME_UTILS_H_
>> +
>> +struct perf_time {
>> +	u64 start, end;
>> +};
> 
> hum, it's more interval rather than 'time'
> would perf_interval, perf_time_interval suit better?

I'll flip to perf_interval.

ack to the other 2 comments on this patch.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/6] perf tool: Move parse_nsec_time to time-utils.c
  2016-11-28 13:58   ` Jiri Olsa
@ 2016-11-28 17:31     ` David Ahern
  0 siblings, 0 replies; 18+ messages in thread
From: David Ahern @ 2016-11-28 17:31 UTC (permalink / raw)
  To: Jiri Olsa, David Ahern; +Cc: acme, mingo, peterz, namhyung, jolsa, linux-kernel

On 11/28/16 6:58 AM, Jiri Olsa wrote:
>> diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
>> index 79662d67891e..1d639e38aa82 100644
>> --- a/tools/perf/util/util.h
>> +++ b/tools/perf/util/util.h
>> @@ -179,8 +179,6 @@ static inline void *zalloc(size_t size)
>>  #undef tolower
>>  #undef toupper
>>  
>> -int parse_nsec_time(const char *str, u64 *ptime);
> 
> strange, can't see any current user of this function other than in your patch

Added a few years back. I switched my code to it at that point. odd that there are no other users, but it has worked for me since it was added.

> 
> could you please also add some automated tests for this function?

Why? It is basically a fancy wrapper around strtoul for sec.usec strings.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 1/6] perf tool: Add time-based utility functions
  2016-11-28 13:58   ` Jiri Olsa
@ 2016-11-28 17:35     ` David Ahern
  2016-11-28 18:14       ` Jiri Olsa
  0 siblings, 1 reply; 18+ messages in thread
From: David Ahern @ 2016-11-28 17:35 UTC (permalink / raw)
  To: Jiri Olsa, David Ahern; +Cc: acme, mingo, peterz, namhyung, jolsa, linux-kernel

On 11/28/16 6:58 AM, Jiri Olsa wrote:
> On Fri, Nov 25, 2016 at 02:39:54PM -0700, David Ahern wrote:
>> From: David Ahern <dsahern@gmail.com>
>>
>> Add function to parse a user time string of the form <start>,<stop>
>> where start and stop are time in sec.nsec format. Both start and stop
>> times are optional.
>>
>> Add function to determine if a sample time is within a given time
>> time window of interest.
>>
>> Signed-off-by: David Ahern <dsahern@gmail.com>
>> ---
>>  tools/perf/util/Build        |  1 +
>>  tools/perf/util/time-utils.c | 85 ++++++++++++++++++++++++++++++++++++++++++++
>>  tools/perf/util/time-utils.h | 12 +++++++
>>  3 files changed, 98 insertions(+)
>>  create mode 100644 tools/perf/util/time-utils.c
>>  create mode 100644 tools/perf/util/time-utils.h
>>
>> diff --git a/tools/perf/util/Build b/tools/perf/util/Build
>> index 1dc67efad634..78f139978e7a 100644
>> --- a/tools/perf/util/Build
>> +++ b/tools/perf/util/Build
>> @@ -87,6 +87,7 @@ libperf-y += help-unknown-cmd.o
>>  libperf-y += mem-events.o
>>  libperf-y += vsprintf.o
>>  libperf-y += drv_configs.o
>> +libperf-y += time-utils.o
> 
> I think we should call it just time.c, it's already in 'util' directory

can't rename time-utils.h to time.h because the include will get confused with <time.h> and if the header is named time-utils.h why not keep the c-file as time-utils.c?

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 1/6] perf tool: Add time-based utility functions
  2016-11-28 17:35     ` David Ahern
@ 2016-11-28 18:14       ` Jiri Olsa
  2016-11-28 18:17         ` David Ahern
  0 siblings, 1 reply; 18+ messages in thread
From: Jiri Olsa @ 2016-11-28 18:14 UTC (permalink / raw)
  To: David Ahern
  Cc: David Ahern, acme, mingo, peterz, namhyung, jolsa, linux-kernel

On Mon, Nov 28, 2016 at 10:35:15AM -0700, David Ahern wrote:
> On 11/28/16 6:58 AM, Jiri Olsa wrote:
> > On Fri, Nov 25, 2016 at 02:39:54PM -0700, David Ahern wrote:
> >> From: David Ahern <dsahern@gmail.com>
> >>
> >> Add function to parse a user time string of the form <start>,<stop>
> >> where start and stop are time in sec.nsec format. Both start and stop
> >> times are optional.
> >>
> >> Add function to determine if a sample time is within a given time
> >> time window of interest.
> >>
> >> Signed-off-by: David Ahern <dsahern@gmail.com>
> >> ---
> >>  tools/perf/util/Build        |  1 +
> >>  tools/perf/util/time-utils.c | 85 ++++++++++++++++++++++++++++++++++++++++++++
> >>  tools/perf/util/time-utils.h | 12 +++++++
> >>  3 files changed, 98 insertions(+)
> >>  create mode 100644 tools/perf/util/time-utils.c
> >>  create mode 100644 tools/perf/util/time-utils.h
> >>
> >> diff --git a/tools/perf/util/Build b/tools/perf/util/Build
> >> index 1dc67efad634..78f139978e7a 100644
> >> --- a/tools/perf/util/Build
> >> +++ b/tools/perf/util/Build
> >> @@ -87,6 +87,7 @@ libperf-y += help-unknown-cmd.o
> >>  libperf-y += mem-events.o
> >>  libperf-y += vsprintf.o
> >>  libperf-y += drv_configs.o
> >> +libperf-y += time-utils.o
> > 
> > I think we should call it just time.c, it's already in 'util' directory
> 
> can't rename time-utils.h to time.h because the include will get confused with <time.h> and if the header is named time-utils.h why not keep the c-file as time-utils.c?
> 

ok, haven't realized that.. can't think of another name ;-)

there are some time related functions in util.[ch], maybe you
coudl move them as well

int fetch_current_timestamp(char *buf, size_t sz);
int timestamp__scnprintf_usec(u64 timestamp, char *buf, size_t sz);

jirka

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 1/6] perf tool: Add time-based utility functions
  2016-11-28 18:14       ` Jiri Olsa
@ 2016-11-28 18:17         ` David Ahern
  0 siblings, 0 replies; 18+ messages in thread
From: David Ahern @ 2016-11-28 18:17 UTC (permalink / raw)
  To: Jiri Olsa; +Cc: David Ahern, acme, mingo, peterz, namhyung, jolsa, linux-kernel

On 11/28/16 11:14 AM, Jiri Olsa wrote:
> there are some time related functions in util.[ch], maybe you
> coudl move them as well
> 
> int fetch_current_timestamp(char *buf, size_t sz);
> int timestamp__scnprintf_usec(u64 timestamp, char *buf, size_t sz);

I'd like to defer that to a follow on patch.

I only move parse_nsec_time in this set because there are no other users but the one introduced in patch 1.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 1/6] perf tool: Add time-based utility functions
  2016-11-28 17:27     ` David Ahern
@ 2016-11-29 16:02       ` Arnaldo Carvalho de Melo
  2016-11-29 16:03         ` David Ahern
  0 siblings, 1 reply; 18+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-11-29 16:02 UTC (permalink / raw)
  To: David Ahern
  Cc: Jiri Olsa, David Ahern, mingo, peterz, namhyung, jolsa, linux-kernel

Em Mon, Nov 28, 2016 at 10:27:08AM -0700, David Ahern escreveu:
> On 11/28/16 6:58 AM, Jiri Olsa wrote:
> > On Fri, Nov 25, 2016 at 02:39:54PM -0700, David Ahern wrote:
> > 
> > SNIP
> > 
> >> diff --git a/tools/perf/util/time-utils.h b/tools/perf/util/time-utils.h
> >> new file mode 100644
> >> index 000000000000..4368a481251d
> >> --- /dev/null
> >> +++ b/tools/perf/util/time-utils.h
> >> @@ -0,0 +1,12 @@
> >> +#ifndef _TIME_UTILS_H_
> >> +#define _TIME_UTILS_H_
> >> +
> >> +struct perf_time {
> >> +	u64 start, end;
> >> +};
> > 
> > hum, it's more interval rather than 'time'
> > would perf_interval, perf_time_interval suit better?
> 
> I'll flip to perf_interval.

Humm, I'd prefer 'time_interval' or 'perf_time_interval', plain
'interval' doesn't convey what kind if interval is this, we could be
talking about counter values intervals, etc.

I was even expecting libc or POSIX to have something like this, but from
a quick look I couldn't find anything :-\
 
> ack to the other 2 comments on this patch.

Ok, waiting for v2 then.

- Arnaldo

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 1/6] perf tool: Add time-based utility functions
  2016-11-29 16:02       ` Arnaldo Carvalho de Melo
@ 2016-11-29 16:03         ` David Ahern
  0 siblings, 0 replies; 18+ messages in thread
From: David Ahern @ 2016-11-29 16:03 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Jiri Olsa, David Ahern, mingo, peterz, namhyung, jolsa, linux-kernel

On 11/29/16 9:02 AM, Arnaldo Carvalho de Melo wrote:
> Humm, I'd prefer 'time_interval' or 'perf_time_interval', plain
> 'interval' doesn't convey what kind if interval is this, we could be
> talking about counter values intervals, etc.

agreed, perf_time_interval makes more sense. 

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2016-11-29 16:03 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-25 21:39 [PATCH 0/6] perf: Add option to specify time window of interest David Ahern
2016-11-25 21:39 ` [PATCH 1/6] perf tool: Add time-based utility functions David Ahern
2016-11-28 13:58   ` Jiri Olsa
2016-11-28 17:35     ` David Ahern
2016-11-28 18:14       ` Jiri Olsa
2016-11-28 18:17         ` David Ahern
2016-11-28 13:58   ` Jiri Olsa
2016-11-28 13:58   ` Jiri Olsa
2016-11-28 17:27     ` David Ahern
2016-11-29 16:02       ` Arnaldo Carvalho de Melo
2016-11-29 16:03         ` David Ahern
2016-11-25 21:39 ` [PATCH 2/6] perf tool: Move parse_nsec_time to time-utils.c David Ahern
2016-11-28 13:58   ` Jiri Olsa
2016-11-28 17:31     ` David Ahern
2016-11-25 21:39 ` [PATCH 3/6] perf script: Add option to specify time window of interest David Ahern
2016-11-25 21:39 ` [PATCH 4/6] perf sched timehist: " David Ahern
2016-11-25 21:39 ` [PATCH 5/6] perf kmem: " David Ahern
2016-11-25 21:39 ` [PATCH 6/6] perf report: " David Ahern

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).