X-Git-Url: http://www.pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=drivers%2Foprofile%2Fbuffer_sync.c;h=b55cd23ffdefc81dfb80409a98c5697c21822b50;hb=92fb83afd6664a6f8a05f990d264c998f9b99f69;hp=6c0c92a745dd7b7ba27294691a8cec5a828ea0ee;hpb=df13b31c286b3e91c556167954eda088d90a4295;p=linux-2.6-omap-h63xx.git diff --git a/drivers/oprofile/buffer_sync.c b/drivers/oprofile/buffer_sync.c index 6c0c92a745d..b55cd23ffde 100644 --- a/drivers/oprofile/buffer_sync.c +++ b/drivers/oprofile/buffer_sync.c @@ -631,3 +631,27 @@ void sync_buffer(int cpu) mutex_unlock(&buffer_mutex); } + +/* The function can be used to add a buffer worth of data directly to + * the kernel buffer. The buffer is assumed to be a circular buffer. + * Take the entries from index start and end at index end, wrapping + * at max_entries. + */ +void oprofile_put_buff(unsigned long *buf, unsigned int start, + unsigned int stop, unsigned int max) +{ + int i; + + i = start; + + mutex_lock(&buffer_mutex); + while (i != stop) { + add_event_entry(buf[i++]); + + if (i >= max) + i = 0; + } + + mutex_unlock(&buffer_mutex); +} +