Skip to contentSkip to conversation

perf top: Always sample time

PATCH In review Jiri Olsa 3 participants 3 messages Apr 15, 2019 – Apr 19, 2019 perf events

lore
Share & tools
lore

Jiri Olsa

author reviewer
#0 lore raw

PATCH 1/1 perf top: Always sample time

Bastian reported broken perf top -p PID command, it won't display any data.

The problem is that for -p option we monitor single thread, so we don't enable time in samples, because it's not needed.

However since commit 16c66bc167cc we use ordered queues to stash data plus later commits added logic for dropping samples in case there's big load and we don't keep up. All this needs timestamp for sample. Enabling it unconditionally for perf top.

Fixes 16c66bc167cc ("perf top: Add processing thread")
---
 tools/perf/builtin-top.c | 1 +
 1 file changed, 1 insertion(+)
tools/perf/builtin-top.c +1 -0
index 1999d6533d12..fbbb0da43abb 100644
@@ -1377,6 +1377,7 @@ int cmd_top(int argc, const char **argv)
 			 * */
 			.overwrite	= 0,
 			.sample_time	= true,
+			.sample_time_set = true,
 		},
 		.max_stack	     = sysctl__max_stack(),
 		.annotation_opts     = annotation__default_options,
Signature · 1 line
2.17.2
#1 lore raw

Em Mon, Apr 15, 2019 at 02:53:33PM +0200, Jiri Olsa escreveu:

Quoted 10 lines

Bastian reported broken perf top -p PID command, it won't display any data.

The problem is that for -p option we monitor single thread, so we don't enable time in samples, because it's not needed.

However since commit 16c66bc167cc we use ordered queues to stash data plus later commits added logic for dropping samples in case there's big load and we don't keep up. All this needs timestamp for sample. Enabling it unconditionally for perf top.

Thanks, tested and applied.

- Arnaldo

Quoted 22 lines
Fixes 16c66bc167cc ("perf top: Add processing thread")
---
 tools/perf/builtin-top.c | 1 +
 1 file changed, 1 insertion(+)
tools/perf/builtin-top.c +1 -0
index 1999d6533d12..fbbb0da43abb 100644
@@ -1377,6 +1377,7 @@ int cmd_top(int argc, const char **argv)
 			 * */
 			.overwrite	= 0,
 			.sample_time	= true,
+			.sample_time_set = true,
 		},
 		.max_stack	     = sysctl__max_stack(),
 		.annotation_opts     = annotation__default_options,
Signature · 1 line
2.17.2
Signature · 1 line
- Arnaldo
#2 lore raw

[tip:perf/urgent] perf top: Always sample time to satisfy needs of use of ordered queuing

In reply to Jiri Olsa
perf top: Always sample time to satisfy needs of use of ordered queuing
Commit-ID:  1e6db2ee86e6a4399fc0ae5689e55e0fd1c43caf
Gitweb:     https://git.kernel.org/tip/1e6db2ee86e6a4399fc0ae5689e55e0fd1c43caf
Author:     Jiri Olsa <[email protected]>
AuthorDate: Mon, 15 Apr 2019 14:53:33 +0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Tue, 16 Apr 2019 12:36:20 -0300

perf top: Always sample time to satisfy needs of use of ordered queuing

Bastian reported broken 'perf top -p PID' command, it won't display any data.

The problem is that for -p option we monitor single thread, so we don't enable time in samples, because it's not needed.

However since commit 16c66bc167cc we use ordered queues to stash data plus later commits added logic for dropping samples in case there's big load and we don't keep up. All this needs timestamp for sample. Enabling it unconditionally for perf top.

Cc Alexander Shishkin <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc bastian beischer <[email protected]>
Fixes 16c66bc167cc ("perf top: Add processing thread")
---
 tools/perf/builtin-top.c | 1 +
 1 file changed, 1 insertion(+)
tools/perf/builtin-top.c +1 -0
index 1999d6533d12..fbbb0da43abb 100644
@@ -1377,6 +1377,7 @@ int cmd_top(int argc, const char **argv)
 			 * */
 			.overwrite	= 0,
 			.sample_time	= true,
+			.sample_time_set = true,
 		},
 		.max_stack	     = sysctl__max_stack(),
 		.annotation_opts     = annotation__default_options,