Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: LGPL-2.1 WITH Linux-syscall-note */
0002 /* cgroupstats.h - exporting per-cgroup statistics
0003  *
0004  * Copyright IBM Corporation, 2007
0005  * Author Balbir Singh <balbir@linux.vnet.ibm.com>
0006  *
0007  * This program is free software; you can redistribute it and/or modify it
0008  * under the terms of version 2.1 of the GNU Lesser General Public License
0009  * as published by the Free Software Foundation.
0010  *
0011  * This program is distributed in the hope that it would be useful, but
0012  * WITHOUT ANY WARRANTY; without even the implied warranty of
0013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
0014  */
0015 
0016 #ifndef _LINUX_CGROUPSTATS_H
0017 #define _LINUX_CGROUPSTATS_H
0018 
0019 #include <linux/types.h>
0020 #include <linux/taskstats.h>
0021 
0022 /*
0023  * Data shared between user space and kernel space on a per cgroup
0024  * basis. This data is shared using taskstats.
0025  *
0026  * Most of these states are derived by looking at the task->state value
0027  * For the nr_io_wait state, a flag in the delay accounting structure
0028  * indicates that the task is waiting on IO
0029  *
0030  * Each member is aligned to a 8 byte boundary.
0031  */
0032 struct cgroupstats {
0033     __u64   nr_sleeping;        /* Number of tasks sleeping */
0034     __u64   nr_running;     /* Number of tasks running */
0035     __u64   nr_stopped;     /* Number of tasks in stopped state */
0036     __u64   nr_uninterruptible; /* Number of tasks in uninterruptible */
0037                     /* state */
0038     __u64   nr_io_wait;     /* Number of tasks waiting on IO */
0039 };
0040 
0041 /*
0042  * Commands sent from userspace
0043  * Not versioned. New commands should only be inserted at the enum's end
0044  * prior to __CGROUPSTATS_CMD_MAX
0045  */
0046 
0047 enum {
0048     CGROUPSTATS_CMD_UNSPEC = __TASKSTATS_CMD_MAX,   /* Reserved */
0049     CGROUPSTATS_CMD_GET,        /* user->kernel request/get-response */
0050     CGROUPSTATS_CMD_NEW,        /* kernel->user event */
0051     __CGROUPSTATS_CMD_MAX,
0052 };
0053 
0054 #define CGROUPSTATS_CMD_MAX (__CGROUPSTATS_CMD_MAX - 1)
0055 
0056 enum {
0057     CGROUPSTATS_TYPE_UNSPEC = 0,    /* Reserved */
0058     CGROUPSTATS_TYPE_CGROUP_STATS,  /* contains name + stats */
0059     __CGROUPSTATS_TYPE_MAX,
0060 };
0061 
0062 #define CGROUPSTATS_TYPE_MAX (__CGROUPSTATS_TYPE_MAX - 1)
0063 
0064 enum {
0065     CGROUPSTATS_CMD_ATTR_UNSPEC = 0,
0066     CGROUPSTATS_CMD_ATTR_FD,
0067     __CGROUPSTATS_CMD_ATTR_MAX,
0068 };
0069 
0070 #define CGROUPSTATS_CMD_ATTR_MAX (__CGROUPSTATS_CMD_ATTR_MAX - 1)
0071 
0072 #endif /* _LINUX_CGROUPSTATS_H */