blob: 8f68e733fe194c04a70106551862cec389c194ee [file] [log] [blame]
Mike Chanc69233f2010-05-10 17:54:48 -07001/* 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 */
27struct 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 Chanbe17d1d2010-05-12 15:52:14 -070034 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 Chanc69233f2010-05-10 17:54:48 -070037};
38
39int cpuacct_charge_register(struct cpuacct_charge_calls *fn);
40
41#endif /* CONFIG_CGROUP_CPUACCT */
42
43#endif // _CPUACCT_H_