aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/oprofile
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/oprofile')
-rw-r--r--drivers/oprofile/buffer_sync.c24
-rw-r--r--drivers/oprofile/cpu_buffer.c13
-rw-r--r--drivers/oprofile/event_buffer.h7
3 files changed, 44 insertions, 0 deletions
diff --git a/drivers/oprofile/buffer_sync.c b/drivers/oprofile/buffer_sync.c
index 6c0c92a745dd..b55cd23ffdef 100644
--- a/drivers/oprofile/buffer_sync.c
+++ b/drivers/oprofile/buffer_sync.c
@@ -631,3 +631,27 @@ void sync_buffer(int cpu)
631 631
632 mutex_unlock(&buffer_mutex); 632 mutex_unlock(&buffer_mutex);
633} 633}
634
635/* The function can be used to add a buffer worth of data directly to
636 * the kernel buffer. The buffer is assumed to be a circular buffer.
637 * Take the entries from index start and end at index end, wrapping
638 * at max_entries.
639 */
640void oprofile_put_buff(unsigned long *buf, unsigned int start,
641 unsigned int stop, unsigned int max)
642{
643 int i;
644
645 i = start;
646
647 mutex_lock(&buffer_mutex);
648 while (i != stop) {
649 add_event_entry(buf[i++]);
650
651 if (i >= max)
652 i = 0;
653 }
654
655 mutex_unlock(&buffer_mutex);
656}
657
diff --git a/drivers/oprofile/cpu_buffer.c b/drivers/oprofile/cpu_buffer.c
index 67bcc1c95e60..01d38e78cde1 100644
--- a/drivers/oprofile/cpu_buffer.c
+++ b/drivers/oprofile/cpu_buffer.c
@@ -45,6 +45,19 @@ void free_cpu_buffers(void)
45 } 45 }
46} 46}
47 47
48unsigned long oprofile_get_cpu_buffer_size(void)
49{
50 return fs_cpu_buffer_size;
51}
52
53void oprofile_cpu_buffer_inc_smpl_lost(void)
54{
55 struct oprofile_cpu_buffer *cpu_buf
56 = &__get_cpu_var(cpu_buffer);
57
58 cpu_buf->sample_lost_overflow++;
59}
60
48int alloc_cpu_buffers(void) 61int alloc_cpu_buffers(void)
49{ 62{
50 int i; 63 int i;
diff --git a/drivers/oprofile/event_buffer.h b/drivers/oprofile/event_buffer.h
index 00db2e665708..4e70749f8d16 100644
--- a/drivers/oprofile/event_buffer.h
+++ b/drivers/oprofile/event_buffer.h
@@ -17,6 +17,13 @@ int alloc_event_buffer(void);
17 17
18void free_event_buffer(void); 18void free_event_buffer(void);
19 19
20/**
21 * Add data to the event buffer.
22 * The data passed is free-form, but typically consists of
23 * file offsets, dcookies, context information, and ESCAPE codes.
24 */
25void add_event_entry(unsigned long data);
26
20/* wake up the process sleeping on the event file */ 27/* wake up the process sleeping on the event file */
21void wake_up_buffer_waiter(void); 28void wake_up_buffer_waiter(void);
22 29