Mike Chan | c69233f | 2010-05-10 17:54:48 -0700 | [diff] [blame] | 1 | /* include/linux/cpuacct.h |
| 2 | * |
| 3 | * Copyright (C) 2010 Google, Inc. |
| 4 | * |
| 5 | * This software is licensed under the terms of the GNU General Public |
| 6 | * License version 2, as published by the Free Software Foundation, and |
| 7 | * may be copied, distributed, and modified under those terms. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | */ |
| 15 | |
| 16 | #ifndef _CPUACCT_H_ |
| 17 | #define _CPUACCT_H_ |
| 18 | |
| 19 | #include <linux/cgroup.h> |
| 20 | |
| 21 | #ifdef CONFIG_CGROUP_CPUACCT |
| 22 | |
| 23 | /* |
| 24 | * Platform specific CPU frequency hooks for cpuacct. These functions are |
| 25 | * called from the scheduler. |
| 26 | */ |
| 27 | struct cpuacct_charge_calls { |
| 28 | /* |
| 29 | * Platforms can take advantage of this data and use |
| 30 | * per-cpu allocations if necessary. |
| 31 | */ |
| 32 | void (*init) (void **cpuacct_data); |
| 33 | void (*charge) (void *cpuacct_data, u64 cputime, unsigned int cpu); |
Mike Chan | be17d1d | 2010-05-12 15:52:14 -0700 | [diff] [blame] | 34 | void (*cpufreq_show) (void *cpuacct_data, struct cgroup_map_cb *cb); |
| 35 | /* Returns power consumed in milliWatt seconds */ |
| 36 | u64 (*power_usage) (void *cpuacct_data); |
Mike Chan | c69233f | 2010-05-10 17:54:48 -0700 | [diff] [blame] | 37 | }; |
| 38 | |
| 39 | int cpuacct_charge_register(struct cpuacct_charge_calls *fn); |
| 40 | |
| 41 | #endif /* CONFIG_CGROUP_CPUACCT */ |
| 42 | |
| 43 | #endif // _CPUACCT_H_ |