[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-b202978dae5fce00d19480360f165a181be19704@git.kernel.org>
Date: Thu, 2 Apr 2009 12:03:47 GMT
From: Peter Zijlstra <a.p.zijlstra@...llo.nl>
To: linux-tip-commits@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, paulus@...ba.org, hpa@...or.com,
mingo@...hat.com, a.p.zijlstra@...llo.nl, tglx@...utronix.de,
cjashfor@...ux.vnet.ibm.com, mingo@...e.hu
Subject: [tip:perfcounters/core] perf_counter: per event wakeups
Commit-ID: b202978dae5fce00d19480360f165a181be19704
Gitweb: http://git.kernel.org/tip/b202978dae5fce00d19480360f165a181be19704
Author: Peter Zijlstra <a.p.zijlstra@...llo.nl>
AuthorDate: Thu, 2 Apr 2009 11:12:01 +0200
Committer: Ingo Molnar <mingo@...e.hu>
CommitDate: Thu, 2 Apr 2009 13:52:59 +0200
perf_counter: per event wakeups
By request, provide a way to request a wakeup every 'n' events instead
of every page of output.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: Paul Mackerras <paulus@...ba.org>
Cc: Corey Ashford <cjashfor@...ux.vnet.ibm.com>
LKML-Reference: <20090402091319.323309784@...llo.nl>
Signed-off-by: Ingo Molnar <mingo@...e.hu>
---
include/linux/perf_counter.h | 3 ++-
kernel/perf_counter.c | 10 +++++++++-
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index 06a6fba..5428ba1 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -145,7 +145,7 @@ struct perf_counter_hw_event {
__reserved_1 : 53;
__u32 extra_config_len;
- __u32 __reserved_4;
+ __u32 wakeup_events; /* wakeup every n events */
__u64 __reserved_2;
__u64 __reserved_3;
@@ -321,6 +321,7 @@ struct perf_mmap_data {
int nr_pages;
atomic_t wakeup;
atomic_t head;
+ atomic_t events;
struct perf_counter_mmap_page *user_page;
void *data_pages[0];
};
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 995063d..9bcab10 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -1760,7 +1760,15 @@ static void perf_output_copy(struct perf_output_handle *handle,
static void perf_output_end(struct perf_output_handle *handle)
{
- if (handle->wakeup)
+ int wakeup_events = handle->counter->hw_event.wakeup_events;
+
+ if (wakeup_events) {
+ int events = atomic_inc_return(&handle->data->events);
+ if (events >= wakeup_events) {
+ atomic_sub(wakeup_events, &handle->data->events);
+ __perf_output_wakeup(handle);
+ }
+ } else if (handle->wakeup)
__perf_output_wakeup(handle);
rcu_read_unlock();
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists