Performance Profiler is a real-time CPU and GPU performance monitor for Unix-like operating systems. Visually inspired by top, Performance Profiler shows CPU, GPU, and RAM utilizations with a bar-like style. At its core, this script is basically fancy parsers for /proc/stat, free, and nvidia-smi. It relies on curses for manipulating the terminal.
Performance Profiler shows popular system performance metrics alongside output by any arbitrary Python script. I wanted a simple and script-agnostic method for monitoring system behavior as I ran my experiments, particularly those that relied on GPUs.
Using the module is straightforward: after instantiating PerformanceProfiler
,
start()
creates a thread daemon to collect performance data, monitors data
available on stdout
by the script, and handles calls to curses
for writing
to the terminal; stop()
will, obviously, stop collecting performance metrics
and calls to curses
; deinit()
unloads curses
and restores original
terminal functionality.
To use Performance Profiler, simply git clone
this repo, import
the module,
and call the three functions above appropriately. A simple demo is shown at the
bottom of the script.