pmark
python benchmarking utility
Requirements
- OS: macOS Maverics+ or Ubuntu 14.04+
- Python: v3.6.0+
- Tensorflow: v1.4.0+
What is pmark?
Pmark - "Python Benchmark" is a simple yet intutive process monitoring tool, which can monitor,
- CPU Usage
- RAM Usage
- GPU Usage (Supports only NVidia for now)
Architecture:
- A function with required arguments is sent to the utility.
- The function is sent as a target for a python Process, which shares statistics using a BaseManager.
- Required Monitors (CPU/GPU/RAM) are attached to the current process as threads.
- The attached monitors are given the main process
pid
which helps us in extracting consumption of resources by the process, thereby increasing the accuracy of monitoring process. - Each of the monitors supports interval configuration which can be overridden by benchmark interval.
- The threads for each monitor continues to run, untill main process is completed, once done, all the threads, including the main process are closed.
Installation
python3 -m pip install pmark
Usage
- Basic Usage
from pmark import pmonitor
import time
# Declare function and its body
@pmonitor
def random_function():
time.sleep(5)
x = [i**2 for i in range(1000)]
time.sleep(5)
# Call the function
random_function()
- Monitor Time
from pmark import ftimer
import time
# Declare function and its body
@ftimer
def random_function():
time.sleep(5)
x = [i**2 for i in range(1000)]
time.sleep(5)
# Call the function
random_function()
- Monitor Memory
from pmark import fmemory
# Declare function and its body
@fmemory
def random_function():
import time
time.sleep(5)
x = [i**2 for i in range(1000)]
time.sleep(5)
# Call the function
random_function()