aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/perf_counter.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/perf_counter.c')
-rw-r--r--kernel/perf_counter.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index d93e9ddf7848..860cdc26bd7a 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -1654,6 +1654,17 @@ void perf_counter_do_pending(void)
1654} 1654}
1655 1655
1656/* 1656/*
1657 * Callchain support -- arch specific
1658 */
1659
1660struct perf_callchain_entry *
1661__attribute__((weak))
1662perf_callchain(struct pt_regs *regs)
1663{
1664 return NULL;
1665}
1666
1667/*
1657 * Output 1668 * Output
1658 */ 1669 */
1659 1670
@@ -1764,6 +1775,8 @@ static void perf_output_simple(struct perf_counter *counter,
1764 struct { 1775 struct {
1765 u32 pid, tid; 1776 u32 pid, tid;
1766 } tid_entry; 1777 } tid_entry;
1778 struct perf_callchain_entry *callchain = NULL;
1779 int callchain_size = 0;
1767 1780
1768 header.type = PERF_EVENT_OVERFLOW; 1781 header.type = PERF_EVENT_OVERFLOW;
1769 header.size = sizeof(header); 1782 header.size = sizeof(header);
@@ -1781,6 +1794,17 @@ static void perf_output_simple(struct perf_counter *counter,
1781 header.size += sizeof(tid_entry); 1794 header.size += sizeof(tid_entry);
1782 } 1795 }
1783 1796
1797 if (counter->hw_event.callchain) {
1798 callchain = perf_callchain(regs);
1799
1800 if (callchain) {
1801 callchain_size = (1 + callchain->nr) * sizeof(u64);
1802
1803 header.type |= __PERF_EVENT_CALLCHAIN;
1804 header.size += callchain_size;
1805 }
1806 }
1807
1784 ret = perf_output_begin(&handle, counter, header.size, nmi); 1808 ret = perf_output_begin(&handle, counter, header.size, nmi);
1785 if (ret) 1809 if (ret)
1786 return; 1810 return;
@@ -1791,6 +1815,9 @@ static void perf_output_simple(struct perf_counter *counter,
1791 if (counter->hw_event.include_tid) 1815 if (counter->hw_event.include_tid)
1792 perf_output_put(&handle, tid_entry); 1816 perf_output_put(&handle, tid_entry);
1793 1817
1818 if (callchain)
1819 perf_output_copy(&handle, callchain, callchain_size);
1820
1794 perf_output_end(&handle); 1821 perf_output_end(&handle);
1795} 1822}
1796 1823