diff options
author | Bharata B Rao <bharata@linux.vnet.ibm.com> | 2009-04-01 11:29:19 +0530 |
---|---|---|
committer | Balbir Singh <balbir@linux.vnet.ibm.com> | 2009-04-01 11:29:19 +0530 |
commit | 48532a1617ed59b5aaef247eace7a5cb67a1c69c (patch) | |
tree | 34b2d9db0aa305c1398716794b8e84029b0fe72f /include/libcgroup.h | |
parent | c47ee042c61d050b70e6b90aa50848d82e77b041 (diff) | |
download | libcg-48532a1617ed59b5aaef247eace7a5cb67a1c69c.tar.gz libcg-48532a1617ed59b5aaef247eace7a5cb67a1c69c.tar.xz libcg-48532a1617ed59b5aaef247eace7a5cb67a1c69c.zip |
Here is the v2 of the patch which introduces APIs to read controller
specific stats. Added Makefile.am updates which I had missed in the
previous post.
New APIs to read controller specific statistics.
This patch introduces 3 new APIs which can be used to read controller
statistics iteratively. (Eg. stats from memory.stat etc)
Reading of stats is initiated by cgroup_read_stats_begin() API, which
returns the first stat of the requested controller in addition to returing
a handle that should be used in subsequent reads.
cgroup_read_stats_next() API can be used to read the remaining stats
one by one. This needs the handle returned by cgroup_read_stats_begin().
cgroup_read_stats_end() API will terminate the stats reading iteration
initiated by cgroup_read_stats_begin().
Changelog:
v2
- Update tests/Makefile.am so that it generates appropriate rules
for tests/read_stats.c in the Makefile. This is in addition to
the manual updates done to the generated file tests/Makefile.in.
v1
- cgroup_read_stats apis now work with relative cgroup path names instead
of absolute path names.
v0
- Initial post.
Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
Diffstat (limited to 'include/libcgroup.h')
-rw-r--r-- | include/libcgroup.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/include/libcgroup.h b/include/libcgroup.h index 750e36e..efa852b 100644 --- a/include/libcgroup.h +++ b/include/libcgroup.h @@ -129,6 +129,11 @@ struct cgroup_file_info { */ #define CG_HIER_MAX CG_CONTROLLER_MAX +struct cgroup_stat { + char name[FILENAME_MAX]; + char value[CG_VALUE_MAX]; +}; + /* Functions and structures that can be used by the application*/ struct cgroup; struct cgroup_controller; @@ -250,6 +255,25 @@ int cgroup_walk_tree_next(const int depth, void **handle, struct cgroup_file_info *info, int base_level); int cgroup_walk_tree_end(void **handle); +/** + * Read the statistics values for the specified controller + * @controller: Name of the controller for which stats are requested. + * @path: cgroup path. + * @handle: Handle to be used during iteration. + * @stat: Stats values will be filled and returned here. + */ +int cgroup_read_stats_begin(char *controller, char *path, void **handle, + struct cgroup_stat *stat); + +/** + * Read the next stat value. + * @handle: Handle to be used during iteration. + * @stat: Stats values will be filled and returned here. + */ +int cgroup_read_stats_next(void **handle, struct cgroup_stat *stat); + +int cgroup_read_stats_end(void **handle); + /* The wrappers for filling libcg structures */ struct cgroup *cgroup_new_cgroup(const char *name); |