diff options
Diffstat (limited to 'drivers/oprofile/buffer_sync.c')
-rw-r--r-- | drivers/oprofile/buffer_sync.c | 24 |
1 files changed, 24 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 | */ | ||
640 | void 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 | |||