Track and save system resources consumption while YOUR function is running.
- per CPU (%),
- Network sent/recv,
- RAM,
- Timestamp.
performance.py
is main module that storesrecord_system_performance
function which do the work.
git clone https://github.com/patryklaskowski/Measure_System_Resources.git && \
cd Measure_System_Resources
python3.7 -m venv env && \
source env/bin/activate
python3.7 -m pip install -r requirements.txt
python3.7 test.py
On path there is new XLS Measure_System_Resources/performance_1610449879.xlsx
Great way is to add the path of /Measure_System_Resources to sys.path. This step helps python interpreter to find the tool.
import sys
tool_path = '/abolute/path/to/the/Measure_System_Resources'
sys.path.insert(0, tool_path)
from performance import record_system_performance
# The rest
# of your code
# ...
# The rest
# Of your code
# ...
import os
import time
# Your function to measure
def sleep_five_sec():
time.sleep(5)
# Path where XLS file will be saved
filename = f'performance_{round(time.time())}.xlsx'
cur_abspath = os.path.abspath(os.path.curdir)
path = os.path.join(cur_abspath, filename)
# show time
record_system_performance(path, sleep_five_sec, timeout=20, sleep_around=5, stop=False)
- Show example plots
- Describe
record_system_performance(path, sleep_five_sec, timeout=20, sleep_around=5, stop=False)
attributes - Thread should activate process with e.g. Event(). Now sleep_around is not symmetric.
- Describe measures from XLS