mirror of
https://github.com/Infinidat/infi.clickhouse_orm.git
synced 2024-11-28 19:53:44 +03:00
23 lines
578 B
Markdown
23 lines
578 B
Markdown
|
# CPU Usage
|
||
|
|
||
|
This basic example uses `psutil` to collect a simple time-series of per-CPU usage percent. It then prints out some aggregate statistics based on the collected data.
|
||
|
|
||
|
## Running the code
|
||
|
|
||
|
Create a virtualenv and install the required libraries:
|
||
|
```
|
||
|
virtualenv -p python3.6 env
|
||
|
source env/bin/activate
|
||
|
pip install -r requirements.txt
|
||
|
```
|
||
|
|
||
|
Run the `collect` script to populate the database with the CPU statistics. Let it run for a bit before pressing CTRL+C.
|
||
|
```
|
||
|
python collect.py
|
||
|
```
|
||
|
|
||
|
Run the `results` script to display the CPU statistics:
|
||
|
```
|
||
|
python results.py
|
||
|
```
|