diff options
author | Franck Bui-Huu <fbuihuu@gmail.com> | 2010-11-23 10:21:43 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-11-26 09:14:54 -0500 |
commit | 6c7e550f13f8ad82efb6a5653ae628c2543c1768 (patch) | |
tree | 1c994b999648fbe51ffe4312e2d6827aedd5f012 /kernel | |
parent | 35d3778a8fe3c8b4a7513565e34d3bde00ce43ec (diff) |
perf: Introduce is_sampling_event()
and use it when appropriate.
Signed-off-by: Franck Bui-Huu <fbuihuu@gmail.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <1290525705-6265-1-git-send-email-fbuihuu@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/perf_event.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/kernel/perf_event.c b/kernel/perf_event.c index 43f757ccf831..880698488c91 100644 --- a/kernel/perf_event.c +++ b/kernel/perf_event.c | |||
@@ -2514,7 +2514,7 @@ static int perf_event_period(struct perf_event *event, u64 __user *arg) | |||
2514 | int ret = 0; | 2514 | int ret = 0; |
2515 | u64 value; | 2515 | u64 value; |
2516 | 2516 | ||
2517 | if (!event->attr.sample_period) | 2517 | if (!is_sampling_event(event)) |
2518 | return -EINVAL; | 2518 | return -EINVAL; |
2519 | 2519 | ||
2520 | if (copy_from_user(&value, arg, sizeof(value))) | 2520 | if (copy_from_user(&value, arg, sizeof(value))) |
@@ -4385,7 +4385,7 @@ static void perf_swevent_event(struct perf_event *event, u64 nr, | |||
4385 | if (!regs) | 4385 | if (!regs) |
4386 | return; | 4386 | return; |
4387 | 4387 | ||
4388 | if (!hwc->sample_period) | 4388 | if (!is_sampling_event(event)) |
4389 | return; | 4389 | return; |
4390 | 4390 | ||
4391 | if (nr == 1 && hwc->sample_period == 1 && !event->attr.freq) | 4391 | if (nr == 1 && hwc->sample_period == 1 && !event->attr.freq) |
@@ -4548,7 +4548,7 @@ static int perf_swevent_add(struct perf_event *event, int flags) | |||
4548 | struct hw_perf_event *hwc = &event->hw; | 4548 | struct hw_perf_event *hwc = &event->hw; |
4549 | struct hlist_head *head; | 4549 | struct hlist_head *head; |
4550 | 4550 | ||
4551 | if (hwc->sample_period) { | 4551 | if (is_sampling_event(event)) { |
4552 | hwc->last_period = hwc->sample_period; | 4552 | hwc->last_period = hwc->sample_period; |
4553 | perf_swevent_set_period(event); | 4553 | perf_swevent_set_period(event); |
4554 | } | 4554 | } |
@@ -4920,7 +4920,7 @@ static void perf_swevent_start_hrtimer(struct perf_event *event) | |||
4920 | 4920 | ||
4921 | hrtimer_init(&hwc->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); | 4921 | hrtimer_init(&hwc->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); |
4922 | hwc->hrtimer.function = perf_swevent_hrtimer; | 4922 | hwc->hrtimer.function = perf_swevent_hrtimer; |
4923 | if (hwc->sample_period) { | 4923 | if (is_sampling_event(event)) { |
4924 | s64 period = local64_read(&hwc->period_left); | 4924 | s64 period = local64_read(&hwc->period_left); |
4925 | 4925 | ||
4926 | if (period) { | 4926 | if (period) { |
@@ -4941,7 +4941,7 @@ static void perf_swevent_cancel_hrtimer(struct perf_event *event) | |||
4941 | { | 4941 | { |
4942 | struct hw_perf_event *hwc = &event->hw; | 4942 | struct hw_perf_event *hwc = &event->hw; |
4943 | 4943 | ||
4944 | if (hwc->sample_period) { | 4944 | if (is_sampling_event(event)) { |
4945 | ktime_t remaining = hrtimer_get_remaining(&hwc->hrtimer); | 4945 | ktime_t remaining = hrtimer_get_remaining(&hwc->hrtimer); |
4946 | local64_set(&hwc->period_left, ktime_to_ns(remaining)); | 4946 | local64_set(&hwc->period_left, ktime_to_ns(remaining)); |
4947 | 4947 | ||