MCPcopy Create free account
hub / github.com/aws/aws-cli / benchmark_process

Method benchmark_process

scripts/performance/benchmark_utils.py:217–233  ·  view source on GitHub ↗
(self, pid, data_interval)

Source from the content-addressed store, hash-verified

215 """
216
217 def benchmark_process(self, pid, data_interval):
218 parent_pid = os.getpid()
219 try:
220 # Benchmark the process where the script is being run.
221 return self._run_benchmark(pid, data_interval)
222 except KeyboardInterrupt:
223 # If there is an interrupt, then try to clean everything up.
224 proc = psutil.Process(parent_pid)
225 procs = proc.children(recursive=True)
226
227 for child in procs:
228 child.terminate()
229
230 gone, alive = psutil.wait_procs(procs, timeout=1)
231 for child in alive:
232 child.kill()
233 raise
234
235 def _run_benchmark(self, pid, data_interval):
236 process_to_measure = psutil.Process(pid)

Callers 1

Calls 1

_run_benchmarkMethod · 0.95

Tested by

no test coverage detected