linux/kernel/sched/cpuacct.c

// SPDX-License-Identifier: GPL-2.0

/*
 * CPU accounting code for task groups.
 *
 * Based on the work by Paul Menage ([email protected]) and Balbir Singh
 * ([email protected]).
 */

/* Time spent by the tasks of the CPU accounting group executing in ... */
enum cpuacct_stat_index {};

static const char * const cpuacct_stat_desc[] =;

/* track CPU usage of a group of tasks and its child groups */
struct cpuacct {};

static inline struct cpuacct *css_ca(struct cgroup_subsys_state *css)
{}

/* Return CPU accounting group to which this task belongs */
static inline struct cpuacct *task_ca(struct task_struct *tsk)
{}

static inline struct cpuacct *parent_ca(struct cpuacct *ca)
{}

static DEFINE_PER_CPU(u64, root_cpuacct_cpuusage);
static struct cpuacct root_cpuacct =;

/* Create a new CPU accounting group */
static struct cgroup_subsys_state *
cpuacct_css_alloc(struct cgroup_subsys_state *parent_css)
{}

/* Destroy an existing CPU accounting group */
static void cpuacct_css_free(struct cgroup_subsys_state *css)
{}

static u64 cpuacct_cpuusage_read(struct cpuacct *ca, int cpu,
				 enum cpuacct_stat_index index)
{}

static void cpuacct_cpuusage_write(struct cpuacct *ca, int cpu)
{}

/* Return total CPU usage (in nanoseconds) of a group */
static u64 __cpuusage_read(struct cgroup_subsys_state *css,
			   enum cpuacct_stat_index index)
{}

static u64 cpuusage_user_read(struct cgroup_subsys_state *css,
			      struct cftype *cft)
{}

static u64 cpuusage_sys_read(struct cgroup_subsys_state *css,
			     struct cftype *cft)
{}

static u64 cpuusage_read(struct cgroup_subsys_state *css, struct cftype *cft)
{}

static int cpuusage_write(struct cgroup_subsys_state *css, struct cftype *cft,
			  u64 val)
{}

static int __cpuacct_percpu_seq_show(struct seq_file *m,
				     enum cpuacct_stat_index index)
{}

static int cpuacct_percpu_user_seq_show(struct seq_file *m, void *V)
{}

static int cpuacct_percpu_sys_seq_show(struct seq_file *m, void *V)
{}

static int cpuacct_percpu_seq_show(struct seq_file *m, void *V)
{}

static int cpuacct_all_seq_show(struct seq_file *m, void *V)
{}

static int cpuacct_stats_show(struct seq_file *sf, void *v)
{}

static struct cftype files[] =;

/*
 * charge this task's execution time to its accounting group.
 *
 * called with rq->lock held.
 */
void cpuacct_charge(struct task_struct *tsk, u64 cputime)
{}

/*
 * Add user/system time to cpuacct.
 *
 * Note: it's the caller that updates the account of the root cgroup.
 */
void cpuacct_account_field(struct task_struct *tsk, int index, u64 val)
{}

struct cgroup_subsys cpuacct_cgrp_subsys =;