schrodinger.test.performance.general module¶
General tools for performance tests.
- schrodinger.test.performance.general.get_process_name(process)¶
Pretty-print a psutil.Process object.
- schrodinger.test.performance.general.wait_for_successful_completion(process, timeout=300)¶
Wait until
processis complete.If recursive is true, also wait for all child processes to complete. If the process is still running after
timeout, kill it and all its children and raise an exception. If the exit code is not 0, raise an exception.- Parameters
process (psutil.Process or pid) – Process to watch, waiting for completion.
timeout (int) – Duration (in seconds) to wait for the process.
recursive (bool) – Should the child processes of
processbe monitored as well?
- schrodinger.test.performance.general.call_in_loop(func, iterations, *args, **kwargs)¶
Calls function repeatedly to normalize test data.
- schrodinger.test.performance.general.wait_and_monitor_usage(process, timeout=300, timeslice=0.1)¶
Wait until
processis complete. Query maxrss and cpu time used by the process and its children every so often (let the process to run fortimesliceseconds between observations).If the process is still running after
timeout, kill it and all its children and raise an exception. If the exit code is not 0, raise an exception.Returns maxrss (in megabytes) and cpu time (in seconds).
- Parameters
process (psutil.Process or pid) – Process to watch, waiting for completion.
timeout (float) – Duration (in seconds) to wait for the process.
timeslice (float) – Interval (in seconds) between observations.
- Return type
(int, float)
- Returns
Max RSS (in megabytes) and CPU time (user, in seconds).