Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit c09eecf

Browse files
authoredJan 8, 2025··
Merge pull request #18 from powerapi-ng/revert-15-7_doc/nld_proofread
Revert "7_doc/nld proofread"
2 parents 3b74831 + 66d83fc commit c09eecf

25 files changed

+464
-3549
lines changed
 

‎README.md

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,3 @@
22
PowerAPI website use [MKDocs](https://www.mkdocs.org/).
33

44
You can push your changes on `master` branch to deploy them on the website.
5-
6-
## Local development
7-
8-
When redacting changes for this documentation, you may want to visualize the
9-
output the way it will be presented in the final website once compiled.
10-
11-
One way to do so is to:
12-
13-
1. Install the necessary packages : mkdocs, mkdocs-material, mkdocs-material-extensions
14-
This can be done with: `pip install mkdocs mkdocs-material mkdocs-material-extensions`
15-
16-
2. Have a local copy of this repository (taking care of *checkout-ing* the right ref)
17-
18-
3. From the CLI, have this particular repository as PWD
19-
20-
4. Use mkdocs in order to serve locally (default on http://localhost:8000)
21-
This can be done with: `mkdocs serve -o`
22-
23-
5. Check the URL it serves to, targets will be rebuild on modifications in the
24-
current directory or in any nested elements (use -W to add paths to be considered for hot reloading)

‎docs/assets/images/reference/sensors/PowerAPI_HWPCSensorOverview.drawio

Lines changed: 0 additions & 99 deletions
This file was deleted.

‎docs/assets/images/reference/sensors/PowerAPI_HWPCSensorOverview.drawio.svg

Lines changed: 0 additions & 4 deletions
This file was deleted.

‎docs/getting_started.md

Lines changed: 37 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,92 +1,57 @@
11
# Getting started
22

3-
In this tutorial, we will guide you through the first steps to get started with PowerAPI.
4-
The objective is to get a quick view of the capabilities of PowerAPI, by monitoring a process and getting a quick glimpse at the energy consumption.
5-
A few things are required before we start:
3+
If you want to monitor the energy consumption of your process we have some
4+
ready-to-use tools
65

7-
- A compatible processor (you can see the compatible CPU architecture [here](./reference/sensors/hwpc-sensor.md#)), and you can look on the following pages to find your CPU architecture:
8-
* For [Intel Processor](https://en.wikipedia.org/wiki/List_of_Intel_processors)
9-
* For [Intel Xeon Processor](https://en.wikipedia.org/wiki/List_of_Intel_Xeon_processors)
10-
* For [AMD Processor](https://en.wikipedia.org/wiki/Table_of_AMD_processors)
11-
- A python installation ready
12-
- Docker & Docker-Compose ready (refer to [this official documentation](https://docs.docker.com/engine/install/) and the [post-install steps](https://docs.docker.com/engine/install/linux-postinstall/) if needed !)
13-
- Root access
14-
- Optional : [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) to proceed by cloning the repository
6+
???+ info "Source and Destination"
7+
In order to use any Formula, you need to run a Source and a Destination. The former is used by a Sensor to store metrics. The later allows the Formula to make available the estimations. For starting, you can use [MongoDB](https://hub.docker.com/_/mongo) as Source and [InfluxDB:2.X](https://hub.docker.com/_/influxdb) as Destination by installing them as Docker containers.
8+
For more details about Sources and Destinations please check this [section](reference/database/sources_destinations.md).
159

16-
## Which components to get a complete stack
1710

18-
If you wish to get started as soon as possible, the archive below will allow you to deploy the following elements:
11+
<!---
12+
## **RAPL Formula**
1913
20-
1. A MongoDB instance to store the [Sensor](./reference/sensors/hwpc-sensor.md)
21-
Reports
14+
!!! note ""
15+
for monitoring the energy consumption of your device
2216
23-
3. An [HWPC-Sensor](./reference/sensors/hwpc-sensor.md) that outputs its
24-
[HWPC Reports](./reference/reports/reports.md#hwpc-reports) in a MongoDB Database,
25-
within the HWPC Report Collection
17+
RAPL Formula is made for tracking the energy consumption of your machine.
18+
To install RAPL Formula on a baremetal server or a PC run [the following
19+
script](script/rapl_install.sh) in a Terminal.
2620
27-
4. A [SmartWatts](./reference/formulas/smartwatts.md) that streams the
28-
[HWPC Reports](./reference/reports/reports.md#hwpc-reports) from the MongoDB
29-
Database Collection, processes it and outputs its
30-
[Power Reports](./reference/reports/reports.md#power-reports) as CSV files for a
31-
quick glimpse
21+
The script explains what it will do and then pauses before it does it.
3222
33-
## Preparation
23+
Please notice that you need a **Linux distribution** in order to use the HWPC Sensor installed by the script as
24+
well as a **comptible Intel** (Sandy Bridge and newer) or **AMD Processor** (Zen). **Power/ARM/RISCV are not supported** architectures. HWPC Sensor will **not work on a Virtual Machine**. However, you can install the Formula by hand in a Virtual Machine if need it.
25+
-->
3426

35-
You can either download the archive by cloning the repository or using wget.
27+
## **SmartWatts Formula**
3628

37-
=== "git"
38-
```sh
39-
git clone https://github.com/powerapi-ng/powerapi-ng.github.io.git
40-
cd powerapi-ng.github.io/docs/script/getting-started
41-
```
29+
!!! note ""
30+
for monitoring the power consumption of your process
4231

43-
=== "wget"
44-
```
45-
wget -c https://github.com/raw/powerapi-ng/powerapi-ng.github.io/refs/heads/master/docs/script/getting_started.tar.gz -O - | tar -xz
46-
cd getting_started
47-
```
32+
Smartwatts is made for tracking the power consumption of processes on a
33+
machine.
34+
To install Smartwatts on a baremetal server or a PC run [the following
35+
script](script/smartwatts_install.sh) in a Terminal. Please notice that you will need [pip](https://pip.pypa.io/en/stable/installation/) or [docker](https://docs.docker.com/engine/install/) in order to use the Formula.
4836

49-
At this stage, you will have all the essential files to begin. Let's go through each element in detail.
50-
### Archive content
37+
The script explains what it will do and then pauses before it does it.
5138

52-
```sh
53-
getting_started/
54-
|--csv/
55-
|--formula/
56-
|----smartwatts-mongodb-csv.json
57-
|--sensor/
58-
|----hwpc-mongodb.json
59-
|--start.sh
60-
|--start.py
61-
|--stop.sh
62-
|--pretty_print.py
63-
|--docker-compose.yaml
64-
|--.env
65-
```
39+
Please notice that you need a **Linux distribution** in order to use the HWPC Sensor installed by the script as
40+
well as a **comptible Intel** (Sandy Bridge and newer) or **AMD Processor** (Zen). You also need [docker](https://docs.docker.com/engine/install/). **Power/ARM/RISCV are not supported** architectures. HWPC Sensor will **not work on a Virtual Machine**. However, you can install the Formula by hand in a Virtual Machine if need it.
6641

67-
#### HWPC-Sensor and SmartWatts Configuration
6842

69-
As described in the [HWPC-Sensor Documentation](./reference/sensors/hwpc-sensor.md#global-parameters) and in the [SmartWatts Documentation](./reference/formulas/smartwatts.md#global-parameters),
70-
several parameters can be set, both globally and for specific Groups monitored for the sensor or the formula.
7143

72-
The provided docker-compose.yaml file uses configuration files and the **.env** to set those parameters.
73-
You can find examples of both those configuration files in the archive under the **formula** and **sensor** directories.
44+
#### CGroups
45+
If you need to monitor a process or a group of process via SmartWatts by using HWPC Sensor **version 1.2 or older**, you can follow this [tutorial](reference/cgroup/cgroup.md). Please notice that **cgroup V1** is required **only** for HWPC Sensor **version 1.2 or older**. If you need to enable this `cgroup` version please follow this [tutorial](reference/cgroup/cgroup_v1_activation.md).
7446

47+
<!---
48+
## **Jouleit**
7549
76-
## Turn the key
50+
!!! note ""
51+
for mesuring the energy consumption of a program
7752
78-
Once all set, you shall be able to initiate the stack with:
79-
80-
```sh
81-
python3 start.py
82-
```
83-
84-
After the 2 minutes of monitoring, you will be able to see the result inside the **csv** directory.
85-
If you have trouble understanding the output, you can read the [Power Report documentation](./reference/reports/reports.md#power-reports).
86-
87-
!!! info "Quick results overview"
88-
Only in the context of this testing archive, after the monitoring, you can use the following command to get a pretty print of the result directly inside the terminal.
89-
90-
```sh
91-
python3 pretty_print.py
92-
```
53+
Jouleit is made for tracking the energy consumption of a program.
54+
Jouleit need `gawk` to run.
55+
You can get the script from the [github repository](https://github.com/powerapi-ng/jouleit)
56+
Start jouleit by using `./jouleit.sh cmd`.
57+
-->

‎docs/reference/database/sources_destinations.md

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,19 @@
1-
# Storage Options
1+
# Sources and Destinations
22

3-
Different storage options are available to serve different purpose both for [Sensors](../overview.md#Sensor) and [Formulas](../overview.md#Formula).
3+
A PowerAPI Formula uses Sources and Destinations in order to retrieve metrics and store estimations.
44

5-
Storage is needed to save reports produced by each components.
6-
- Sensors store their usage reports
7-
- Formulas retrieve usage reports and store energy consumption reports
8-
- Visualization tools or individuals need to access reports for analysis
5+
For each Source/Destination the parameters to specify are different. For each one of them,
6+
its parameters are specified in following sections.
97

108
## Summary
11-
12-
The following table defines the existing storage options for Sensors usage reports :
13-
14-
| Name | CLI `ouput` parameter value | JSON `type` tag parameter value|
15-
| ------------ | --------------------------------------| -------------------------------------------|
16-
| MongoDB | mongodb | mongodb |
17-
| CSV | csv | csv |
18-
| Socket | socket | socket |
19-
| File Database | filedb | filedb |
20-
9+
| Name | Source | Destination | CLI `input`/`ouput` parameter value | JSON `type` tag parameter value |
10+
| ------------- | ----- | ------------- | ------------- | ------------------------------------ |
11+
| MongoDB | Yes | Yes | mongodb | mongodb |
12+
| InfluxDB2 | No | Yes | influxdb2 | influxdb2 |
13+
| CSV | Yes | Yes | csv | csv |
14+
| Socket | Yes | No | socket | socket |
15+
| File Database | Yes | Yes | filedb | filedb |
16+
| Prometheus | No | Yes | prometheus | prometheus |
2117

2218
## MongoDB
2319

@@ -34,7 +30,7 @@ The list of accepted parameters are:
3430
|`db` (`database` for `HWPCSensor`) | string | `d` (`D` for `HWPCSensor`) | N/A | Yes | The name of your database |
3531
|`collection` | string | `c` (`C` for `HWPCSensor`) | N/A | Yes | The name of the collection inside `db` |
3632
|`name` | string | `n` | `"puller_mongodb"` (Source), `pusher_mongodb` (Destination)| No | The related puller/pusher name. This parameter is not used by `HWPCSensor` |
37-
|`model` | string | `m` | `"HWPC Report"` (Source), `Power Report` (Destination) | No | The Report type stored by the database |
33+
|`model` | string | `m` | `"HWPCReport"` (Source), `PowerReport` (Destination) | No | The Report type stored by the database |
3834

3935
### JSON File Excerpt
4036

@@ -68,7 +64,7 @@ The list of accepted parameters are:
6864
|`org` | string | `g` | N/A | Yes | The name of the organization associated to the bucket |
6965
|`tags` | string | `t` | N/A | No | List of metadata keys of the report separated by `,` that will be kept. `sensor` and `target` are always kept as report metadata |
7066
|`name` | string | `n` | `"pusher_influxdb2"` | No | The related pusher name |
71-
|`model` | string | `m` | `"Power Report"` | No | The Report type stored by the database |
67+
|`model` | string | `m` | `"PowerReport"` | No | The Report type stored by the database |
7268

7369

7470
InfluxDB2 can only be used as a Destination.
@@ -79,7 +75,7 @@ Below you find an example of configuration excerpt for this kind of Destination.
7975

8076
```json
8177
{
82-
"model": "Power Report",
78+
"model": "PowerReport",
8379
"type": "influxdb2",
8480
"uri": "http://127.0.0.1",
8581
"port": 8086,
@@ -104,7 +100,7 @@ The list of accepted parameters are:
104100
|`files`(Source)| string | `f` | Empty list | No | The list of input CSV files with the format file1,file2,file3... |
105101
|`directory` (Destination and `HWPCSensor`)| string |`d` (`U` for `HWPCSensor`) | Current directory | No |The directory where output CSV files will be written |
106102
|`name` | string | `n` | `"puller_csv"` (Source), `"pusher_csv"` (Destination)| No | The related puller/pusher name. This parameter is not used by `HWPCSensor` |
107-
|`model` | string | `m` | `"HWPC Report"` (Source), `"Power Report"` (Destination) | No | The Report type stored in CSV files. This parameter is not used by `HWPCSensor` |
103+
|`model` | string | `m` | `"HWPCReport"` (Source), `"PowerReport"` (Destination) | No | The Report type stored in CSV files. This parameter is not used by `HWPCSensor` |
108104

109105
### JSON File Excerpt
110106

@@ -132,7 +128,7 @@ The list of accepted parameters are:
132128
|`port` | int | `P` | N/A | Yes | The port of communication |
133129
|`uri`/ `host` | int | `U` | N/A | Yes | The IP address of the machine running the socket |
134130
|`name` | string | `n` | `"puller_socket"`| No | The related puller name |
135-
|`model` | string | `m` | `"HWPC Report"` | No | The Report type managed by the socket |
131+
|`model` | string | `m` | `"HWPCReport"` | No | The Report type managed by the socket |
136132

137133

138134
### JSON File Excerpt
@@ -162,7 +158,7 @@ The list of accepted parameters are:
162158
| ------------- | ----- | ------------- | -------------| ---------- | ------------------------------------ |
163159
|`filename` | int | `f` | N/A | Yes | The name of the file |
164160
|`name` | string | `n` | `"pusher_filedb"` | No | The related pusher name |
165-
|`model` | string | `m` | `"HWPC Report"` (Source) `"Power Report"` (Destination)| No | The Report type stored in the file |
161+
|`model` | string | `m` | `"HWPCReport"` (Source) `"PowerReport"` (Destination)| No | The Report type stored in the file |
166162

167163
### JSON File Excerpt
168164

@@ -192,7 +188,7 @@ The list of accepted parameters are:
192188
|`metric-name` | string | `M` | N/A | Yes | The exposed metric name |
193189
|`metric-description` | string | `d` | `"energy consumption"` | No | The exposed metric description |
194190
|`name` | string | `n` | `"pusher_prom"` | No | The related pusher name |
195-
|`model` | string | `m` | `"Power Report"` | No | The Report type exposed by Prometheus |
191+
|`model` | string | `m` | `"PowerReport"` | No | The Report type exposed by Prometheus |
196192

197193

198194
Prometheus can only be used as a Destination that monitors reports but they will be not stored by this service.

‎docs/reference/formulas/configuration_files.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,14 @@ The table below shows basic parameters.
1111
| `verbose` | `bool` (flag) | `v` |`NOTSET` | Verbose or quiet mode |
1212
| `stream` | `bool` (flag) | `s` |`False` | Real time or post-mortem mode |
1313
| `sensor-report-sampling-interval` | `int` | N/A | `1000` | The time in milliseconds between two reports (`stream` = `True`) |
14-
| `input` | `string` | N/A | N/A | SmartWatts input, shall match an existing Sensor output and contain HPWCReports. See [here](./smartwatts.md#smartwatts-inputs) |
15-
| `output` | `string` | N/A | N/A | SmartWatts output to store Power Report. See [here](./smartwatts.md#smartwatts-outputs) |
14+
| `input` | `string` (Source) | N/A | N/A | Source used as input. More information about Sources and their related parameters can be found [here](../database/sources_destinations.md)|
15+
| `output` | `string` (Destination)| N/A | N/A | Destination used as output. More information about Destinations and their related parameters can be found [here](../database/sources_destinations.md)|
1616
| `pre-processor` | `string` | N/A | N/A | Pre-Processor to modify reports generated by a sensor. More information about Processors and their related parameters can be found [here](../processors/processors.md) |
1717
| `post-processor` | `string` | N/A | N/A | Post-Processor to modify reports generated by a formula. More information about Processors and their related parameters can be found [here](../processors/processors.md) |
1818

19+
???+ tip "Sources and Destinations' values"
20+
- Sources: `mongodb`, `csv`, `socket`, `filedb`
21+
- Destinations: `mongodb`, `influxedb`, `influxedb2`, `csv`, `socket`, `filedb`, `prom`
1922

2023
???+ tip "Processors' values"
2124
- Pre-Processors: `k8s`, `libvirt`
@@ -49,5 +52,5 @@ PowerAPI Formulas use `json` files. These files follow the next template:
4952
$formula_parameters
5053
}
5154
```
52-
???+ info "input and output' `json` tags"
55+
???+ info "Sources and Destinations' `json` tags"
5356
More information related to `json` tags for each Source/Destination can be found [here](../database/sources_destinations.md)

‎docs/reference/formulas/rapl.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ The RAPL Formula is designed to mesure power consumption of domains (CPU or RAM)
77
in real time.
88

99
The RAPL Formula takes HWPC Report with RAPL event for each domains. It then
10-
returns the mesured power in a Power Report for each domain.
10+
returns the mesured power in a PowerReport for each domain.
1111
This Formula does not perform any other computation as its goal is only to track
1212
global power consumption in a more readable way than raw RAPL.
1313

@@ -29,7 +29,7 @@ You can use [the following script](../script/rapl_install.sh) to install RAPL Fo
2929

3030
## Usage
3131

32-
For running the RAPL Formula you need: a Source and a Destination, a Sensor that provides `HWPC Reports` and a configuration.
32+
For running the RAPL Formula you need: a Source and a Destination, a Sensor that provides `HWPCReports` and a configuration.
3333

3434
### Source and Destination
3535

@@ -42,7 +42,7 @@ docker run -d --name mongo_source_destination -p 27017:27017 mongo
4242
```
4343

4444
### Sensor
45-
[HWPC Sensor](../sensors/hwpc-sensor.md) is used in order to get `HWPC Reports`. Start by installing the HWPC Sensor (see
45+
[HWPC Sensor](../sensors/hwpc-sensor.md) is used in order to get `HWPCReports`. Start by installing the HWPC Sensor (see
4646
[here](../sensors/hwpc-sensor.md#installation)) and start it (see
4747
[here](../sensors/hwpc-sensor.md#usage)).
4848

@@ -69,7 +69,7 @@ Below an example is provided by using MongoDB as Source and Destination.
6969
"stream": true,
7070
"input": {
7171
"puller": {
72-
"model": "HWPC Report",
72+
"model": "HWPCReport",
7373
"type": "mongodb",
7474
"uri": "mongodb://127.0.0.1",
7575
"db": "test",
@@ -79,7 +79,7 @@ Below an example is provided by using MongoDB as Source and Destination.
7979
"output": {
8080
"pusher_power": {
8181
"type": "mongodb",
82-
"model": "Power Report",
82+
"model": "PowerReport",
8383
"type": "mongodb",
8484
"uri": "mongodb://127.0.0.1",
8585
"db": "test",
@@ -124,8 +124,8 @@ the installation you use:
124124
docker run -t \
125125
--net=host \
126126
powerapi/powerapi --verbose \
127-
--input mongodb --model HWPC Report --uri mongodb://127.0.0.1 --db test --collection prep \
128-
--output mongodb --model Power Report --uri mongodb://127.0.0.1 --db test --collection results \
127+
--input mongodb --model HWPCReport --uri mongodb://127.0.0.1 --db test --collection prep \
128+
--output mongodb --model PowerReport --uri mongodb://127.0.0.1 --db test --collection results \
129129
--disable-dram-formula \
130130
--sensor-report-sampling-interval 500
131131
```
@@ -134,14 +134,14 @@ the installation you use:
134134

135135
```sh
136136
python -m powerapi --verbose \
137-
--input mongodb --model HWPC Report --uri mongodb://127.0.0.1 --db test --collection prep \
138-
--output mongodb --model Power Report --uri mongodb://127.0.0.1 --db test --collection results \
137+
--input mongodb --model HWPCReport --uri mongodb://127.0.0.1 --db test --collection prep \
138+
--output mongodb --model PowerReport --uri mongodb://127.0.0.1 --db test --collection results \
139139
--disable-dram-formula \
140140
--sensor-report-sampling-interval 500
141141
```
142142

143143
???+ info "Estimations' Storage"
144-
Your `Power Reports` will be stored on MongoDB.
144+
Your `PowerReports` will be stored on MongoDB.
145145

146146
???+ tip "Using shortcuts for parameters' names"
147147
You use `-` instead of `--`.

‎docs/reference/formulas/smartwatts.md

Lines changed: 166 additions & 559 deletions
Large diffs are not rendered by default.

‎docs/reference/formulas/smartwatts.md.save

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ You can use [the following script](../script/smartwatts_install.sh) to install S
3939

4040
## Usage
4141

42-
For running the SmartWatts Formula you need: a Source and a Destination, a Sensor that provides `HWPC Reports` and a configuration.
42+
For running the SmartWatts Formula you need: a Source and a Destination, a Sensor that provides `HWPCReports` and a configuration.
4343

4444
### Source and Destination
4545
For running SmartWatts we are using MongoDB as Source and InfluxDB as Destination as dockers containers.
@@ -57,7 +57,7 @@ docker run -d --name influx_dest -p 8086:8086 influxdb:1.8
5757

5858

5959
### Sensor
60-
[HWPC Sensor](../sensors/hwpc-sensor.md) is used in order to get `HWPC Reports`. Start by installing the HWPC Sensor (see
60+
[HWPC Sensor](../sensors/hwpc-sensor.md) is used in order to get `HWPCReports`. Start by installing the HWPC Sensor (see
6161
[here](../sensors/hwpc-sensor.md#installation)) and start it (see
6262
[here](../sensors/hwpc-sensor.md#usage)).
6363

@@ -91,7 +91,7 @@ Below an example is provided by using MongoDB as Source and InfluxDB as Destinat
9191
"stream": true,
9292
"input": {
9393
"puller": {
94-
"model": "HWPC Report",
94+
"model": "HWPCReport",
9595
"type": "mongodb",
9696
"uri": "mongodb://127.0.0.1",
9797
"db": "test",
@@ -148,8 +148,8 @@ the installation you used:
148148
docker run -t \
149149
--net=host \
150150
powerapi/smartwatts-formula --verbose \
151-
--input mongodb --model HWPC Report --uri mongodb://127.0.0.1 --db test --collection prep \
152-
--output influxdb --model Power Report --uri 127.0.0.1 --port 8086 --db test_result \
151+
--input mongodb --model HWPCReport --uri mongodb://127.0.0.1 --db test --collection prep \
152+
--output influxdb --model PowerReport --uri 127.0.0.1 --port 8086 --db test_result \
153153
--cpu-base-freq 1900 \
154154
--cpu-error-threshold 2.0 \
155155
--disable-dram-formula \
@@ -161,8 +161,8 @@ the installation you used:
161161
```sh
162162
python -m smartwatts \
163163
--verbose \
164-
--input mongodb --model HWPC Report --uri mongodb://127.0.0.1 --db test --collection prep \
165-
--output influxdb --model Power Report --uri 127.0.0.1 --port 8086 --db test_result \
164+
--input mongodb --model HWPCReport --uri mongodb://127.0.0.1 --db test --collection prep \
165+
--output influxdb --model PowerReport --uri 127.0.0.1 --port 8086 --db test_result \
166166
--cpu-base-freq 1900 \
167167
--cpu-error-threshold 2.0 \
168168
--disable-dram-formula \
@@ -172,7 +172,7 @@ the installation you used:
172172

173173

174174
???+ info "Estimations' Storage"
175-
Your `Power Reports` will be stored on InfluxDB. You can watch them in a grafana by using the [following tutorial](../grafana/grafana.md).
175+
Your `PowerReports` will be stored on InfluxDB. You can watch them in a grafana by using the [following tutorial](../grafana/grafana.md).
176176

177177
???+ tip "Using shortcuts for parameters' names"
178178
You use `-` instead of `--`.

‎docs/reference/grafana/grafana.md

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,20 @@
22

33
Here it is explained how to visualize the power estimation computed by a Formula on a Grafana dashboard to obtain this kind of visualisation:
44

5-
![Visualization by process](../../assets/images/reference/grafana/viz_by_process.png){ width="1000px"}
6-
7-
<!--img
5+
<img
86
src="https://powerapi.org/assets/images/reference/grafana/viz_by_process.png"
9-
alt="viz_by_process" width="1000px"-->
10-
11-
This screenshot shows the visualisation of power consumption of a `Firefox` web browser and tools used for monitoring (MongoDB, InfluxDB, Sensor, Formula)
7+
alt="viz_by_process" width="1000px">
128

13-
In this tutorial, we describe how to connect a Formula to a Grafana instance by using InfluxDB 2.X as output for Power Report.
14-
Then, we will see how to configure Grafana to visualize the power estimation computed by the Formula.
9+
This screenshot shows the visualisation of power consumption of a Web browser and tools used for monitoring (Source, Destination, Sensor, Formula)
1510

16-
This tutorial assumes that you know how launch a Formula and a Sensor to compute power estimation and that you have an InfluxDB 2.X running on your local machine.
11+
In this tutorial, we describe how to connect a Formula to a Grafana instance by using InfluxDB 2.X as Destination.
12+
Then, we will see how to configure Grafana to visualize the power estimation computed by the Formula.
1713

18-
The InfluxDB 2.X instances listen on port `8086` by default.
14+
This tutorial assumes that you know how launch a Formula and a Sensor to compute power estimation and that you have an InfluxDB 2.X and a Grafana instances running on your local machine.
15+
The InfluxDB 2.X instance listen on port `8086`.
1916

2017
## Setup Grafana
2118

22-
The default installation is done through Docker container.
23-
The different images can be found on the [Docker Hub](https://hub.docker.com/r/grafana/grafana)
24-
25-
Here is an example to deploy the latest image version available.
2619
```sh
2720
docker run -d -p 3000:3000 grafana/grafana
2821
```
@@ -31,40 +24,49 @@ After the launch, Grafana will be available at http://localhost:3000. On the sig
3124

3225
## Connect Grafana to the InfluxDB 2.X instance
3326

34-
Follow [this documentation](https://grafana.com/docs/grafana/latest/datasources/influxdb/#configure-the-data-source) in order to add InfluxDB as a DataSource.
35-
Be carefull to use the documentation matching your Grafana version.
27+
Connect to your Grafana instance and go to the `"Data sources"`` section (in the configuration part of the side bar).
3628

29+
<img
30+
src="https://powerapi.org/assets/images/reference/grafana/grafana_home.png"
31+
alt="grafana_home" width="300px">
3732

38-
## Visualize the power consumption on a dashboard in real-time
33+
Click on the `"Add new data source"` button and select `"InfluxDB"`. Enter:
34+
35+
1. A data source *Name* (here we choose "InfluxDB-2"),
36+
2. A *Query Language*, i.e., `InfluxQL`
37+
3. An instance *URL* (`http://localhost:8086`)
38+
4. A *Custom HTTP Header* called `Authorization` with Value `Token <mytoken>`, where `<mytoken>` is the token provided by InfluxDB 2.X for your organization.
39+
5. A *Database* name, (here we choose `power_consumption`) that is the `db` value of your destination defined in your formula configuration.
40+
41+
Then click on the `"Save & test"` button. *User* and *Password* are not required as we use a token for authentification.
3942

40-
1. Go to the `"Dashboard"` section on the side bar and select on `New > New dashboard`
41-
2. Then click on `+ Add visualisation`
42-
3. Then select the previously added datasource as data source
4343

44-
![Add Dashboard](../../assets/images/reference/grafana/add_dashboard.png){ width="1000px"}
44+
<img
45+
src="https://powerapi.org/assets/images/reference/grafana/add_db.png"
46+
alt="add_db" width="400px">
4547

46-
<!--img
48+
## Visualize the power consumption on a dashboard in real-time
49+
50+
Go to the `"Dashboard"` section on the side bar and select on `New > New dashboard`. Then click on `+ Add visualisation` Then select `influxdb-2` as data source.
51+
52+
<img
4753
src="https://powerapi.org/assets/images/reference/grafana/add_dashboard.png"
48-
alt="add_dashboard" width="1000px"-->
54+
alt="add_dashboard" width="1000px">
4955

50-
4. Click on the query edition button (the one with a pencil on it) and write the following query on the `Query` field to request the power estimations from the InfluxDB 2.X measurement:
56+
Click on the query edition button (the one with a pencil on it) and write the following query on the `Query` field to request the power estimations from the InfluxDB 2.X measurement:
5157

5258
```sql
5359
SELECT power FROM "power_consumption" GROUP BY target
5460
```
5561

5662
Then write `$tag_target` on the `ALIAS BY` field to label each graph with the target name
5763

58-
![Add query by process](../../assets/images/reference/grafana/add_query_by_process.png){ width="1000px"}
59-
60-
<!--img
64+
<img
6165
src="https://powerapi.org/assets/images/reference/grafana/add_query_by_process.png"
62-
alt="add_query_by_process" width="600px"-->
66+
alt="add_query_by_process" width="600px">
6367

6468
To display the power consumption in real time, you can update the range of the visualisation to `last 5 minutes` and the `refresh dashboard` parameter to `5s`. This parameter are on the top-right corner of the UI.
6569

66-
![Change the refresh interval](../../assets/images/reference/grafana/refresh.png){ width="1000px"}
67-
68-
<!--img
70+
<img
6971
src="https://powerapi.org/assets/images/reference/grafana/refresh.png"
70-
alt="refresh" width="600px"-->
72+
alt="refresh" width="600px">

‎docs/reference/overview.md

Lines changed: 37 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,63 @@
11
# PowerAPI Overview
22

3-
This project aims to offer a range of tools to promote greener computing. The focus is on creating software-defined PowerMeters to measure the power consumption of various programs.
4-
At the heart of this initiative is the [PowerAPI](https://github.com/powerapi-ng/powerapi) toolkit, which facilitates the development of these PowerMeters.
3+
The goal of this project is to provide a set of tools to go forward a greener
4+
computing.
5+
The idea is to provide software-defined PowerMeters to mesure the power
6+
consumption of programs.
7+
The core of this project is the [PowerAPI](https://github.com/powerapi-ng/powerapi) toolkit for building
8+
such PowerMeters.
9+
10+
511

612
## Software PowerMeters
713

8-
A software PowerMeter is an application built using PowerAPI components, designed to measure the power consumption of software running on a single machine or across a cluster of machines.
14+
A software PowerMeter is an application built with the PowerAPI components that can
15+
measure the power consumption of software running on a single machine or on a
16+
cluster of machine.
917

10-
The diagram below illustrates the overall architecture of a PowerMeter within the PowerAPI framework.
18+
The Figure below depicts the global architecture of a software PowerMeter in PowerAPI.
1119

1220
![PowerAPI Architecture Overview](../assets/images/reference/overview/global-architecture.jpg){ width="1000px"}
1321

14-
A PowerMeter consists of two essential components:
1522

16-
- a [Sensor](#Sensor), which collects system usage metrics and generates usage reports.
17-
- a [Formula](#Formula), which applies a computational model to the usage reports, producing power consumption data (in watts).
23+
<!--img
24+
src="assets/images/intro/global-architecture.png"
25+
alt="PowerMeter Architecture" width="1000px"-->
1826

19-
Additionally, [Preprocessors](./overview.md#Preprocessors) can be utilized to modify usage reports before they are processed by the Formula.
27+
A PowerMeter has two components, a Sensor and a Formula, used to
28+
produce an estimation of the power consumption of a monitored software.
2029

2130
## Sensor
2231

23-
The Sensor is a standalone software tool that gathers basic data related to the power usage of the software it monitors.
24-
25-
It collects this data by querying the hardware on the same machine where the monitored software runs. The Sensor needs to operate in parallel to the monitored software for the entire duration of its execution.
32+
The Sensor is an independent software that collects raw data (metrics) correlated with the power consumption of the
33+
monitored software.
2634

27-
The raw data collected is then stored as usage Reports in various formats, either locally or remotely. These formats include CSV, MongoDB, FileDB, and UNIX sockets, among others.
35+
Data are collected by querying the hardware’s machine that hosts the monitored
36+
software. The sensor must be executed on the same machine as the monitored
37+
software. The data are collected throughout the duration of the software. For
38+
this reason, the sensor must operate in parallel.
2839

29-
### Existing Sensors
40+
Collected raw data are stored in an external Source to make the data available to
41+
the Formula. This Source may be hosted on an other machine.
3042

31-
| Sensor | Documentation | Repository | Description | Supported |
32-
| :---------------: |----------------------|--------------------------|----------------|---------------|
33-
| HWPC | [HWPC Documentation](./sensors/hwpc-sensor.md) | [Github](https://github.com/powerapi-ng/hwpc-sensor) | Hardware Performance Counters monitoring agent for containers | :material-check: Supported |
43+
### Usage
3444

45+
Currently, PowerAPI proposes one Sensor: [HWPC](sensors/hwpc-sensor.md).
46+
Refer to the Sensor documentation to know how to use it.
3547

3648
## Formula
3749

38-
A Formula is a computational module that estimates the power consumption of the monitored software using the data collected by the Sensor.
39-
40-
There are two modes in which a Formula can operate:
41-
42-
- **Stream mode**: In this mode, the Formula processes data from the Sensor as it is generated, providing real-time insights
43-
44-
- **Post-mortem mode**: In this mode, the Formula analyzes data that has already been collected by the Sensor during a previous monitoring phase
45-
46-
### Existing Formulas
47-
48-
| Formula | Documentation | Repository | Description | Supported |
49-
| :---------------: |----------------------|--------------------------|----------------|---------------|
50-
| SmartWatts | [SmartWatts Documentation](./formulas/smatwatts.md) | [Github](https://github.com/powerapi-ng/smartwatts-formula) | HSmartWatts is a formula for a self-adaptive software-defined power meter based on the PowerAPI framework. | :material-check: Supported |
51-
52-
## Processors
53-
54-
Processors allow for the customized filtering and modification of Reports. While optional, they offer additional flexibility, but Software PowerMeters can still function without them.
55-
56-
The diagram below shows where Processors are integrated into the architecture of a Software PowerMeter.
57-
58-
![Processor integration in the processing pipeline](../assets/images/reference/processors/processors.jpg)
50+
A Formula is a computational module that computes an estimation of the power
51+
consumption of monitored software from the data collected by the sensor.
5952

60-
### Preprocessors
53+
A Formula has two working modes:
6154

62-
Preprocessors are positioned between the [Sensor](./overview.md#Sensor) and the [Formula](./overview.md#Formula).
63-
Their role is to pre-process usage reports before the power consumption estimations are computed.
55+
- `stream` mode where the Formula read the data from the Sensor as they are
56+
produced (in realtime).
6457

65-
#### Existing Preprocessors
58+
- `post-mortem` mode where the Formula analyses the data already collected by the Sensor in a past monitoring phase.
6659

67-
| Preprocessor | Documentation | Repository | Description | Supported |
68-
| :---------------: |----------------------|--------------------------|----------------|---------------|
69-
| k8sPreprocessor | [k8sPreprocessor Documentation](./processors/processors.md#k8spreprocessor) | [Github](https://github.com/powerapi-ng/powerapi/tree/master/src/powerapi/processor/pre/k8s) | Add K8S Specific metadata to corresponding Reports | :material-check: Supported |
70-
| libvirt | [libvirtPreprocessor Documentation](.processors/processors.md#libvirt) | [Github](https://github.com/powerapi-ng/powerapi/tree/master/src/powerapi/processor/pre/libvirt) | Replace `libvirt ID` in Reports with `Open Stack UUID` | :material-check: Supported |
60+
### Usage
7161

62+
Currently, there is one Formula: [SmartWatts](formulas/smartwatts.md).
63+
Refer to the Formula documentation to know how to use it.

‎docs/reference/processors/processors.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
Processors enable customized filtering and/or modifications of `Reports`.
44
There are two kinds of processors:
55

6-
- `PreProcessors`: They are located between the `Puller` and the `Dispatcher`. They are supposed to pre-process the `HWPC Reports` before computing estimations.
7-
- `PostProcessors`: They are located between, the `Formula` and the `Pusher`. They process `Power Reports` before storing them on the output storage option.
6+
- `PreProcessors`: They are located between the `Puller` and the `Dispatcher`. They are supposed to pre-process the `HWPCReports` before computing estimations.
7+
- `PostProcessors`: They are located between, the `Formula` and the `Pusher`. They process `PowerReports` before storing them on the `Destination`.
88

99
Figure below depicts where are they introduced in the architecture of a Software `PowerMeters`.
1010

@@ -60,8 +60,8 @@ As notice, a `PreProcessor` is defined inside the `pre-processor` group. In this
6060
docker run -t \
6161
--net=host \
6262
powerapi/smartwatts-formula --verbose \
63-
--input mongodb --model HWPC Report --uri mongodb://127.0.0.1 --db test --collection prep \
64-
--output influxdb --model Power Report --uri 127.0.0.1 --port 8086 --db test_result \
63+
--input mongodb --model HWPCReport --uri mongodb://127.0.0.1 --db test --collection prep \
64+
--output influxdb --model PowerReport --uri 127.0.0.1 --port 8086 --db test_result \
6565
{==--pre-processor k8s --name p1 --api-mode local --puller puller==} \
6666
--cpu-base-freq 1900 \
6767
--cpu-error-threshold 2.0 \
@@ -74,8 +74,8 @@ As notice, a `PreProcessor` is defined inside the `pre-processor` group. In this
7474
```sh
7575
python -m smartwatts \
7676
--verbose \
77-
--input mongodb --model HWPC Report --uri mongodb://127.0.0.1 --db test --collection prep \
78-
--output influxdb --model Power Report --uri 127.0.0.1 --port 8086 --db test_result \
77+
--input mongodb --model HWPCReport --uri mongodb://127.0.0.1 --db test --collection prep \
78+
--output influxdb --model PowerReport --uri 127.0.0.1 --port 8086 --db test_result \
7979
{==--pre-processor k8s --name p1 --api-mode local --puller puller==} \
8080
--cpu-base-freq 1900 \
8181
--cpu-error-threshold 2.0 \
@@ -96,12 +96,12 @@ As notice, a `PreProcessor` is defined inside the `pre-processor` group. In this
9696
-e POWERAPI_CPU_ERROR_THRESHOLD=2.0 \
9797
-e POWERAPI_DISABLE_DRAM_FORMULA=true \
9898
-e POWERAPI_SENSOR_REPORTS_FREQUENCY=1000 \
99-
-e POWERAPI_INPUT_PULLER_MODEL=HWPC Report \
99+
-e POWERAPI_INPUT_PULLER_MODEL=HWPCReport \
100100
-e POWERAPI_INPUT_PULLER_TYPE=mongodb \
101101
-e POWERAPI_INPUT_PULLER_URI=mongodb://127.0.0.1 \
102102
-e POWERAPI_INPUT_PULLER_DB=test \
103103
-e POWERAPI_INPUT_PULLER_COLLECTION=prep \
104-
-e POWERAPI_OUTPUT_PUSHER_POWER_MODEL=Power Report \
104+
-e POWERAPI_OUTPUT_PUSHER_POWER_MODEL=PowerReport \
105105
-e POWERAPI_OUTPUT_PUSHER_POWER_TYPE=influxdb \
106106
-e POWERAPI_OUTPUT_PUSHER_POWER_URI=127.0.0.1 \
107107
-e POWERAPI_OUTPUT_PUSHER_POWER_PORT=8086 \
@@ -121,12 +121,12 @@ As notice, a `PreProcessor` is defined inside the `pre-processor` group. In this
121121
export POWERAPI_CPU_ERROR_THRESHOLD=2.0
122122
export POWERAPI_DISABLE_DRAM_FORMULA=true
123123
export POWERAPI_SENSOR_REPORTS_FREQUENCY=1000
124-
export POWERAPI_INPUT_PULLER_MODEL=HWPC Report
124+
export POWERAPI_INPUT_PULLER_MODEL=HWPCReport
125125
export POWERAPI_INPUT_PULLER_TYPE=mongodb
126126
export POWERAPI_INPUT_PULLER_URI=mongodb://127.0.0.1
127127
export POWERAPI_INPUT_PULLER_DB=test
128128
export POWERAPI_INPUT_PULLER_COLLECTION=prep
129-
export POWERAPI_OUTPUT_PUSHER_POWER_MODEL=Power Report
129+
export POWERAPI_OUTPUT_PUSHER_POWER_MODEL=PowerReport
130130
export POWERAPI_OUTPUT_PUSHER_POWER_TYPE=influxdb
131131
export POWERAPI_OUTPUT_PUSHER_POWER_URI=127.0.0.1
132132
export POWERAPI_OUTPUT_PUSHER_POWER_PORT=8086
@@ -140,15 +140,15 @@ As notice, a `PreProcessor` is defined inside the `pre-processor` group. In this
140140

141141
### Example of Usage with SmartWatts Formula via a Configuration File
142142

143-
Below an example is provided by using MongoDB as input and InfluxDB as output.
143+
Below an example is provided by using MongoDB as Source and InfluxDB as Destination.
144144

145145
```json
146146
{
147147
"verbose": true,
148148
"stream": true,
149149
"input": {
150150
"puller": {
151-
"model": "HWPC Report",
151+
"model": "HWPCReport",
152152
"type": "mongodb",
153153
"uri": "mongodb://127.0.0.1",
154154
"db": "test",

‎docs/reference/reports/basis-reports.schema.json

Lines changed: 0 additions & 32 deletions
This file was deleted.

‎docs/reference/reports/reports.md

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,56 +2,59 @@
22

33
PowerAPI toolkit is modular, which means any sensor can be plugged to any monitoring
44
tool as long as the needed information is provided.
5-
We fixed the way of encoding the information. Those encoding are called `Reports`.
5+
We fixed the way of encoding the information. Those encoding are called reports.
66

77
A report type specify the `json` fields that has to be provided to pass information of
88
a certain kind. All reports types have a common basis:
99

1010

11-
- `timestamp`: at the [format](https://en.wikipedia.org/wiki/ISO_8601) "YYYY-MM-DDThh\:mm\:ss\.sss". The timestamp indicates when the data was collected, not when it was processed.
11+
- `timestamp`: at the format "year-month-dayThour:minutes:seconds". The
12+
timestamp reflects the time at which the information correspond, not the
13+
time the information was computed.
14+
For example if a power consumption of a CPU is measured at time `t` and used to
15+
determine the power consumption of a `cgroup` in a `PowerReport`, this report
16+
has timestamp `t`.
1217

13-
- `target`: The target refers to the entity being measured. For example, if a report contains data related to a specific program, domain, or other entity, the target identifies that subject. In this context, it corresponds to the cgroup name.
18+
- `target`: the target is the subject of the measure. For example if
19+
you produce a report that contain information relative to a program, domain,
20+
etc., the target refers to it. It corresponds to the `cgroup` name.
1421

1522
- `sensor`: it's a name field that is used to identify the reports produced by or computed thanks to a sensor.
1623

17-
Therefore, a report shall match the following description:
24+
Therefore, a report have the following format:
1825

19-
```json
20-
{
26+
```json
2127
"timestamp":$timestamp,
2228
"target":$target,
2329
"sensor":$sensor,
2430
$report_specific_fields
25-
}
26-
```
27-
28-
A valid JSON-Schema to can be found [here](https://raw.githubusercontent.com/powerapi-ng/powerapi-ng.github.io/refs/heads/master/docs/reference/reports/basis-reports.schema.json).
2931

32+
```
3033
In the following sections we specify the `$report_specific_fields` for each type of report.
3134

3235
## HWPC Reports
3336

34-
A `HWPC Report` is used to report performance counters and RAPL.
37+
A `HWPCReport` is used to report performance counters and RAPL.
3538
Its specific fields are the following:
3639

3740
- `groups`: a list of subreport that can be of three kind, `rapl`, `core` and
3841
`msr`.
3942

4043
Each group is represented in the same way:
4144

42-
```json
45+
```json
4346
{
4447
$type: {
4548
$core_number : {
4649
$socket_number : {
47-
Each counter name and their measured value for the type/core_number/socket_number considered triplet
50+
List of counter and their value
4851
}
4952
}
5053
}
5154
}
52-
```
55+
```
5356

54-
Below you can find an example of `HWPC Report`:
57+
Below you can find an example of `HWPCReport`:
5558

5659
```json
5760
{
@@ -120,12 +123,12 @@ Below you can find an example of `HWPC Report`:
120123

121124
## Power Reports
122125

123-
A `Power Report` is used to transfer information about power consumption estimations.
126+
A `PowerReport` is used to transfer information about power consumption estimations.
124127
Its specific fields are the following:
125128

126129
- `power`: a power value in Watts.
127130

128-
Below you find an exemple of `Power Report`:
131+
Below you find an exemple of `PowerReport`:
129132

130133
```json
131134
{

‎docs/reference/sensors/hwpc-sensor.md

Lines changed: 111 additions & 246 deletions
Large diffs are not rendered by default.

‎docs/script/getting_started.tar.gz

-17.7 KB
Binary file not shown.

‎docs/script/getting_started/.env

Whitespace-only changes.

‎docs/script/getting_started/cpu.csv

Lines changed: 0 additions & 1857 deletions
This file was deleted.

‎docs/script/getting_started/docker-compose.yaml

Lines changed: 0 additions & 85 deletions
This file was deleted.

‎docs/script/getting_started/env_template

Lines changed: 0 additions & 23 deletions
This file was deleted.

‎docs/script/getting_started/formula/smartwatts-mongodb-csv.json

Lines changed: 0 additions & 27 deletions
This file was deleted.

‎docs/script/getting_started/sensor/hwpc-mongodb.json

Lines changed: 0 additions & 37 deletions
This file was deleted.

‎docs/script/getting_started/start.py

Lines changed: 0 additions & 334 deletions
This file was deleted.

‎docs/script/smartwatts_auto_config.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ echo "
1717
"stream": true,
1818
"input": {
1919
"puller": {
20-
"model": "HWPC Report",
20+
"model": "HWPCReport",
2121
"type": "socket",
2222
"uri": "127.0.0.1",
2323
"port": 8080,

‎mkdocs.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ nav:
8484
- Formulas:
8585
#- RAPL: reference/formulas/rapl.md
8686
- SmartWatts: reference/formulas/smartwatts.md
87-
#- Configuration Files: reference/formulas/configuration_files.md
88-
# - Sources/Destinations:
89-
# - Description: reference/database/sources_destinations.md
87+
- Configuration Files: reference/formulas/configuration_files.md
88+
- Sources/Destinations:
89+
- Description: reference/database/sources_destinations.md
9090
- Processors:
9191
- Description: reference/processors/processors.md
9292
- Reports:

0 commit comments

Comments
 (0)
Please sign in to comment.