Download tools/measure_rss.py from HelloSun/sdcpp_zimage_opt: direct link, hf CLI and curl.
- Browser
- Download file 491 Bytes
-
https://huggingface.co/HelloSun/sdcpp_zimage_opt/resolve/main/tools/measure_rss.py
- Command line
-
hf download hf://HelloSun/sdcpp_zimage_opt/tools/measure_rss.py
-
curl -L -o measure_rss.py https://huggingface.co/HelloSun/sdcpp_zimage_opt/resolve/main/tools/measure_rss.py
491 Bytes
| #!/usr/bin/env python3 | |
| """Run a command and report the peak RSS (GiB) and wall time of the process tree on stderr. | |
| usage: measure_rss.py <cmd> [args...] | |
| Exit code is the child's exit code. | |
| """ | |
| import resource | |
| import subprocess | |
| import sys | |
| import time | |
| t0 = time.time() | |
| rc = subprocess.call(sys.argv[1:]) | |
| peak_gib = resource.getrusage(resource.RUSAGE_CHILDREN).ru_maxrss / 1024 / 1024 | |
| print(f"EXIT={rc} PEAK_RSS={peak_gib:.2f} GiB WALL={time.time() - t0:.1f}s", file=sys.stderr) | |
| sys.exit(rc) | |