A lightweight bash profiling script to measure and analyze the performance, memory usage, and parallel efficiency of High-Performance Computing (HPC) and multithreaded applications.
Designed specifically for macOS (utilizing /usr/bin/time -l and sysctl), perf.sh provides an instant colorized report of how well your program utilizes system resources.
- Execution Time Tracking: Captures real (wall-clock), user, and system time.
- RAM Profiling: Accurately extracts the maximum resident set size (RSS) to report peak memory usage in Megabytes.
- Parallel Efficiency: Automatically calculates CPU utilization efficiency based on the number of available logical CPU cores.
- Visual Feedback: Colorized terminal output with efficiency grading (Excellent, Average, Poor) to quickly spot bottlenecks in OpenMP/MPI applications.
- macOS Environment: Relies on Apple's BSD version of
time(/usr/bin/time -l) andsysctl. - Basic UNIX utilities:
bc(for float calculations),awk,grep, andtr.
Simply prefix your standard execution command with ./perf.sh:
chmod +x perf.sh
./perf.sh ./your_program [arguments...]Sample Output:
==> Profilage de : ./test
Valeur de PI : 3.141593
Temps calculé par OpenMP : 0.812300 secondes
--------------------------------------------------
HPC PERFORMANCE REPORT
--------------------------------------------------
* Temps Réel (Wall-clock) : 0.82 s
* Temps CPU Total : 3.25 s
* Pic de RAM (RSS) : 2.15 Mo
* Coeurs utilisés (log) : 4
* Efficacité Parallèle : 99.08% (Excellent)
--------------------------------------------------