alistair23-linux/tools/perf
Kan Liang c4937a91ea perf tools: handle PERF_RECORD_LOST_SAMPLES
This patch modifies the perf tool to handle the new RECORD type,
PERF_RECORD_LOST_SAMPLES.

The number of lost-sample events is stored in
.nr_events[PERF_RECORD_LOST_SAMPLES]. The exact number of samples
which the kernel dropped is stored in total_lost_samples.

When the percentage of dropped samples is greater than 5%, a warning
is printed.

Here are some examples:

Eg 1, Recording different frequently-occurring events is safe with the
      patch. Only a very low drop rate is associated with such actions.

$ perf record -e '{cycles:p,instructions:p}' -c 20003 --no-time ~/tchain ~/tchain

$ perf report -D | tail
          SAMPLE events:     120243
           MMAP2 events:          5
    LOST_SAMPLES events:         24
  FINISHED_ROUND events:         15
cycles:p stats:
           TOTAL events:      59348
          SAMPLE events:      59348
instructions:p stats:
           TOTAL events:      60895
          SAMPLE events:      60895

$ perf report --stdio --group
 # To display the perf.data header info, please use --header/--header-only options.
 #
 #
 # Total Lost Samples: 24
 #
 # Samples: 120K of event 'anon group { cycles:p, instructions:p }'
 # Event count (approx.): 24048600000
 #
 #         Overhead  Command      Shared Object     Symbol
 # ................  ...........  ................
 ..................................
 #
    99.74%  99.86%  tchain_edit  tchain_edit       [.] f3
     0.09%   0.02%  tchain_edit  tchain_edit       [.] f2
     0.04%   0.00%  tchain_edit  [kernel.vmlinux]  [k] ixgbe_read_reg

Eg 2, Recording the same thing multiple times can lead to high drop
      rate, but it is not a useful configuration.

$ perf record -e '{cycles:p,cycles:p}' -c 20003 --no-time ~/tchain
Warning: Processed 600592 samples and lost 99.73% samples!
[perf record: Woken up 148 times to write data]
[perf record: Captured and wrote 36.922 MB perf.data (1206322 samples)]
[perf record: Woken up 1 times to write data]
[perf record: Captured and wrote 0.121 MB perf.data (1629 samples)]

