Commit 5ed00415 authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Ingo Molnar

perf_counter: re-arrange the perf_event_type

Breaks ABI yet again :-)

Change the event type so that [0, 2^31-1] are regular event types, but
[2^31, 2^32-1] forms a bitmask for overflow events.
Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: default avatarPaul Mackerras <paulus@samba.org>
Orig-LKML-Reference: <20090330171024.047961770@chello.nl>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 78d613eb
...@@ -210,13 +210,15 @@ struct perf_event_header { ...@@ -210,13 +210,15 @@ struct perf_event_header {
}; };
enum perf_event_type { enum perf_event_type {
PERF_EVENT_IP = 0,
PERF_EVENT_GROUP = 1, PERF_EVENT_GROUP = 1,
PERF_EVENT_MMAP = 2, PERF_EVENT_MMAP = 2,
PERF_EVENT_MUNMAP = 3, PERF_EVENT_MUNMAP = 3,
__PERF_EVENT_TID = 0x100, PERF_EVENT_OVERFLOW = 1UL << 31,
__PERF_EVENT_IP = 1UL << 30,
__PERF_EVENT_TID = 1UL << 29,
}; };
#ifdef __KERNEL__ #ifdef __KERNEL__
......
...@@ -1754,50 +1754,44 @@ static void perf_output_end(struct perf_output_handle *handle) ...@@ -1754,50 +1754,44 @@ static void perf_output_end(struct perf_output_handle *handle)
rcu_read_unlock(); rcu_read_unlock();
} }
static int perf_output_write(struct perf_counter *counter, int nmi,
void *buf, ssize_t size)
{
struct perf_output_handle handle;
int ret;
ret = perf_output_begin(&handle, counter, size, nmi);
if (ret)
goto out;
perf_output_copy(&handle, buf, size);
perf_output_end(&handle);
out:
return ret;
}
static void perf_output_simple(struct perf_counter *counter, static void perf_output_simple(struct perf_counter *counter,
int nmi, struct pt_regs *regs) int nmi, struct pt_regs *regs)
{ {
unsigned int size; int ret;
struct { struct perf_output_handle handle;
struct perf_event_header header; struct perf_event_header header;
u64 ip; u64 ip;
struct {
u32 pid, tid; u32 pid, tid;
} event; } tid_entry;
event.header.type = PERF_EVENT_IP; header.type = PERF_EVENT_OVERFLOW;
event.ip = instruction_pointer(regs); header.size = sizeof(header);
size = sizeof(event); ip = instruction_pointer(regs);
header.type |= __PERF_EVENT_IP;
header.size += sizeof(ip);
if (counter->hw_event.include_tid) { if (counter->hw_event.include_tid) {
/* namespace issues */ /* namespace issues */
event.pid = current->group_leader->pid; tid_entry.pid = current->group_leader->pid;
event.tid = current->pid; tid_entry.tid = current->pid;
event.header.type |= __PERF_EVENT_TID; header.type |= __PERF_EVENT_TID;
} else header.size += sizeof(tid_entry);
size -= sizeof(u64); }
event.header.size = size; ret = perf_output_begin(&handle, counter, header.size, nmi);
if (ret)
return;
perf_output_put(&handle, header);
perf_output_put(&handle, ip);
if (counter->hw_event.include_tid)
perf_output_put(&handle, tid_entry);
perf_output_write(counter, nmi, &event, size); perf_output_end(&handle);
} }
static void perf_output_group(struct perf_counter *counter, int nmi) static void perf_output_group(struct perf_counter *counter, int nmi)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment