|
|
|
@ -8,6 +8,32 @@ The process runs in background and can be controlled with a set of sargraph sub- |
|
|
|
The tool can use "gnuplot" to optionally plot the data it collected. |
|
|
|
The tool can use "gnuplot" to optionally plot the data it collected. |
|
|
|
Supported plot formats are PNG, SVG and ASCII, they are determined by filename extensions. |
|
|
|
Supported plot formats are PNG, SVG and ASCII, they are determined by filename extensions. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Install requirements |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The sargraph requires `gnuplot`, `sysstat` (`sar`), `python3`, `coreutils` and `screen` to operate. |
|
|
|
|
|
|
|
In Debian you can install as: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
# install system dependencies |
|
|
|
|
|
|
|
apt-get update |
|
|
|
|
|
|
|
apt-get install -qqy --no-install-recommends \ |
|
|
|
|
|
|
|
coreutils \ |
|
|
|
|
|
|
|
git \ |
|
|
|
|
|
|
|
gnuplot-nox \ |
|
|
|
|
|
|
|
python3 \ |
|
|
|
|
|
|
|
python3-pip \ |
|
|
|
|
|
|
|
screen \ |
|
|
|
|
|
|
|
sysstat |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# install Python dependencies |
|
|
|
|
|
|
|
pip3 install -r requirements.txt |
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
For rendering HTML plots, you additionally have to install: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
pip3 install git+https://github.com/antmicro/servis#egg=servis[bokeh] |
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
# Example graph |
|
|
|
# Example graph |
|
|
|
|
|
|
|
|
|
|
|
@ -16,53 +42,88 @@ Supported plot formats are PNG, SVG and ASCII, they are determined by filename e |
|
|
|
|
|
|
|
|
|
|
|
# Usage |
|
|
|
# Usage |
|
|
|
All sargraph commands use the following pattern: |
|
|
|
All sargraph commands use the following pattern: |
|
|
|
|
|
|
|
|
|
|
|
``` |
|
|
|
``` |
|
|
|
$ ./sargraph.py [session_name] [command] [args...] |
|
|
|
$ ./sargraph.py [session_name] [command] [args...] |
|
|
|
``` |
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Let's create a sample disk on which we will run stress tests: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
dd if=/dev/zero of=sample_disk.ext4 bs=1M count=130 |
|
|
|
|
|
|
|
mkfs.ext4 sample_disk.ext4 |
|
|
|
|
|
|
|
mkdir -p ./mountpoint && mount sample_disk.ext4 ./mountpoint |
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
For the purpose of stress tests let's install `stress`: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
apt-get install stress |
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
## Starting a session |
|
|
|
## Starting a session |
|
|
|
|
|
|
|
|
|
|
|
Start a background session and name it `example`: |
|
|
|
Start a background session and name it `example`: |
|
|
|
``` |
|
|
|
``` |
|
|
|
$ ./sargraph.py example start |
|
|
|
./sargraph.py example start -m ./mountpoint |
|
|
|
``` |
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
The data will be saved in `example.txt`. |
|
|
|
The data will be saved in `example.txt`. |
|
|
|
Logs from screen will be written to `example.log`. |
|
|
|
Logs from screen will be written to `example.log`. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
`-m` flag allows to specify a chosen filesystem/mountpoint. |
|
|
|
|
|
|
|
|
|
|
|
## Adding a label |
|
|
|
## Adding a label |
|
|
|
|
|
|
|
|
|
|
|
Add labels that will be placed as comments in the collected dataset. |
|
|
|
Add labels that will be placed as comments in the collected dataset. |
|
|
|
They will be also visible on the plots: |
|
|
|
They will be also visible on the plots: |
|
|
|
``` |
|
|
|
``` |
|
|
|
$ ./sargraph.py example label "Compilation start" |
|
|
|
./sargraph.py example label "Compilation start" |
|
|
|
``` |
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
## Plotting a running session |
|
|
|
After this, let's simulate some processing: |
|
|
|
Plot data collected so far in a still running session: |
|
|
|
|
|
|
|
``` |
|
|
|
``` |
|
|
|
$ ./sargraph.py example save plot.svg |
|
|
|
pushd ./mountpoint |
|
|
|
|
|
|
|
stress -c 16 -i 1 -m 1 --vm-bytes 512M -d 1 --hdd-bytes 70M -t 160s |
|
|
|
|
|
|
|
popd |
|
|
|
``` |
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
## Plotting a closed session |
|
|
|
## Plotting a running session |
|
|
|
Plot data collected in a session that is not running anymore. |
|
|
|
|
|
|
|
|
|
|
|
It is possible to plot data collected so far in a still running session: |
|
|
|
``` |
|
|
|
``` |
|
|
|
$ ./sargraph.py example plot plot.ascii |
|
|
|
# Save plot to SVG |
|
|
|
|
|
|
|
./sargraph.py example save plot.svg |
|
|
|
|
|
|
|
# Save plot to PNG |
|
|
|
|
|
|
|
./sargraph.py example save plot.png |
|
|
|
|
|
|
|
# Save plot to ASCII that can be printed in terminal |
|
|
|
|
|
|
|
./sargraph.py example save plot.ascii |
|
|
|
|
|
|
|
# Save plot to interactive HTML plot |
|
|
|
|
|
|
|
./sargraph.py example save plot.html |
|
|
|
``` |
|
|
|
``` |
|
|
|
The command requires the `example.txt` log file to be present in the working directory. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Supported formats |
|
|
|
The supported formats are: |
|
|
|
|
|
|
|
|
|
|
|
Plots can be saved in: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* `png` format |
|
|
|
* `png` format |
|
|
|
* `svg` format |
|
|
|
* `svg` format |
|
|
|
|
|
|
|
* `html` format |
|
|
|
* `ascii` format - plot is rendered to text file that can be displayed in terminal |
|
|
|
* `ascii` format - plot is rendered to text file that can be displayed in terminal |
|
|
|
|
|
|
|
|
|
|
|
## Stopping a session |
|
|
|
## Stopping a session |
|
|
|
|
|
|
|
|
|
|
|
Stop a session and create a final `plot.png` plot file if no other plot was created so far: |
|
|
|
Stop a session and create a final `plot.png` plot file if no other plot was created so far: |
|
|
|
``` |
|
|
|
``` |
|
|
|
$ ./sargraph.py example stop |
|
|
|
./sargraph.py example stop |
|
|
|
``` |
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
The filename of the final plot can be changed if its placed after the `stop` command. |
|
|
|
The filename of the final plot can be changed if its placed after the `stop` command. |
|
|
|
If the name is `none` then no plot will be created. |
|
|
|
If the name is `none` then no plot will be created. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Plotting a closed session |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Plot data collected in a session that is not running anymore. |
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
./sargraph.py example plot plot.ascii |
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
The command requires the `example.txt` log file to be present in the working directory. |
|
|
|
|