aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/perf_counter.c
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2009-03-30 13:07:12 -0400
committerIngo Molnar <mingo@elte.hu>2009-04-06 03:30:42 -0400
commit5ed00415e304203a0a9dcaef226d6d3f1106070e (patch)
tree5e1d53fcae6ea973dfb61972f38c269a8fe095bc /kernel/perf_counter.c
parent78d613eb129fc4edf0e2cabfcc6a4c5285482d21 (diff)
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: Peter Zijlstra <a.p.zijlstra@chello.nl> Acked-by: Paul Mackerras <paulus@samba.org> Orig-LKML-Reference: <20090330171024.047961770@chello.nl> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/perf_counter.c')
-rw-r--r--kernel/perf_counter.c56
1 files changed, 25 insertions, 31 deletions
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 4471e7e2c109..d93e9ddf7848 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -1754,50 +1754,44 @@ static void perf_output_end(struct perf_output_handle *handle)
1754 rcu_read_unlock(); 1754 rcu_read_unlock();
1755} 1755}
1756 1756
1757static int perf_output_write(struct perf_counter *counter, int nmi,
1758 void *buf, ssize_t size)
1759{
1760 struct perf_output_handle handle;
1761 int ret;
1762
1763 ret = perf_output_begin(&handle, counter, size, nmi);
1764 if (ret)
1765 goto out;
1766
1767 perf_output_copy(&handle, buf, size);
1768 perf_output_end(&handle);
1769
1770out:
1771 return ret;
1772}
1773
1774static void perf_output_simple(struct perf_counter *counter, 1757static void perf_output_simple(struct perf_counter *counter,
1775 int nmi, struct pt_regs *regs) 1758 int nmi, struct pt_regs *regs)
1776{ 1759{
1777 unsigned int size; 1760 int ret;
1761 struct perf_output_handle handle;
1762 struct perf_event_header header;
1763 u64 ip;
1778 struct { 1764 struct {
1779 struct perf_event_header header;
1780 u64 ip;
1781 u32 pid, tid; 1765 u32 pid, tid;
1782 } event; 1766 } tid_entry;
1783 1767
1784 event.header.type = PERF_EVENT_IP; 1768 header.type = PERF_EVENT_OVERFLOW;
1785 event.ip = instruction_pointer(regs); 1769 header.size = sizeof(header);
1786 1770
1787 size = sizeof(event); 1771 ip = instruction_pointer(regs);
1772 header.type |= __PERF_EVENT_IP;
1773 header.size += sizeof(ip);
1788 1774
1789 if (counter->hw_event.include_tid) { 1775 if (counter->hw_event.include_tid) {
1790 /* namespace issues */ 1776 /* namespace issues */
1791 event.pid = current->group_leader->pid; 1777 tid_entry.pid = current->group_leader->pid;
1792 event.tid = current->pid; 1778 tid_entry.tid = current->pid;
1793 1779
1794 event.header.type |= __PERF_EVENT_TID; 1780 header.type |= __PERF_EVENT_TID;
1795 } else 1781 header.size += sizeof(tid_entry);
1796 size -= sizeof(u64); 1782 }
1797 1783
1798 event.header.size = size; 1784 ret = perf_output_begin(&handle, counter, header.size, nmi);
1785 if (ret)
1786 return;
1787
1788 perf_output_put(&handle, header);
1789 perf_output_put(&handle, ip);
1790
1791 if (counter->hw_event.include_tid)
1792 perf_output_put(&handle, tid_entry);
1799 1793
1800 perf_output_write(counter, nmi, &event, size); 1794 perf_output_end(&handle);
1801} 1795}
1802 1796
1803static void perf_output_group(struct perf_counter *counter, int nmi) 1797static void perf_output_group(struct perf_counter *counter, int nmi)