提交 5d508e82 编写于 作者: F Franck Bui-Huu 提交者: Ingo Molnar

perf: Don't bother to init the hrtimer for no SW sampling counters

Signed-off-by: NFranck Bui-Huu <fbuihuu@gmail.com>
Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <1290525705-6265-3-git-send-email-fbuihuu@gmail.com>
Signed-off-by: NIngo Molnar <mingo@elte.hu>
上级 2e939d1d
...@@ -4917,12 +4917,15 @@ static enum hrtimer_restart perf_swevent_hrtimer(struct hrtimer *hrtimer) ...@@ -4917,12 +4917,15 @@ static enum hrtimer_restart perf_swevent_hrtimer(struct hrtimer *hrtimer)
static void perf_swevent_start_hrtimer(struct perf_event *event) static void perf_swevent_start_hrtimer(struct perf_event *event)
{ {
struct hw_perf_event *hwc = &event->hw; struct hw_perf_event *hwc = &event->hw;
s64 period;
if (!is_sampling_event(event))
return;
hrtimer_init(&hwc->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); hrtimer_init(&hwc->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
hwc->hrtimer.function = perf_swevent_hrtimer; hwc->hrtimer.function = perf_swevent_hrtimer;
if (is_sampling_event(event)) {
s64 period = local64_read(&hwc->period_left);
period = local64_read(&hwc->period_left);
if (period) { if (period) {
if (period < 0) if (period < 0)
period = 10000; period = 10000;
...@@ -4934,7 +4937,6 @@ static void perf_swevent_start_hrtimer(struct perf_event *event) ...@@ -4934,7 +4937,6 @@ static void perf_swevent_start_hrtimer(struct perf_event *event)
__hrtimer_start_range_ns(&hwc->hrtimer, __hrtimer_start_range_ns(&hwc->hrtimer,
ns_to_ktime(period), 0, ns_to_ktime(period), 0,
HRTIMER_MODE_REL_PINNED, 0); HRTIMER_MODE_REL_PINNED, 0);
}
} }
static void perf_swevent_cancel_hrtimer(struct perf_event *event) static void perf_swevent_cancel_hrtimer(struct perf_event *event)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册