aboutsummaryrefslogtreecommitdiff
path: root/tools
AgeCommit message (Collapse)AuthorFilesLines
2017-04-06selftests/bpf: fix merge conflictAlexei Starovoitov1-5/+0
fix artifact of merge resolution Signed-off-by: Alexei Starovoitov <[email protected]> Acked-by: Daniel Borkmann <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2017-04-06Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/netDavid S. Miller3-6/+308
Mostly simple cases of overlapping changes (adding code nearby, a function whose name changes, for example). Signed-off-by: David S. Miller <[email protected]>
2017-04-05selftests: add a generic testsuite for ethernet deviceLABBE Corentin2-1/+201
This patch add a generic testsuite for testing ethernet network device driver. Signed-off-by: Corentin Labbe <[email protected]> Tested-by: Andrew Lunn <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2017-04-04perf annotate: Fix missing number of samples for source_line_samplesTaeung Song2-3/+5
The option 'show-total-period' works fine without a option '-l'. But if running 'perf annotate --stdio -l --show-total-period', you can see a problem showing only zero '0' for number of samples. Before: $ perf annotate --stdio -l --show-total-period ... 0 : 400816: push %rbp 0 : 400817: mov %rsp,%rbp 0 : 40081a: mov %edi,-0x24(%rbp) 0 : 40081d: mov %rsi,-0x30(%rbp) 0 : 400821: mov -0x24(%rbp),%eax 0 : 400824: mov -0x30(%rbp),%rdx 0 : 400828: mov (%rdx),%esi 0 : 40082a: mov $0x0,%edx ... The reason is it was missed to set number of samples of source_line_samples, so set it ordinarily. After: $ perf annotate --stdio -l --show-total-period ... 3 : 400816: push %rbp 4 : 400817: mov %rsp,%rbp 0 : 40081a: mov %edi,-0x24(%rbp) 0 : 40081d: mov %rsi,-0x30(%rbp) 1 : 400821: mov -0x24(%rbp),%eax 2 : 400824: mov -0x30(%rbp),%rdx 0 : 400828: mov (%rdx),%esi 1 : 40082a: mov $0x0,%edx ... Signed-off-by: Taeung Song <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Martin Liska <[email protected]> Cc: Masami Hiramatsu <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Wang Nan <[email protected]> Fixes: 0c4a5bcea460 ("perf annotate: Display total number of samples with --show-total-period") Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2017-04-04perf tools: Don't die on a print functionArnaldo Carvalho de Melo1-2/+7
Trying to remove die() calls from library functions, postponing exiting to the tool main code. Link: http://lkml.kernel.org/n/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2017-04-04perf tools: Handle allocation failures gracefullyArnaldo Carvalho de Melo1-15/+39
The callers of perf_read_values__enlarge_counters() already propagate errors, so just print some debug diagnostics and handle allocation failures gracefully, not trying to do silly things like 'a = realloc(a)'. Link: http://lkml.kernel.org/n/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2017-04-04perf tools: Remove die() callArnaldo Carvalho de Melo1-1/+2
We can just use the exit() right after the branch calling die(). Link: http://lkml.kernel.org/n/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2017-04-04tracing/kprobes: expose maxactive for kretprobe in kprobe_eventsAlban Crequy1-0/+39
When a kretprobe is installed on a kernel function, there is a maximum limit of how many calls in parallel it can catch (aka "maxactive"). A kernel module could call register_kretprobe() and initialize maxactive (see example in samples/kprobes/kretprobe_example.c). But that is not exposed to userspace and it is currently not possible to choose maxactive when writing to /sys/kernel/debug/tracing/kprobe_events The default maxactive can be as low as 1 on single-core with a non-preemptive kernel. This is too low and we need to increase it not only for recursive functions, but for functions that sleep or resched. This patch updates the format of the command that can be written to kprobe_events so that maxactive can be optionally specified. I need this for a bpf program attached to the kretprobe of inet_csk_accept, which can sleep for a long time. This patch includes a basic selftest: > # ./ftracetest -v test.d/kprobe/ > === Ftrace unit tests === > [1] Kprobe dynamic event - adding and removing [PASS] > [2] Kprobe dynamic event - busy event check [PASS] > [3] Kprobe dynamic event with arguments [PASS] > [4] Kprobes event arguments with types [PASS] > [5] Kprobe dynamic event with function tracer [PASS] > [6] Kretprobe dynamic event with arguments [PASS] > [7] Kretprobe dynamic event with maxactive [PASS] > > # of passed: 7 > # of failed: 0 > # of unresolved: 0 > # of untested: 0 > # of unsupported: 0 > # of xfailed: 0 > # of undefined(test bug): 0 BugLink: https://github.com/iovisor/bcc/issues/1072 Link: http://lkml.kernel.org/r/[email protected] Acked-by: Masami Hiramatsu <[email protected]> Signed-off-by: Alban Crequy <[email protected]> Signed-off-by: Steven Rostedt (VMware) <[email protected]>
2017-04-04Merge branch 'perf/uncore-json-updates-1' of ↵Arnaldo Carvalho de Melo7-3/+1546
git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc into perf/core Pull perf/core improvements from Andi Kleen: This pull requests contains updates to the Intel PMU events JSON files, plus two one liner code fixes for the JSON files (also appended as patch) The most remarkable change is support for Sandy Bridge to Skylake client uncore event list support. Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2017-04-04perf sdt powerpc: Add argument supportRavi Bangoria1-0/+111
SDT marker argument is in N@OP format. Here OP is arch dependent component. Add powerpc logic to parse OP and convert it to uprobe compatible format. Signed-off-by: Ravi Bangoria <[email protected]> Acked-by: Masami Hiramatsu <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Alexis Berlemont <[email protected]> Cc: Hemant Kumar <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Naveen N. Rao <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2017-04-03Merge tag 'v4.11-rc5' into x86/mm, to refresh the branchIngo Molnar3-13/+37
Signed-off-by: Ingo Molnar <[email protected]>
2017-04-01selftests/bpf: add l4 load balancer test based on sched_clsAlexei Starovoitov3-1/+563
this l4lb demo is a comprehensive test case for LLVM codegen and kernel verifier. It's using fully inlined jhash(), complex packet parsing and multiple map lookups of different types to stress llvm and verifier. The map sizes, map population and test vectors are artificial to exercise different paths through the bpf program. Signed-off-by: Alexei Starovoitov <[email protected]> Acked-by: Daniel Borkmann <[email protected]> Acked-by: Martin KaFai Lau <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2017-04-01selftests/bpf: add a test for basic XDP functionalityAlexei Starovoitov4-1/+332
add C test for xdp_adjust_head(), packet rewrite and map lookups Signed-off-by: Alexei Starovoitov <[email protected]> Acked-by: Daniel Borkmann <[email protected]> Acked-by: Martin KaFai Lau <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2017-04-01selftests/bpf: add a test for overlapping packet range checksAlexei Starovoitov3-4/+215
add simple C test case for llvm and verifier range check fix from commit b1977682a385 ("bpf: improve verifier packet range checks") Signed-off-by: Alexei Starovoitov <[email protected]> Acked-by: Daniel Borkmann <[email protected]> Acked-by: Martin KaFai Lau <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2017-04-01tools/lib/bpf: expose bpf_program__set_type()Alexei Starovoitov2-2/+3
expose bpf_program__set_type() to set program type Signed-off-by: Alexei Starovoitov <[email protected]> Acked-by: Daniel Borkmann <[email protected]> Acked-by: Martin KaFai Lau <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2017-04-01tools/lib/bpf: add support for BPF_PROG_TEST_RUN commandAlexei Starovoitov3-1/+51
add support for BPF_PROG_TEST_RUN command to libbpf.a Signed-off-by: Alexei Starovoitov <[email protected]> Acked-by: Daniel Borkmann <[email protected]> Acked-by: Martin KaFai Lau <[email protected]> Acked-by: Wang Nan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2017-04-01bpf: add various verifier test cases for self-testsDaniel Borkmann3-6/+283
Add a couple of test cases, for example, probing for xadd on a spilled pointer to packet and map_value_adj register, various other map_value_adj tests including the unaligned load/store, and trying out pointer arithmetic on map_value_adj register itself. For the unaligned load/store, we need to figure out whether the architecture has efficient unaligned access and need to mark affected tests accordingly. Signed-off-by: Daniel Borkmann <[email protected]> Acked-by: Alexei Starovoitov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2017-04-01Merge tag 'perf-core-for-mingo-4.12-20170331' of ↵Ingo Molnar24-403/+707
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo: New features: - Beautify the statx syscall arguments in 'perf trace' (Arnaldo Carvalho de Melo) e.g.: System wide strace like session: # trace -e statx 16612.967 ( 0.028 ms): statx/4562 statx(dfd: CWD, filename: /tmp/statx, flags: SYMLINK_NOFOLLOW, mask: TYPE|MODE|NLINK|UID|GID|ATIME|MTIME|CTIME|INO|SIZE|BLOCKS|BTIME, buffer: 0x7ffef195d660) = 0 36050.891 ( 0.007 ms): statx/4576 statx(dfd: CWD, filename: /etc/passwd, flags: SYMLINK_NOFOLLOW|STATX_DONT_SYNC, mask: BTIME, buffer: 0x7ffda9bf50f0) = 0 ^C# User visible changes: - Handle unpaired raw_syscalls:sys_exit events in 'perf trace', i.e. we shouldn't try to calculate duration or print the timestamp for a missing matching raw_syscalls:sys_enter (Arnaldo Carvalho de Melo) - Do not print "cycles: 0" in perf report LBR lines in platforms not supporting 'cycles', such as Intel's Broadwell (Jin Yao) - Handle missing $HOME env var (Jiri Olsa) - Map 8-bit registers (al, bl, etc), not supported in uprobes_events, to the next best thing (ax, bx, etc) supported (Ravi Bangoria) Signed-off-by: Arnaldo Carvalho de Melo <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
2017-03-31perf trace: Beautify statx syscall 'flag' and 'mask' argumentsArnaldo Carvalho de Melo6-9/+104
To test it, build samples/statx/test_statx, which I did as: $ make headers_install $ cc -I ~/git/linux/usr/include samples/statx/test-statx.c -o /tmp/statx And then use perf trace on it: # perf trace -e statx /tmp/statx /etc/passwd statx(/etc/passwd) = 0 results=7ff Size: 3496 Blocks: 8 IO Block: 4096 regular file Device: fd:00 Inode: 280156 Links: 1 Access: (0644/-rw-r--r--) Uid: 0 Gid: 0 Access: 2017-03-29 16:01:01.650073438-0300 Modify: 2017-03-10 16:25:14.156479354-0300 Change: 2017-03-10 16:25:14.171479328-0300 0.000 ( 0.007 ms): statx/30648 statx(dfd: CWD, filename: 0x7ef503f4, flags: SYMLINK_NOFOLLOW, mask: TYPE|MODE|NLINK|UID|GID|ATIME|MTIME|CTIME|INO|SIZE|BLOCKS|BTIME, buffer: 0x7fff7ef4eb10) = 0 # Using the test-stat.c options to change the mask: # perf trace -e statx /tmp/statx -O /etc/passwd > /dev/null 0.000 ( 0.008 ms): statx/30745 statx(dfd: CWD, filename: 0x3a0753f4, flags: SYMLINK_NOFOLLOW, mask: BTIME, buffer: 0x7ffd3a0735c0) = 0 # # perf trace -e statx /tmp/statx -A /etc/passwd > /dev/null 0.000 ( 0.010 ms): statx/30757 statx(dfd: CWD, filename: 0xa94e63f4, flags: SYMLINK_NOFOLLOW|NO_AUTOMOUNT, mask: TYPE|MODE|NLINK|UID|GID|ATIME|MTIME|CTIME|INO|SIZE|BLOCKS|BTIME, buffer: 0x7ffea94e49d0) = 0 # # trace --no-inherit -e statx /tmp/statx -F /etc/passwd > /dev/null 0.000 ( 0.011 ms): statx(dfd: CWD, filename: 0x3b02d3f3, flags: SYMLINK_NOFOLLOW|STATX_FORCE_SYNC, mask: TYPE|MODE|NLINK|UID|GID|ATIME|MTIME|CTIME|INO|SIZE|BLOCKS|BTIME, buffer: 0x7ffd3b02c850) = 0 # # trace --no-inherit -e statx /tmp/statx -F -L /etc/passwd > /dev/null 0.000 ( 0.008 ms): statx(dfd: CWD, filename: 0x15cff3f3, flags: STATX_FORCE_SYNC, mask: TYPE|MODE|NLINK|UID|GID|ATIME|MTIME|CTIME|INO|SIZE|BLOCKS|BTIME, buffer: 0x7fff15cfdda0) = 0 # # trace --no-inherit -e statx /tmp/statx -D -O /etc/passwd > /dev/null 0.000 ( 0.009 ms): statx(dfd: CWD, filename: 0xfa37f3f3, flags: SYMLINK_NOFOLLOW|STATX_DONT_SYNC, mask: BTIME, buffer: 0x7ffffa37da20) = 0 # Adding a probe to get the filename collected as well: # perf probe 'vfs_getname=getname_flags:72 pathname=result->name:string' Added new event: probe:vfs_getname (on getname_flags:72 with pathname=result->name:string) You can now use it in all perf tools, such as: perf record -e probe:vfs_getname -aR sleep 1 # trace --no-inherit -e statx /tmp/statx -D -O /etc/passwd > /dev/null 0.169 ( 0.007 ms): statx(dfd: CWD, filename: /etc/passwd, flags: SYMLINK_NOFOLLOW|STATX_DONT_SYNC, mask: BTIME, buffer: 0x7ffda9bf50f0) = 0 # Same technique could be used to collect and beautify the result put in the 'buffer' argument. Finally do a system wide 'perf trace' session looking for any use of statx, then run the test proggie with various flags: # trace -e statx 16612.967 ( 0.028 ms): statx/4562 statx(dfd: CWD, filename: /tmp/statx, flags: SYMLINK_NOFOLLOW, mask: TYPE|MODE|NLINK|UID|GID|ATIME|MTIME|CTIME|INO|SIZE|BLOCKS|BTIME, buffer: 0x7ffef195d660) = 0 33064.447 ( 0.011 ms): statx/4569 statx(dfd: CWD, filename: /tmp/statx, flags: SYMLINK_NOFOLLOW|STATX_FORCE_SYNC, mask: TYPE|MODE|NLINK|UID|GID|ATIME|MTIME|CTIME|INO|SIZE|BLOCKS|BTIME, buffer: 0x7ffc5484c790) = 0 36050.891 ( 0.023 ms): statx/4576 statx(dfd: CWD, filename: /tmp/statx, flags: SYMLINK_NOFOLLOW, mask: BTIME, buffer: 0x7ffeb18b66e0) = 0 38039.889 ( 0.023 ms): statx/4584 statx(dfd: CWD, filename: /tmp/statx, flags: SYMLINK_NOFOLLOW, mask: TYPE|MODE|NLINK|UID|GID|ATIME|MTIME|CTIME|INO|SIZE|BLOCKS|BTIME, buffer: 0x7fff1db0ea90) = 0 ^C# This one also starts moving the beautifiers from files directly included in builtin-trace.c to separate objects + a beauty.h header with prototypes, so that we can add test cases in tools/perf/tests/ to fire syscalls with various arguments and then get them intercepted as syscalls:sys_enter_foo or raw_syscalls:sys_enter + sys_exit to then format and check that the formatted output is the one we expect. Cc: Adrian Hunter <[email protected]> Cc: Al Viro <[email protected]> Cc: David Ahern <[email protected]> Cc: David Howells <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Wang Nan <[email protected]> Link: http://lkml.kernel.org/n/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2017-03-31perf tools: Do not fail in case of empty HOME env variableJiri Olsa1-23/+31
Currently we fail in the following case: $ unset HOME $ ./perf record ls $ echo $? 255 It's because the config code init fails due to a missing HOME variable value. Fix this by skipping the user config init if there's no HOME variable value. Reported-by: Jan Stancek <[email protected]> Signed-off-by: Jiri Olsa <[email protected]> Cc: David Ahern <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2017-03-31tools include uapi: Grab copies of stat.h and fcntl.hArnaldo Carvalho de Melo5-0/+253
We will need it to build tools/perf/trace/beauty/statx.h. Cc: Adrian Hunter <[email protected]> Cc: David Ahern <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Wang Nan <[email protected]> Link: http://lkml.kernel.org/n/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2017-03-30perf vendor events intel: Add missing space in json descriptionsAndi Kleen1-0/+1
Add a missing space in the JSON description after the uncore unit Before: perf list ... unc_arb_coh_trk_requests.all [Unit: uncore_arbNumber of entries allocated. Account for Any type: e.g. Snoop, Core aperture, etc] ... After: unc_arb_coh_trk_requests.all [Unit: uncore_arb Number of entries allocated. Account for Any type: e.g. Snoop, Core aperture, etc] Cc: [email protected] Link: http://lkml.kernel.org/n/[email protected] Signed-off-by: Andi Kleen <[email protected]>
2017-03-30perf vendor events intel: Add uncore_arb JSON supportAndi Kleen1-0/+1
The JSON lists call the box iMPH-U, while perf calls it arb. Add conversion support to json to convert the unit properly. Cc: [email protected] Link: http://lkml.kernel.org/n/[email protected] Signed-off-by: Andi Kleen <[email protected]>
2017-03-30perf vendor events intel: Add uncore events for Skylake clientAndi Kleen1-0/+254
Add V25 of Skylake uncore events Cc: [email protected] Link: http://lkml.kernel.org/n/[email protected] Signed-off-by: Andi Kleen <[email protected]>
2017-03-30perf vendor events intel: Add uncore events for Broadwell clientAndi Kleen1-0/+278
Add V18 of Broadwell uncore events Cc: [email protected] Link: http://lkml.kernel.org/n/[email protected] Signed-off-by: Andi Kleen <[email protected]>
2017-03-30perf vendor events intel: Add uncore events for Haswell clientAndi Kleen1-0/+374
Add V25 of Haswell uncore events Cc: [email protected] Link: http://lkml.kernel.org/n/[email protected] Signed-off-by: Andi Kleen <[email protected]>
2017-03-30perf vendor events intel: Add uncore events for Ivy Bridge clientAndi Kleen1-0/+314
Add V18 of Ivy Bridge uncore events Cc: [email protected] Link: http://lkml.kernel.org/n/[email protected] Signed-off-by: Andi Kleen <[email protected]>
2017-03-30perf vendor events intel: Add uncore events for Sandy Bridge clientAndi Kleen1-0/+314
Add V15 of Sandy Bridge uncore events Cc: [email protected] Link: http://lkml.kernel.org/n/[email protected] Signed-off-by: Andi Kleen <[email protected]>
2017-03-30perf vendor events intel: Add missing UNC_M_DCLOCKTICKS for Broadwell DE uncoreAndi Kleen1-3/+10
An earlier update removed the UNC_M_CLOCKTICKS event for Broadwell DE. But Metric events were still referring to it. This adds it back under a different name from the event list, and also fixes up the Metric events to use the new name. Cc: [email protected] Link: http://lkml.kernel.org/n/[email protected] Signed-off-by: Andi Kleen <[email protected]>
2017-03-30perf utils: Fix spelling mistake: "Invalud" -> "Invalid"Colin Ian King1-1/+1
Trivial fix to spelling mistake in pr_debug message. Signed-off-by: Colin King <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Krister Johansen <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: [email protected] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2017-03-30Merge branch 'linus' into perf/core, to pick up fixesIngo Molnar2-12/+36
Signed-off-by: Ingo Molnar <[email protected]>
2017-03-29perf trace: Handle unpaired raw_syscalls:sys_exit eventArnaldo Carvalho de Melo1-9/+34
Which may happen when we start a tracing session and a thread is waiting for something like "poll" to return, in which case we better print "?" both for the syscall entry timestamp and for the duration. E.g.: Tracing existing mutt session: # perf trace -p `pidof mutt` ? ( ? ): mutt/17135 ... [continued]: poll()) = 1 0.027 ( 0.013 ms): mutt/17135 read(buf: 0x7ffcb3c42cef, count: 1) = 1 0.047 ( 0.008 ms): mutt/17135 poll(ufds: 0x7ffcb3c42c50, nfds: 1, timeout_msecs: 1000) = 1 0.059 ( 0.008 ms): mutt/17135 read(buf: 0x7ffcb3c42cef, count: 1) = 1 <SNIP> Before it would print a large number because we'd do: ttrace->entry_time - trace->base_time And entry_time would be 0, while base_time would be the timestamp for the first event 'perf trace' reads, oops. Cc: Adrian Hunter <[email protected]> Cc: David Ahern <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Luis Claudio Gonçalves <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Wang Nan <[email protected]> Link: http://lkml.kernel.org/n/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
2017-03-29tools/kvm_stat: add '%Total' columnStefan Raspl1-1/+8
Add column '%Total' next to 'Total' for easier comparison of numbers between hosts. Signed-off-by: Stefan Raspl <[email protected]> Marc Hartmayer <[email protected]> Signed-off-by: Radim Krčmář <[email protected]>
2017-03-29tools/kvm_stat: add interactive command 'r'Stefan Raspl2-14/+53
Provide an interactive command to reset the tracepoint statistics. Requires some extra work for debugfs, as the counters cannot be reset. On the up side, this offers us the opportunity to have debugfs values reset on startup and whenever a filter is modified, becoming consistent with the tracepoint provider. As a bonus, 'kvmstat -dt' will now provide useful output, instead of mixing values in totally different orders of magnitude. Furthermore, we avoid unnecessary resets when any of the filters is "changed" interactively to the previous value. Signed-off-by: Stefan Raspl <[email protected]> Acked-by: Janosch Frank <[email protected]> Signed-off-by: Radim Krčmář <[email protected]>
2017-03-29tools/kvm_stat: add interactive command 'c'Stefan Raspl2-4/+14
Provide a real simple way to erase any active filter. Signed-off-by: Stefan Raspl <[email protected]> Reviewed-by: Marc Hartmayer <[email protected]> Signed-off-by: Radim Krčmář <[email protected]>
2017-03-29tools/kvm_stat: add option '--guest'Stefan Raspl2-2/+105
Add a new option '-g'/'--guest' to select a particular process by providing the QEMU guest name. Notes: - The logic to figure out the pid corresponding to the guest name might look scary, but works pretty reliably in practice; in the unlikely event that it returns add'l flukes, it will bail out and hint at using '-p' instead, no harm done. - Mixing '-g' and '-p' is possible, and the final instance specified on the command line is the significant one. This is consistent with current behavior for '-p' which, if specified multiple times, also regards the final instance as the significant one. Signed-off-by: Stefan Raspl <[email protected]> Reviewed-by: Janosch Frank <[email protected]> Signed-off-by: Radim Krčmář <[email protected]>
2017-03-29tools/kvm_stat: remove regex filter on empty inputStefan Raspl1-0/+1
Behavior on empty/0 input for regex and pid filtering was inconsistent, as the former would keep the current filter, while the latter would (naturally) remove any pid filtering. Make things consistent by falling back to the default filter on empty input for the regex filter dialogue. Signed-off-by: Stefan Raspl <[email protected]> Reviewed-by: Marc Hartmayer <[email protected]> Signed-off-by: Radim Krčmář <[email protected]>
2017-03-29tools/kvm_stat: display regex when set to non-defaultStefan Raspl1-0/+6
If a user defines a regex filter through the interactive command, display the active regex in the header's second line. Signed-off-by: Stefan Raspl <[email protected]> Reviewed-by: Marc Hartmayer <[email protected]> Signed-off-by: Radim Krčmář <[email protected]>
2017-03-29tools/kvm_stat: print error messages on faulty pid filter inputStefan Raspl1-0/+4
Print helpful messages in case users enter invalid input or invalid pids in the interactive pid filter dialogue. Signed-off-by: Stefan Raspl <[email protected]> Reviewed-by: Marc Hartmayer <[email protected]> Signed-off-by: Radim Krčmář <[email protected]>
2017-03-29tools/kvm_stat: remove pid filter on empty inputStefan Raspl1-4/+7
Improve consistency in the interactive dialogue for pid filtering by removing any filters on empty input (in addition to entering 0). Signed-off-by: Stefan Raspl <[email protected]> Reviewed-by: Janosch Frank <[email protected]> Reviewed-by: Marc Hartmayer <[email protected]> Signed-off-by: Radim Krčmář <[email protected]>
2017-03-29tools/kvm_stat: display guest name when using pid filterStefan Raspl1-2/+39
When running kvm_stat with option '-p' to filter per process, display the QEMU guest name next to the pid, if available. Signed-off-by: Stefan Raspl <[email protected]> Reviewed-By: Janosch Frank <[email protected]> Signed-off-by: Radim Krčmář <[email protected]>
2017-03-29tools/kvm_stat: document list of interactive commandsStefan Raspl2-0/+23
Apart from the source code, there does not seem to be a place that documents the interactive capabilities of kvm_stat yet. Signed-off-by: Stefan Raspl <[email protected]> Signed-off-by: Radim Krčmář <[email protected]>
2017-03-29tools/kvm_stat: reduce perceived idle time on filter updatesStefan Raspl1-18/+30
Whenever a user adds a filter, we * redraw the header immediately for a snappy response * print a message indicating to the user that we're busy while the noticeable delay induced by updating all of the stats objects takes place * update the statistics ASAP (i.e. after 0.25s instead of 3s) to be consistent with behavior on startup To do so, we split the Tui's refresh() method to allow for drawing header and stats separately, and trigger a header refresh whenever we are about to do something that takes a while - like updating filters. Signed-off-by: Stefan Raspl <[email protected]> Signed-off-by: Radim Krčmář <[email protected]>
2017-03-29tools/kvm_stat: full PEP8 complianceStefan Raspl1-0/+22
Provides all missing empty lines as required for full PEP compliance. Signed-off-by: Stefan Raspl <[email protected]> Reviewed-by: Marc Hartmayer <[email protected]> Signed-off-by: Radim Krčmář <[email protected]>
2017-03-29tools/kvm_stat: fix trace setup glitch on field updates in TracepointProviderStefan Raspl1-2/+3
Updating the fields of the TracepointProvider does not propagate changes to the tracepoints. This shows when a pid filter is enabled, whereby subsequent extensions of the fields of the Tracepoint provider (e.g. by toggling drilldown) will not modify the tracepoints as required. To reproduce, select a specific process via interactive command 'p', and enable drilldown via 'x' - none of the fields with the braces will appear although they should. The fix will always leave all available fields in the TracepointProvider enabled. Signed-off-by: Stefan Raspl <[email protected]> Based-on-text-by: Janosch Frank <[email protected]> Signed-off-by: Radim Krčmář <[email protected]>
2017-03-29tools/kvm_stat: fix misc glitchesStefan Raspl1-13/+11
Addresses - eliminate extra import - missing variable initialization - type redefinition from int to float - passing of int type argument instead of string - a couple of PEP8-reported indentation/formatting glitches - remove unused variable drilldown in class Tui Signed-off-by: Stefan Raspl <[email protected]> Reviewed-by: Marc Hartmayer <[email protected]> Signed-off-by: Radim Krčmář <[email protected]>
2017-03-29tools/kvm_stat: handle SIGINT in log and batch modesStefan Raspl1-11/+17
SIGINT causes ugly unhandled exceptions in log and batch mode, which we prevent by catching the exceptions accordingly. Signed-off-by: Stefan Raspl <[email protected]> Reviewed-by: Marc Hartmayer <[email protected]> Signed-off-by: Radim Krčmář <[email protected]>
2017-03-29tools/kvm_stat: catch curses exceptions onlyStefan Raspl1-1/+1
The previous version was catching all exceptions, including SIGINT. We only want to catch the curses exceptions here. Signed-off-by: Stefan Raspl <[email protected]> Reviewed-by: Janosch Frank <[email protected]> Reviewed-by: Sascha Silbe <[email protected]> Reviewed-by: Marc Hartmayer <[email protected]> Signed-off-by: Radim Krčmář <[email protected]>
2017-03-29tools/kvm_stat: hide cursorStefan Raspl1-0/+7
When running kvm_stat in interactive mode, the cursor appears at the lower left corner, which looks a bit distracting. This patch hides the cursor by turning it invisible. Signed-off-by: Stefan Raspl <[email protected]> Reviewed-By: Sascha Silbe <[email protected]> Reviewed-by: Marc Hartmayer <[email protected]> Signed-off-by: Radim Krčmář <[email protected]>
2017-03-28perf report: Drop cycles 0 for LBR printJin Yao1-37/+74
For some platforms, for example Broadwell, it doesn't support cycles for LBR. But the perf always prints cycles:0, it's not necessary. The patch refactors the LBR info print code and drops the cycles:0. For example: perf report --branch-history --no-children --stdio On Broadwell: --0.91%--__random_r random_r.c:394 (iterations:2) __random_r random_r.c:360 (predicted:0.0%) __random_r random_r.c:380 (predicted:0.0%) __random_r random_r.c:357 On Skylake: --1.07%--main div.c:39 (predicted:52.4% cycles:1 iterations:17) main div.c:44 (predicted:52.4% cycles:1) main div.c:42 (cycles:2) compute_flag div.c:28 (cycles:2) compute_flag div.c:27 (cycles:1) rand rand.c:28 (cycles:1) rand rand.c:28 (cycles:1) __random random.c:298 (cycles:1) __random random.c:297 (cycles:1) __random random.c:295 (cycles:1) __random random.c:295 (cycles:1) __random random.c:295 (cycles:1) Signed-off-by: Yao Jin <[email protected]> Reviewed-by: Andi Kleen <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Kan Liang <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>