Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 147153
b: refs/heads/master
c: 8cb391e
h: refs/heads/master
i:
  147151: 29c9da5
v: v3
  • Loading branch information
Ingo Molnar committed Dec 14, 2008
1 parent 80bd1c5 commit 9e1accb
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 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: 9b51f66dcb09ac5eb6bc68fc111d5c7a1e0131d6
refs/heads/master: 8cb391e8786c8072367f0aeb90551903fef074ba
27 changes: 23 additions & 4 deletions trunk/kernel/perf_counter.c
Original file line number Diff line number Diff line change
Expand Up @@ -850,17 +850,36 @@ static const struct hw_perf_counter_ops perf_ops_cpu_clock = {
.hw_perf_counter_read = cpu_clock_perf_counter_read,
};

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

prev = atomic64_read(&counter->hw.prev_count);
now = current->se.sum_exec_runtime;

atomic64_set(&counter->hw.prev_count, now);

delta = now - prev;
if (WARN_ON_ONCE(delta < 0))
delta = 0;

atomic64_add(delta, &counter->count);
}

static void task_clock_perf_counter_disable(struct perf_counter *counter)
static void task_clock_perf_counter_read(struct perf_counter *counter)
{
task_clock_perf_counter_update(counter);
}

static void task_clock_perf_counter_read(struct perf_counter *counter)
static void task_clock_perf_counter_enable(struct perf_counter *counter)
{
atomic64_set(&counter->hw.prev_count, current->se.sum_exec_runtime);
}

static void task_clock_perf_counter_disable(struct perf_counter *counter)
{
atomic64_set(&counter->count, current->se.sum_exec_runtime);
task_clock_perf_counter_update(counter);
}

static const struct hw_perf_counter_ops perf_ops_task_clock = {
Expand Down

0 comments on commit 9e1accb

Please sign in to comment.