diff --git a/README.md b/README.md index 1e2a685..0d4ea52 100644 --- a/README.md +++ b/README.md @@ -2,37 +2,59 @@ Copyright (c) 2019-2022 [Antmicro](https://www.antmicro.com) -This is a simple python tool that uses "sysstat" ("sar") and "gnuplot" to plot cpu and ram usage. +This is a simple python tool that uses "sysstat" ("sar") to save information on CPU, RAM and disk usage. +The process runs in background and can be controlled with a set of sargraph sub-commands. + +The tool can use "gnuplot" to optionally plot the data it collected. +Supported plot formats are PNG and SVG, they are determined by filenames. + + +# Example graph + +![graph](graph.png) + # Usage +All sargraph commands use the following pattern: +``` +$ ./sargraph.py [session_name] [command] [args...] +``` + +## Starting a session +Start a background session and name it `example`: ``` -$ python sargraph.py [session_name] [command] [arg] +$ ./sargraph.py example start ``` -Background use (requires "screen" tool): +The data will be saved in `example.txt`. +Logs from screen will be written to `example.log`. +## Adding a label +Add labels that will be placed as comments in the collected dataset. +They will be also visible on the plots: ``` -$ python3 sargraph.py chart start -$ sleep 1 -$ python3 sargraph.py chart label "label1" -$ sleep 1 -$ python3 sargraph.py chart label "label2" -$ sleep 1 -$ python3 sargraph.py chart stop +$ ./sargraph.py example label "Compilation start" ``` -Or just: +## Plotting a running session +Plot data collected so far in a still running session: ``` -$ python3 sargraph.py -# wait 1 sec -# type label1\n -# wait 1 sec -# type label2\n -# wait 1 sec -# type q\n -# wait until sargraph generates plot.png +$ ./sargraph.py example save plot.svg ``` -# Example graph +## Plotting a closed session +Plot data collected in a session that is not running anymore. +``` +$ ./sargraph.py example plot plot.png +``` +The command requires the `example.txt` log file to be present in the working directory. + +## Stopping a session +Stop a session and create a final `plot.png` plot file if no other plot was created so far: +``` +$ ./sargraph.py example stop +``` + +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. -![graph](graph.png)