diff options
Diffstat (limited to 'kernel/perf_counter.c')
-rw-r--r-- | kernel/perf_counter.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c index 0e93fea17120..a0fe8474ee29 100644 --- a/kernel/perf_counter.c +++ b/kernel/perf_counter.c | |||
@@ -855,6 +855,25 @@ static const struct hw_perf_counter_ops perf_ops_cpu_clock = { | |||
855 | .hw_perf_counter_read = cpu_clock_perf_counter_read, | 855 | .hw_perf_counter_read = cpu_clock_perf_counter_read, |
856 | }; | 856 | }; |
857 | 857 | ||
858 | static void task_clock_perf_counter_enable(struct perf_counter *counter) | ||
859 | { | ||
860 | } | ||
861 | |||
862 | static void task_clock_perf_counter_disable(struct perf_counter *counter) | ||
863 | { | ||
864 | } | ||
865 | |||
866 | static void task_clock_perf_counter_read(struct perf_counter *counter) | ||
867 | { | ||
868 | atomic64_counter_set(counter, current->se.sum_exec_runtime); | ||
869 | } | ||
870 | |||
871 | static const struct hw_perf_counter_ops perf_ops_task_clock = { | ||
872 | .hw_perf_counter_enable = task_clock_perf_counter_enable, | ||
873 | .hw_perf_counter_disable = task_clock_perf_counter_disable, | ||
874 | .hw_perf_counter_read = task_clock_perf_counter_read, | ||
875 | }; | ||
876 | |||
858 | static const struct hw_perf_counter_ops * | 877 | static const struct hw_perf_counter_ops * |
859 | sw_perf_counter_init(struct perf_counter *counter) | 878 | sw_perf_counter_init(struct perf_counter *counter) |
860 | { | 879 | { |
@@ -864,6 +883,9 @@ sw_perf_counter_init(struct perf_counter *counter) | |||
864 | case PERF_COUNT_CPU_CLOCK: | 883 | case PERF_COUNT_CPU_CLOCK: |
865 | hw_ops = &perf_ops_cpu_clock; | 884 | hw_ops = &perf_ops_cpu_clock; |
866 | break; | 885 | break; |
886 | case PERF_COUNT_TASK_CLOCK: | ||
887 | hw_ops = &perf_ops_task_clock; | ||
888 | break; | ||
867 | default: | 889 | default: |
868 | break; | 890 | break; |
869 | } | 891 | } |