]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/oprofile/buffer_sync.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rric/oprofile
[linux-2.6-omap-h63xx.git] / drivers / oprofile / buffer_sync.c
index 6c0c92a745dd7b7ba27294691a8cec5a828ea0ee..b55cd23ffdefc81dfb80409a98c5697c21822b50 100644 (file)
@@ -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);
+}
+