linux/tools/perf
Frederic Weisbecker c0a8865e32 perf tools: callchain: Fix bad rounding of minimum rate
Sometimes we get callchain branches that have a rate under the
limit given by the user.

Say you launched:

 perf record -f -g -a ./hackbench 10
 perf report -g fractal,10.0

And you got:

2.33%       hackbench  [kernel]                  [k] _spin_lock_irqsave
                |
                |--78.57%-- remove_wait_queue
                |          poll_freewait
                |          do_sys_poll
                |          sys_poll
                |          sysenter_dispatch
                |          0xf7ffa430
                |          0x1ffadea3c
                |
                |--7.14%-- __up_read
                |          up_read
                |          do_page_fault
                |          page_fault
                |          0xf7ffa430
                |          0xa0df710000000a
                ...

It is abnormal to get a 7.14% branch whereas we passed a 10%
filter.

The problem is that we round down the minimum threshold. This
happens mostly when we have very low number of events. If the
total amount of your branch is 4 and you have a subranch of 3
events, filtering to 90% will be computed like follows:

  limit = 4 * 0.9;

The result is about 3.6, but the cast to integer will round
down to 3. It means that our filter is actually of 75%

We must then explicitly round up the minimum threshold.

Reported-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: acme@redhat.com
Cc: peterz@infradead.org
Cc: efault@gmx.de
LKML-Reference: <20090809024235.GA10146@nowhere>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-08-09 13:07:46 +02:00
..
Documentation perf: "Longum est iter per praecepta, breve et efficax per exempla" 2009-08-09 12:54:46 +02:00
util perf tools: callchain: Fix bad rounding of minimum rate 2009-08-09 13:07:46 +02:00
.gitignore perf_counter tools: Move from Documentation/perf_counter/ to tools/perf/ 2009-06-06 20:33:43 +02:00
builtin-annotate.c perf_counter: PERF_SAMPLE_ID and inherited counters 2009-07-22 18:05:56 +02:00
builtin-help.c perf_counter tools: Add more warnings and fix/annotate them 2009-07-01 12:49:48 +02:00
builtin-list.c perf_counter tools: Add more warnings and fix/annotate them 2009-07-01 12:49:48 +02:00
builtin-record.c perf record: Fix the -A UI for empty or non-existent perf.data 2009-08-09 12:54:40 +02:00
builtin-report.c perf tools: callchain: Fix sum of percentages to be 100% by displaying amount of ignored chains in fractal mode 2009-08-09 12:54:43 +02:00
builtin-stat.c perf stat: Fix tool option consistency: rename -S/--scale to -c/--scale 2009-08-09 12:54:37 +02:00
builtin-top.c perf top: Improve interactive key handling 2009-08-09 12:54:31 +02:00
builtin.h perf_counter tools: Move from Documentation/perf_counter/ to tools/perf/ 2009-06-06 20:33:43 +02:00
command-list.txt perf_counter tools: Move from Documentation/perf_counter/ to tools/perf/ 2009-06-06 20:33:43 +02:00
CREDITS perf_counter tools: Add CREDITS file for Git contributors 2009-06-24 19:54:29 +02:00
design.txt perf_counter: Start documenting HAVE_PERF_COUNTERS requirements 2009-06-12 19:37:30 +02:00
Makefile perf_counter tools: Fix libbfd detection for systems with libz dependency 2009-08-09 12:54:47 +02:00
perf.c perf_counter: Detect debugfs location 2009-07-22 18:05:57 +02:00
perf.h Merge branch 'perf-counters-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/peterz/linux-2.6-perf 2009-07-22 11:41:56 -07:00