summaryrefslogtreecommitdiff
path: root/include/linux/cpuacct.h
blob: 8f68e733fe194c04a70106551862cec389c194ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* include/linux/cpuacct.h
 *
 * Copyright (C) 2010 Google, Inc.
 *
 * This software is licensed under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation, and
 * may be copied, distributed, and modified under those terms.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 */

#ifndef _CPUACCT_H_
#define _CPUACCT_H_

#include <linux/cgroup.h>

#ifdef CONFIG_CGROUP_CPUACCT

/*
 * Platform specific CPU frequency hooks for cpuacct. These functions are
 * called from the scheduler.
 */
struct cpuacct_charge_calls {
	/*
	 * Platforms can take advantage of this data and use
	 * per-cpu allocations if necessary.
	 */
	void (*init) (void **cpuacct_data);
	void (*charge) (void *cpuacct_data,  u64 cputime, unsigned int cpu);
	void (*cpufreq_show) (void *cpuacct_data, struct cgroup_map_cb *cb);
	/* Returns power consumed in milliWatt seconds */
	u64 (*power_usage) (void *cpuacct_data);
};

int cpuacct_charge_register(struct cpuacct_charge_calls *fn);

#endif /* CONFIG_CGROUP_CPUACCT */

#endif // _CPUACCT_H_