aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/ring_buffer.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-12-11 21:14:31 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-11 21:14:31 -0500
commit090f8ccba37034cec5a5972a70abeaae7eb0222b (patch)
tree0b7cf8a4bb94601816399acfb336835fbf309a2a /kernel/trace/ring_buffer.c
parentaefb058b0c27dafb15072406fbfd92d2ac2c8790 (diff)
parentcc1b39dbf9f55a438e8a21a694394c20e6a17129 (diff)
Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf updates from Ingo Molnar: "Lots of activity: 211 files changed, 8328 insertions(+), 4116 deletions(-) most of it on the tooling side. Main changes: * ftrace enhancements and fixes from Steve Rostedt. * uprobes fixes, cleanups and preparation for the ARM port from Oleg Nesterov. * UAPI fixes, from David Howels - prepares the arch/x86 UAPI transition * Separate perf tests into multiple objects, one per test, from Jiri Olsa. * Make hardware event translations available in sysfs, from Jiri Olsa. * Fixes to /proc/pid/maps parsing, preparatory to supporting data maps, from Namhyung Kim * Implement ui_progress for GTK, from Namhyung Kim * Add framework for automated perf_event_attr tests, where tools with different command line options will be run from a 'perf test', via python glue, and the perf syscall will be intercepted to verify that the perf_event_attr fields set by the tool are those expected, from Jiri Olsa * Add a 'link' method for hists, so that we can have the leader with buckets for all the entries in all the hists. This new method is now used in the default 'diff' output, making the sum of the 'baseline' column be 100%, eliminating blind spots. * libtraceevent fixes for compiler warnings trying to make perf it build on some distros, like fedora 14, 32-bit, some of the warnings really pointed to real bugs. * Add a browser for 'perf script' and make it available from the report and annotate browsers. It does filtering to find the scripts that handle events found in the perf.data file used. From Feng Tang * perf inject changes to allow showing where a task sleeps, from Andrew Vagin. * Makefile improvements from Namhyung Kim. * Add --pre and --post command hooks in 'stat', from Peter Zijlstra. * Don't stop synthesizing threads when one vanishes, this is for the existing threads when we start a tool like trace. * Use sched:sched_stat_runtime to provide a thread summary, this produces the same output as the 'trace summary' subcommand of tglx's original "trace" tool. * Support interrupted syscalls in 'trace' * Add an event duration column and filter in 'trace'. * There are references to the man pages in some tools, so try to build Documentation when installing, warning the user if that is not possible, from Borislav Petkov. * Give user better message if precise is not supported, from David Ahern. * Try to find cross-built objdump path by using the session environment information in the perf.data file header, from Irina Tirdea, original patch and idea by Namhyung Kim. * Diplays more output on features check for make V=1, so that one can figure out what is happening by looking at gcc output, etc. From Jiri Olsa. * Add on_exit implementation for systems without one, e.g. Android, from Bernhard Rosenkraenzer. * Only process events for vcpus of interest, helps handling large number of events, from David Ahern. * Cross compilation fixes for Android, from Irina Tirdea. * Add documentation on compiling for Android, from Irina Tirdea. * perf diff improvements from Jiri Olsa. * Target (task/user/cpu/syswide) handling improvements, from Namhyung Kim. * Add support in 'trace' for tracing workload given by command line, from Namhyung Kim. * ... and much more." * 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (194 commits) uprobes: Use percpu_rw_semaphore to fix register/unregister vs dup_mmap() race perf evsel: Introduce is_group_member method perf powerpc: Use uapi/unistd.h to fix build error tools: Pass the target in descend tools: Honour the O= flag when tool build called from a higher Makefile tools: Define a Makefile function to do subdir processing perf ui: Always compile browser setup code perf ui: Add ui_progress__finish() perf ui gtk: Implement ui_progress functions perf ui: Introduce generic ui_progress helper perf ui tui: Move progress.c under ui/tui directory perf tools: Add basic event modifier sanity check perf tools: Omit group members from perf_evlist__disable/enable perf tools: Ensure single disable call per event in record comand perf tools: Fix 'disabled' attribute config for record command perf tools: Fix attributes for '{}' defined event groups perf tools: Use sscanf for parsing /proc/pid/maps perf tools: Add gtk.<command> config option for launching GTK browser perf tools: Fix compile error on NO_NEWT=1 build perf hists: Initialize all of he->stat with zeroes ...
Diffstat (limited to 'kernel/trace/ring_buffer.c')
-rw-r--r--kernel/trace/ring_buffer.c51
1 files changed, 40 insertions, 11 deletions
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index b979426d16c6..3c7834c24e54 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -460,9 +460,10 @@ struct ring_buffer_per_cpu {
460 unsigned long lost_events; 460 unsigned long lost_events;
461 unsigned long last_overrun; 461 unsigned long last_overrun;
462 local_t entries_bytes; 462 local_t entries_bytes;
463 local_t commit_overrun;
464 local_t overrun;
465 local_t entries; 463 local_t entries;
464 local_t overrun;
465 local_t commit_overrun;
466 local_t dropped_events;
466 local_t committing; 467 local_t committing;
467 local_t commits; 468 local_t commits;
468 unsigned long read; 469 unsigned long read;
@@ -1820,7 +1821,7 @@ rb_add_time_stamp(struct ring_buffer_event *event, u64 delta)
1820} 1821}
1821 1822
1822/** 1823/**
1823 * ring_buffer_update_event - update event type and data 1824 * rb_update_event - update event type and data
1824 * @event: the even to update 1825 * @event: the even to update
1825 * @type: the type of event 1826 * @type: the type of event
1826 * @length: the size of the event field in the ring buffer 1827 * @length: the size of the event field in the ring buffer
@@ -2155,8 +2156,10 @@ rb_move_tail(struct ring_buffer_per_cpu *cpu_buffer,
2155 * If we are not in overwrite mode, 2156 * If we are not in overwrite mode,
2156 * this is easy, just stop here. 2157 * this is easy, just stop here.
2157 */ 2158 */
2158 if (!(buffer->flags & RB_FL_OVERWRITE)) 2159 if (!(buffer->flags & RB_FL_OVERWRITE)) {
2160 local_inc(&cpu_buffer->dropped_events);
2159 goto out_reset; 2161 goto out_reset;
2162 }
2160 2163
2161 ret = rb_handle_head_page(cpu_buffer, 2164 ret = rb_handle_head_page(cpu_buffer,
2162 tail_page, 2165 tail_page,
@@ -2720,8 +2723,8 @@ EXPORT_SYMBOL_GPL(ring_buffer_discard_commit);
2720 * and not the length of the event which would hold the header. 2723 * and not the length of the event which would hold the header.
2721 */ 2724 */
2722int ring_buffer_write(struct ring_buffer *buffer, 2725int ring_buffer_write(struct ring_buffer *buffer,
2723 unsigned long length, 2726 unsigned long length,
2724 void *data) 2727 void *data)
2725{ 2728{
2726 struct ring_buffer_per_cpu *cpu_buffer; 2729 struct ring_buffer_per_cpu *cpu_buffer;
2727 struct ring_buffer_event *event; 2730 struct ring_buffer_event *event;
@@ -2929,12 +2932,12 @@ rb_num_of_entries(struct ring_buffer_per_cpu *cpu_buffer)
2929 * @buffer: The ring buffer 2932 * @buffer: The ring buffer
2930 * @cpu: The per CPU buffer to read from. 2933 * @cpu: The per CPU buffer to read from.
2931 */ 2934 */
2932unsigned long ring_buffer_oldest_event_ts(struct ring_buffer *buffer, int cpu) 2935u64 ring_buffer_oldest_event_ts(struct ring_buffer *buffer, int cpu)
2933{ 2936{
2934 unsigned long flags; 2937 unsigned long flags;
2935 struct ring_buffer_per_cpu *cpu_buffer; 2938 struct ring_buffer_per_cpu *cpu_buffer;
2936 struct buffer_page *bpage; 2939 struct buffer_page *bpage;
2937 unsigned long ret; 2940 u64 ret;
2938 2941
2939 if (!cpumask_test_cpu(cpu, buffer->cpumask)) 2942 if (!cpumask_test_cpu(cpu, buffer->cpumask))
2940 return 0; 2943 return 0;
@@ -2995,7 +2998,8 @@ unsigned long ring_buffer_entries_cpu(struct ring_buffer *buffer, int cpu)
2995EXPORT_SYMBOL_GPL(ring_buffer_entries_cpu); 2998EXPORT_SYMBOL_GPL(ring_buffer_entries_cpu);
2996 2999
2997/** 3000/**
2998 * ring_buffer_overrun_cpu - get the number of overruns in a cpu_buffer 3001 * ring_buffer_overrun_cpu - get the number of overruns caused by the ring
3002 * buffer wrapping around (only if RB_FL_OVERWRITE is on).
2999 * @buffer: The ring buffer 3003 * @buffer: The ring buffer
3000 * @cpu: The per CPU buffer to get the number of overruns from 3004 * @cpu: The per CPU buffer to get the number of overruns from
3001 */ 3005 */
@@ -3015,7 +3019,9 @@ unsigned long ring_buffer_overrun_cpu(struct ring_buffer *buffer, int cpu)
3015EXPORT_SYMBOL_GPL(ring_buffer_overrun_cpu); 3019EXPORT_SYMBOL_GPL(ring_buffer_overrun_cpu);
3016 3020
3017/** 3021/**
3018 * ring_buffer_commit_overrun_cpu - get the number of overruns caused by commits 3022 * ring_buffer_commit_overrun_cpu - get the number of overruns caused by
3023 * commits failing due to the buffer wrapping around while there are uncommitted
3024 * events, such as during an interrupt storm.
3019 * @buffer: The ring buffer 3025 * @buffer: The ring buffer
3020 * @cpu: The per CPU buffer to get the number of overruns from 3026 * @cpu: The per CPU buffer to get the number of overruns from
3021 */ 3027 */
@@ -3036,6 +3042,28 @@ ring_buffer_commit_overrun_cpu(struct ring_buffer *buffer, int cpu)
3036EXPORT_SYMBOL_GPL(ring_buffer_commit_overrun_cpu); 3042EXPORT_SYMBOL_GPL(ring_buffer_commit_overrun_cpu);
3037 3043
3038/** 3044/**
3045 * ring_buffer_dropped_events_cpu - get the number of dropped events caused by
3046 * the ring buffer filling up (only if RB_FL_OVERWRITE is off).
3047 * @buffer: The ring buffer
3048 * @cpu: The per CPU buffer to get the number of overruns from
3049 */
3050unsigned long
3051ring_buffer_dropped_events_cpu(struct ring_buffer *buffer, int cpu)
3052{
3053 struct ring_buffer_per_cpu *cpu_buffer;
3054 unsigned long ret;
3055
3056 if (!cpumask_test_cpu(cpu, buffer->cpumask))
3057 return 0;
3058
3059 cpu_buffer = buffer->buffers[cpu];
3060 ret = local_read(&cpu_buffer->dropped_events);
3061
3062 return ret;
3063}
3064EXPORT_SYMBOL_GPL(ring_buffer_dropped_events_cpu);
3065
3066/**
3039 * ring_buffer_entries - get the number of entries in a buffer 3067 * ring_buffer_entries - get the number of entries in a buffer
3040 * @buffer: The ring buffer 3068 * @buffer: The ring buffer
3041 * 3069 *
@@ -3864,9 +3892,10 @@ rb_reset_cpu(struct ring_buffer_per_cpu *cpu_buffer)
3864 local_set(&cpu_buffer->reader_page->page->commit, 0); 3892 local_set(&cpu_buffer->reader_page->page->commit, 0);
3865 cpu_buffer->reader_page->read = 0; 3893 cpu_buffer->reader_page->read = 0;
3866 3894
3867 local_set(&cpu_buffer->commit_overrun, 0);
3868 local_set(&cpu_buffer->entries_bytes, 0); 3895 local_set(&cpu_buffer->entries_bytes, 0);
3869 local_set(&cpu_buffer->overrun, 0); 3896 local_set(&cpu_buffer->overrun, 0);
3897 local_set(&cpu_buffer->commit_overrun, 0);
3898 local_set(&cpu_buffer->dropped_events, 0);
3870 local_set(&cpu_buffer->entries, 0); 3899 local_set(&cpu_buffer->entries, 0);
3871 local_set(&cpu_buffer->committing, 0); 3900 local_set(&cpu_buffer->committing, 0);
3872 local_set(&cpu_buffer->commits, 0); 3901 local_set(&cpu_buffer->commits, 0);