def run(self, test_id: str): setup_monitor() sample_id = monitor.start_duration_sample() rs = self._do_run(test_id) monitor.stop_duration_sample('client: cumulative time', sample_id) monitor.stop() print_test_results(rs)
def run_bare(): for _ in range(loops): do_work() def run_with_monitoring(): for _ in range(loops): sample_id = monitor.start_duration_sample() do_work() monitor.stop_duration_sample('test', sample_id) def print_readings(): me = resource.getrusage(resource.RUSAGE_SELF) elapsed = time.perf_counter() - start_time print(f"Time (seconds): {elapsed}") print(f"Max RSS (kB on Linux | bytes on MacOS): {me.ru_maxrss}") if __name__ == "__main__": if monitoring_on: init() run_with_monitoring() monitor.stop() else: run_bare() print_readings()
def worker_exit(servo, worker): monitor.stop()