Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 147345
b: refs/heads/master
c: e30e08f
h: refs/heads/master
i:
  147343: 0632c23
v: v3
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Apr 8, 2009
1 parent 8bd271c commit 280538a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7333a8003cdc0470e8c0ae8b949cbc44f3165ff3
refs/heads/master: e30e08f65c7ef6c230424264f09c3d53f117f58b
25 changes: 16 additions & 9 deletions trunk/kernel/perf_counter.c
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,6 @@ static void __perf_counter_disable(void *info)

spin_lock_irqsave(&ctx->lock, flags);

update_context_time(ctx);

/*
* If the counter is on, turn it off.
* If it is in error state, leave it in error state.
Expand Down Expand Up @@ -2335,13 +2333,11 @@ static const struct hw_perf_counter_ops perf_ops_cpu_clock = {
* Software counter: task time clock
*/

static void task_clock_perf_counter_update(struct perf_counter *counter)
static void task_clock_perf_counter_update(struct perf_counter *counter, u64 now)
{
u64 prev, now;
u64 prev;
s64 delta;

now = counter->ctx->time;

prev = atomic64_xchg(&counter->hw.prev_count, now);
delta = now - prev;
atomic64_add(delta, &counter->count);
Expand Down Expand Up @@ -2369,13 +2365,24 @@ static int task_clock_perf_counter_enable(struct perf_counter *counter)
static void task_clock_perf_counter_disable(struct perf_counter *counter)
{
hrtimer_cancel(&counter->hw.hrtimer);
task_clock_perf_counter_update(counter);
task_clock_perf_counter_update(counter, counter->ctx->time);

}

static void task_clock_perf_counter_read(struct perf_counter *counter)
{
update_context_time(counter->ctx);
task_clock_perf_counter_update(counter);
u64 time;

if (!in_nmi()) {
update_context_time(counter->ctx);
time = counter->ctx->time;
} else {
u64 now = perf_clock();
u64 delta = now - counter->ctx->timestamp;
time = counter->ctx->time + delta;
}

task_clock_perf_counter_update(counter, time);
}

static const struct hw_perf_counter_ops perf_ops_task_clock = {
Expand Down

0 comments on commit 280538a

Please sign in to comment.