aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/perf_counter.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 950931041954..48471d75ae01 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -1688,6 +1688,18 @@ static int perf_release(struct inode *inode, struct file *file)
1688 return 0; 1688 return 0;
1689} 1689}
1690 1690
1691static u64 perf_counter_read_tree(struct perf_counter *counter)
1692{
1693 struct perf_counter *child;
1694 u64 total = 0;
1695
1696 total += perf_counter_read(counter);
1697 list_for_each_entry(child, &counter->child_list, child_list)
1698 total += perf_counter_read(child);
1699
1700 return total;
1701}
1702
1691/* 1703/*
1692 * Read the performance counter - simple non blocking version for now 1704 * Read the performance counter - simple non blocking version for now
1693 */ 1705 */
@@ -1707,7 +1719,7 @@ perf_read_hw(struct perf_counter *counter, char __user *buf, size_t count)
1707 1719
1708 WARN_ON_ONCE(counter->ctx->parent_ctx); 1720 WARN_ON_ONCE(counter->ctx->parent_ctx);
1709 mutex_lock(&counter->child_mutex); 1721 mutex_lock(&counter->child_mutex);
1710 values[0] = perf_counter_read(counter); 1722 values[0] = perf_counter_read_tree(counter);
1711 n = 1; 1723 n = 1;
1712 if (counter->attr.read_format & PERF_FORMAT_TOTAL_TIME_ENABLED) 1724 if (counter->attr.read_format & PERF_FORMAT_TOTAL_TIME_ENABLED)
1713 values[n++] = counter->total_time_enabled + 1725 values[n++] = counter->total_time_enabled +