aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/oprofile/cpu_buffer.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/oprofile/cpu_buffer.h')
-rw-r--r--drivers/oprofile/cpu_buffer.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/oprofile/cpu_buffer.h b/drivers/oprofile/cpu_buffer.h
index e178dd2799c4..f34376046573 100644
--- a/drivers/oprofile/cpu_buffer.h
+++ b/drivers/oprofile/cpu_buffer.h
@@ -90,6 +90,26 @@ int op_cpu_buffer_add_data(struct op_entry *entry, unsigned long val)
90 return entry->size; 90 return entry->size;
91} 91}
92 92
93/* returns the size of data in the entry */
94static inline
95int op_cpu_buffer_get_size(struct op_entry *entry)
96{
97 return entry->size;
98}
99
100/* returns 0 if empty or the size of data including the current value */
101static inline
102int op_cpu_buffer_get_data(struct op_entry *entry, unsigned long *val)
103{
104 int size = entry->size;
105 if (!size)
106 return 0;
107 *val = *entry->data;
108 entry->size--;
109 entry->data++;
110 return size;
111}
112
93/* extra data flags */ 113/* extra data flags */
94#define KERNEL_CTX_SWITCH (1UL << 0) 114#define KERNEL_CTX_SWITCH (1UL << 0)
95#define IS_KERNEL (1UL << 1) 115#define IS_KERNEL (1UL << 1)