Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 147145
b: refs/heads/master
c: bae43c9
h: refs/heads/master
i:
  147143: dd92ed7
v: v3
  • Loading branch information
Ingo Molnar committed Dec 11, 2008
1 parent a887164 commit 91064fc
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 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: 01b2838c4298c5e0d30b4993c195ac34dd9df61e
refs/heads/master: bae43c9945ebeef15e7952e317efb02393d3bfc7
7 changes: 5 additions & 2 deletions trunk/include/linux/perf_counter.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,11 @@ enum hw_event_types {
*/
PERF_COUNT_CPU_CLOCK = -1,
PERF_COUNT_TASK_CLOCK = -2,
PERF_COUNT_PAGE_FAULTS = -3,
PERF_COUNT_CONTEXT_SWITCHES = -4,
/*
* Future software events:
*/
/* PERF_COUNT_PAGE_FAULTS = -3,
PERF_COUNT_CONTEXT_SWITCHES = -4, */
};

/*
Expand Down
22 changes: 22 additions & 0 deletions trunk/kernel/perf_counter.c
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,25 @@ 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_disable(struct perf_counter *counter)
{
}

static void task_clock_perf_counter_read(struct perf_counter *counter)
{
atomic64_counter_set(counter, current->se.sum_exec_runtime);
}

static const struct hw_perf_counter_ops perf_ops_task_clock = {
.hw_perf_counter_enable = task_clock_perf_counter_enable,
.hw_perf_counter_disable = task_clock_perf_counter_disable,
.hw_perf_counter_read = task_clock_perf_counter_read,
};

static const struct hw_perf_counter_ops *
sw_perf_counter_init(struct perf_counter *counter)
{
Expand All @@ -864,6 +883,9 @@ sw_perf_counter_init(struct perf_counter *counter)
case PERF_COUNT_CPU_CLOCK:
hw_ops = &perf_ops_cpu_clock;
break;
case PERF_COUNT_TASK_CLOCK:
hw_ops = &perf_ops_task_clock;
break;
default:
break;
}
Expand Down

0 comments on commit 91064fc

Please sign in to comment.