Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 147187
b: refs/heads/master
c: 9abf8a0
h: refs/heads/master
i:
  147185: 121ce17
  147183: c1d81c3
v: v3
  • Loading branch information
Paul Mackerras committed Jan 9, 2009
1 parent a1df29a commit 6af5001
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 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: ff6f05416ece2caec1a7a1f8180d6598e0ab9272
refs/heads/master: 9abf8a08bc8f18a3b125f834f00e2e71b49c15d2
20 changes: 17 additions & 3 deletions trunk/kernel/perf_counter.c
Original file line number Diff line number Diff line change
Expand Up @@ -928,18 +928,32 @@ static const struct file_operations perf_fops = {

static int cpu_clock_perf_counter_enable(struct perf_counter *counter)
{
int cpu = raw_smp_processor_id();

atomic64_set(&counter->hw.prev_count, cpu_clock(cpu));
return 0;
}

static void cpu_clock_perf_counter_update(struct perf_counter *counter)
{
int cpu = raw_smp_processor_id();
s64 prev;
u64 now;

now = cpu_clock(cpu);
prev = atomic64_read(&counter->hw.prev_count);
atomic64_set(&counter->hw.prev_count, now);
atomic64_add(now - prev, &counter->count);
}

static void cpu_clock_perf_counter_disable(struct perf_counter *counter)
{
cpu_clock_perf_counter_update(counter);
}

static void cpu_clock_perf_counter_read(struct perf_counter *counter)
{
int cpu = raw_smp_processor_id();

atomic64_set(&counter->count, cpu_clock(cpu));
cpu_clock_perf_counter_update(counter);
}

static const struct hw_perf_counter_ops perf_ops_cpu_clock = {
Expand Down

0 comments on commit 6af5001

Please sign in to comment.