Skip to content

Commit c108291

Browse files
author
Inkedstinct
committed
docs(getting_started): Make cgroup part optionnal with more explicit information
1 parent 72706cd commit c108291

File tree

1 file changed

+32
-35
lines changed

1 file changed

+32
-35
lines changed

docs/getting_started.md

Lines changed: 32 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -18,45 +18,42 @@ So feel free to skip directly to the [preparation part](#preparation) if you don
1818

1919
## Define elements to monitor
2020

21-
PowerAPI being a monitoring tool for energy consumption, we will need to define
22-
the necessary elements to monitor.
23-
To do so we can use the Linux abstraction of [cGroups](https://www.redhat.com/sysadmin/cgroups-part-one).
24-
25-
### Create a cGroup
26-
27-
In order to create a cGroup, the following command can be used from CLI :
28-
29-
```sh
30-
cgcreate -g perf_event:new_cgroup_name
31-
```
32-
33-
Check [here](./reference/cgroup/cgroup_v1_activation.md) if you have trouble
34-
creating the cgroup.
35-
36-
### Add processes to the group
37-
38-
Once the group created, we need to fill it with processes to be monitored.
39-
To do so, you can use the following :
21+
!!! tip "Optionnal abstraction for fine-grain analysis"
22+
This part is optionnal, it allows the definition of cgroups which can group chosen processes that make sense to you.
23+
If you skip it, the next steps will work against all current process grouped.
4024

25+
PowerAPI being a monitoring tool for energy consumption, we can define logic grouping of elements to monitor.
26+
To do so we can use the Linux abstraction of [cGroups](https://www.redhat.com/sysadmin/cgroups-part-one).
27+
Kernel supports 2 versions of cGroups : v1 and v2.
28+
To know which one your kernel supports, you can run :
4129
```sh
42-
cgclassify -g perf_event:new_cgroup_name PID
43-
```
44-
45-
with `PID`, the pid of the process you want to monitor. If you want to monitor a
46-
process composed of many processes, replace PID with `$(pidof process_name)`.
47-
48-
### Installing a process to monitor
49-
50-
[stress-ng](https://wiki.ubuntu.com/Kernel/Reference/stress-ng) can be used to
51-
generate load on one's system.
52-
An example usage, once installed :
53-
54-
```sh
55-
cgcreate -g perf_event:stress-ng-cgroup
56-
stress-ng --cpu 1 --timeout 5m
57-
cgclassify -g perf_event:stress-ng-cgroup $!
30+
mount | grep '^cgroup' | awk '{print $1}' | uniq
5831
```
5932

33+
*Both versions can be supported at the same time*.
34+
35+
??? "Create a cGroup"
36+
37+
In order to create a cGroup, you can use:
38+
39+
- cgroup v1 : [this doc](https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v1/cgroups.html#usage-examples-and-syntax)
40+
- cgroup v2 : [this doc](https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html#mounting)
41+
42+
43+
44+
??? "Add processes to the group"
45+
46+
Once the cgroup created, we need to fill it with processes to be monitored.
47+
To do so, you can use:
48+
49+
- cgroup v1 : [this doc](https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v1/cgroups.html#attaching-processes).
50+
- cgroup v2 : [this doc](https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v1/cgroups.html#attaching-processes).
51+
52+
??? warning "Installing a process to monitor"
53+
54+
[stress-ng](https://wiki.ubuntu.com/Kernel/Reference/stress-ng) can be used to
55+
generate load on one's system. **Be carefull** as it can be configured to be quite agressive.
56+
6057
## Which components to get a complete stack
6158

6259
If you wish to get started as soon as possible, the following archive will allow you to deploy the following elements :

0 commit comments

Comments
 (0)