Signed-off-by: Kan Liang <kan.liang@intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: acme@infradead.org
Cc: eranian@google.com
Link: http://lkml.kernel.org/r/1431285195-14269-9-git-send-email-kan.liang@intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2015-06-07 16:09:06 +02:00
..
arch perf tools: Add ARM64 perf_regs_load to support libunwind and enable testing 2015-05-29 12:43:40 -03:00
bench perf bench numa: Share sched_getcpu() __weak def with cloexec.c 2015-05-18 12:36:46 -03:00
config perf tools: Improve setting of gcc debug option 2015-05-27 12:21:45 -03:00
Documentation perf tools: Document relation of per-thread event count feature 2015-05-12 09:59:48 -03:00
python
scripts perf build: Add scripts objects building 2015-02-12 11:49:53 -03:00
tests perf tools: Deal with kernel module names in '[]' correctly 2015-06-03 10:02:38 -03:00
ui perf tools: Make Ctrl-C stop processing on TUI 2015-05-29 12:49:00 -03:00
util perf tools: handle PERF_RECORD_LOST_SAMPLES 2015-06-07 16:09:06 +02:00
.gitignore perf build: Use FEATURE-DUMP instead of PERF-FEATURES in the .gitignore file 2015-03-20 17:49:51 -03:00
Build perf tools: Add new 'perf data' command 2015-02-25 12:42:25 -03:00
builtin-annotate.c perf annotate: Fix -i option, which is currently ignored. 2015-05-29 12:43:34 -03:00
builtin-bench.c perf bench futex: Support parallel waker threads 2015-05-08 16:23:50 -03:00
builtin-buildid-cache.c perf buildid-cache: Show usage with incorrect params 2015-02-27 15:52:40 -03:00
builtin-buildid-list.c perf tools: Hit all build ids when AUX area tracing 2015-05-04 19:49:42 -03:00
builtin-data.c perf data: Support using -f to override perf.data file ownership for 'convert' 2015-04-02 13:18:52 -03:00
builtin-diff.c perf machine: Protect the machine->threads with a rwlock 2015-05-08 16:19:27 -03:00
builtin-evlist.c perf evlist: Support using -f to override perf.data file ownership 2015-04-02 13:18:45 -03:00
builtin-help.c perf tools: Add the bash completion for listing subsubcommands of perf help 2015-03-19 13:49:39 -03:00
builtin-inject.c perf machine: Protect the machine->threads with a rwlock 2015-05-08 16:19:27 -03:00
builtin-kmem.c perf kmem: Fix compiler warning about may be accessing uninitialized variable 2015-05-29 12:43:40 -03:00
builtin-kvm.c perf machine: Protect the machine->threads with a rwlock 2015-05-08 16:19:27 -03:00
builtin-list.c perf list: Extend raw-dump to certain kind of events 2015-02-27 15:52:24 -03:00
builtin-lock.c perf machine: Protect the machine->threads with a rwlock 2015-05-08 16:19:27 -03:00
builtin-mem.c perf machine: Protect the machine->threads with a rwlock 2015-05-08 16:19:27 -03:00
builtin-probe.c perf probe: Add --range option to show a variable's location range 2015-05-12 09:59:50 -03:00
builtin-record.c perf tools: Move branch option parsing to own file 2015-05-27 21:02:17 -03:00
builtin-report.c perf tools: handle PERF_RECORD_LOST_SAMPLES 2015-06-07 16:09:06 +02:00
builtin-sched.c perf sched: Add option to merge like comms to lat output 2015-05-27 12:21:45 -03:00
builtin-script.c perf machine: Protect the machine->threads with a rwlock 2015-05-08 16:19:27 -03:00
builtin-stat.c perf stat: Add metrics support for exclude_idle 2015-04-29 10:38:06 -03:00
builtin-timechart.c perf tools: Elliminate alignment holes 2015-05-18 10:17:33 -03:00
builtin-top.c perf hists: Reducing arguments of hist_entry_iter__add() 2015-05-27 12:21:43 -03:00
builtin-trace.c perf trace: Fix the build on older distros 2015-05-14 19:27:46 -03:00
builtin.h perf tools: Add new 'perf data' command 2015-02-25 12:42:25 -03:00
command-list.txt perf tools: Add new 'perf data' command 2015-02-25 12:42:25 -03:00
CREDITS
design.txt perf tools: Update some code references in design.txt 2014-03-18 18:17:06 -03:00
Makefile perf tools: Use getconf to determine number of online CPUs 2015-05-04 12:43:40 -03:00
Makefile.perf perf tools: Separate the tests and tools in installation 2015-05-27 12:21:43 -03:00
MANIFEST tools: Move tools/perf/util/include/linux/{list.h,poison.h} to tools/include 2015-06-02 19:07:29 -03:00
perf-archive.sh
perf-completion.sh perf tools: Avoid confusion with preloaded bash function for perf bash completion 2015-03-19 13:53:27 -03:00
perf-read-vdso.c perf tools: Build programs to copy 32-bit compatibility 2014-10-29 10:32:48 -02:00
perf-sys.h perf tools: Move generic barriers out of perf-sys.h 2015-05-08 16:05:08 -03:00
perf-with-kcore.sh perf tools: Add perf-with-kcore script 2014-09-17 17:08:08 -03:00
perf.c perf tools: Fix the bash completion problem of 'perf --*' 2015-02-27 15:52:28 -03:00
perf.h perf tools: Add AUX area tracing Snapshot Mode 2015-05-05 18:13:00 -03:00