-
Notifications
You must be signed in to change notification settings - Fork 22
/
README
228 lines (168 loc) · 4.75 KB
/
README
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
What is cgroup-utils?
=====================
cgroup-utils provides utility tools and libraries for control groups of
Linux. For example, cgutil top is a top-like tool which shows activities
of running processes in control groups.
Installation
============
For users
---------
::
$ sudo pip install cgroup-utils
For developers
--------------
::
$ git clone git://github.com/peo3/cgroup-utils.git
$ cd cgroup-utils
$ python setup.py build
$ sudo python setup.py install
Packaging (rpm)
~~~~~~~~~~~~~~~
::
$ python setup.py bdist --formats=rpm
Available commands
==================
- configs
- event
- mkdir
- pgrep
- rmdir
- stats
- top
- tree
cgutil configs
--------------
This command show you configurations of cgroups. By default, it shows
only changed configurations.
Example output
~~~~~~~~~~~~~~
::
$ cgutil configs -o memory
<root>
notify_on_release=1
release_agent=/usr/lib/ulatencyd/ulatencyd_cleanup.lua
sys_essential
swappiness=0
notify_on_release=1
sys_bg
swappiness=100
notify_on_release=1
cgutil event
------------
This command makes cgroup.event_control easy to use. It exits when a
state of a target cgroup crosses a threshold which you set, thus, you
can know the state of the cgroup has changed.
.. _example-output-1:
Example output
~~~~~~~~~~~~~~
::
$ cgutil event /sys/fs/cgroup/memory/system/sshd.service/memory.usage_in_bytes +1M
$ # It exits when memory usage of processes in the cgroup has increased one more MB.
cgutil pgrep
------------
This command is alike ``pgrep`` command but it shows cgroups in addtion
to PIDs.
.. _example-output-2:
Example output
~~~~~~~~~~~~~~
::
$ cgutil pgrep ssh
/: 15072
/: 15074
/system/sshd.service: 630
$ cgutil pgrep ssh -l -f
/: 15072 sshd: ozaki-r [priv]
/: 15074 sshd: ozaki-r@pts/2
/: 15157 /bin/python /bin/cgutil pgrep ssh -l -f
/system/sshd.service: 630 /usr/sbin/sshd -D
cgutil stats
------------
This command shows you states of cgroups.
.. _example-output-3:
Example output
~~~~~~~~~~~~~~
::
$ cgutil stats
<root>
stat={'throttled_time': 0L, 'nr_periods': 0L, 'nr_throttled': 0L}
system
stat={'throttled_time': 0L, 'nr_periods': 0L, 'nr_throttled': 0L}
system/sm-client.service
stat={'throttled_time': 0L, 'nr_periods': 0L, 'nr_throttled': 0L}
system/sendmail.service
stat={'throttled_time': 0L, 'nr_periods': 0L, 'nr_throttled': 0L}
system/vboxadd-service.service
stat={'throttled_time': 0L, 'nr_periods': 0L, 'nr_throttled': 0L}
system/colord.service
stat={'throttled_time': 0L, 'nr_periods': 0L, 'nr_throttled': 0L}
system/colord-sane.service
stat={'throttled_time': 0L, 'nr_periods': 0L, 'nr_throttled': 0L}
system/udisks2.service
stat={'throttled_time': 0L, 'nr_periods': 0L, 'nr_throttled': 0L}
system/cups.service
stat={'throttled_time': 0L, 'nr_periods': 0L, 'nr_throttled': 0L}
cgutil top
----------
This command is alike ``top`` command but it shows activities in a unit
of cgroups.
.. _example-output-4:
Example output
~~~~~~~~~~~~~~
::
$ cgutil top -i -n 2 -b
18.1 msec to collect statistics
[ CPUACCT ] [ BLKIO ] [ MEMORY ]
USR SYS READ WRITE TOTAL RSS SWAP # NAME
0.0% 0.0% 0.0 /s 0.0 /s 0.0 48.0k 0.0 97 usr_1000/default
20.5 msec to collect statistics
[ CPUACCT ] [ BLKIO ] [ MEMORY ]
USR SYS READ WRITE TOTAL RSS SWAP # NAME
0.0% 0.0% 0.0 /s 0.0 /s 128.0k 4.0k 0.0 104 sys_daemon
0.0% 0.0% 0.0 /s 0.0 /s -64.0k 0.0 0.0 0 sys_essential
0.0% 0.0% 0.0 /s 0.0 /s 108.0k 32.0k 0.0 97 usr_1000/default
cgutil tree
-----------
This command shows you tree structure of cgroups.
Example outputs
~~~~~~~~~~~~~~~
::
$ cgutil tree -o blkio
<root>
`system
+sm-client.service
+sendmail.service
+vboxadd-service.service
+colord.service
+colord-sane.service
+udisks2.service
+cups.service
+rtkit-daemon.service
(snip)
+udev.service
`systemd-journald.service
Supported Linux Version
=======================
4.20.y
Supported subsystems
--------------------
- blkio (and its debug feature)
- cpuset
- cpu and cpuacct
- devices
- freezer
- hugetlb
- memory
- net_cls
- net_prio
- pids
- rdma
Supported Python
================
- python2: 2.6 and above
- deprecated
- python3: 3.4 and above
- 3.0 to 3.3 may work but not tested
License
=======
The tools are distributed under GPLv2. See COPYING for more detail.