History

mmiotrace: count events lost due to not recording

Impact: enhances lost events counting in mmiotrace The tracing framework, or the ring buffer facility it uses, has a switch to stop recording data. When recording is off, the trace events will be lost. The framework does not count these, so mmiotrace has to count them itself.

Pekka Paalanen committed 17 years ago

Commit 173ed241 parent fe6f90e1 file · +10 −4Browse files

Unified · Split

kernel/trace/trace_mmiotrace.c+10−4
@@ -9,6 +9,7 @@ · 8 unmodified lines
9#include <linux/kernel.h>9#include <linux/kernel.h>
10#include <linux/mmiotrace.h>10#include <linux/mmiotrace.h>
11#include <linux/pci.h>11#include <linux/pci.h>
12#include <asm/atomic.h>
12 13
13#include "trace.h"14#include "trace.h"
14#include "trace_output.h"15#include "trace_output.h"
@@ -20,6 +21,7 @@ struct header_iter { · 5 unmodified lines
20static struct trace_array *mmio_trace_array;21static struct trace_array *mmio_trace_array;
21static bool overrun_detected;22static bool overrun_detected;
22static unsigned long prev_overruns;23static unsigned long prev_overruns;
24static atomic_t dropped_count;
23 25
24static void mmio_reset_data(struct trace_array *tr)26static void mmio_reset_data(struct trace_array *tr)
25{27{
@@ -122,11 +124,11 @@ static void mmio_close(struct trace_iterator *iter) · 96 unmodified lines
122 124
123static unsigned long count_overruns(struct trace_iterator *iter)125static unsigned long count_overruns(struct trace_iterator *iter)
124{126{
125 unsigned long cnt = 0;127 unsigned long cnt = atomic_xchg(&dropped_count, 0);
126 unsigned long over = ring_buffer_overruns(iter->tr->buffer);128 unsigned long over = ring_buffer_overruns(iter->tr->buffer);
127 129
128 if (over > prev_overruns)130 if (over > prev_overruns)
129 cnt = over - prev_overruns;131 cnt += over - prev_overruns;
130 prev_overruns = over;132 prev_overruns = over;
131 return cnt;133 return cnt;
132}134}
@@ -308,8 +310,10 @@ static void __trace_mmiotrace_rw(struct trace_array *tr, · 175 unmodified lines
308 310
309 event = ring_buffer_lock_reserve(tr->buffer, sizeof(*entry),311 event = ring_buffer_lock_reserve(tr->buffer, sizeof(*entry),
310 &irq_flags);312 &irq_flags);
311 if (!event)313 if (!event) {
314 atomic_inc(&dropped_count);
312 return;315 return;
316 }
313 entry = ring_buffer_event_data(event);317 entry = ring_buffer_event_data(event);
314 tracing_generic_entry_update(&entry->ent, 0, preempt_count());318 tracing_generic_entry_update(&entry->ent, 0, preempt_count());
315 entry->ent.type = TRACE_MMIO_RW;319 entry->ent.type = TRACE_MMIO_RW;
@@ -336,8 +340,10 @@ static void __trace_mmiotrace_map(struct trace_array *tr, · 20 unmodified lines
336 340
337 event = ring_buffer_lock_reserve(tr->buffer, sizeof(*entry),341 event = ring_buffer_lock_reserve(tr->buffer, sizeof(*entry),
338 &irq_flags);342 &irq_flags);
339 if (!event)343 if (!event) {
344 atomic_inc(&dropped_count);
340 return;345 return;
346 }
341 entry = ring_buffer_event_data(event);347 entry = ring_buffer_event_data(event);
342 tracing_generic_entry_update(&entry->ent, 0, preempt_count());348 tracing_generic_entry_update(&entry->ent, 0, preempt_count());
343 entry->ent.type = TRACE_MMIO_MAP;349 entry->ent.type = TRACE_MMIO_MAP;