nipype.utils.profiler module

Utilities to keep track of performance

class nipype.utils.profiler.ResourceMonitor(pid, freq=5, fname=None, python=True)

Bases: threading.Thread

A Thread to monitor a specific PID with a certain frequency to a file

property fname

Get/set the internal filename

run()

Core monitoring function, called by start()

stop()

Stop monitoring.

class nipype.utils.profiler.ResourceMonitorMock(pid, freq=5, fname=None, python=True)

Bases: object

A mock class to use when the monitor is disabled.

property fname

Get/set the internal filename

start()
stop()
nipype.utils.profiler.get_max_resources_used(pid, mem_mb, num_threads, pyfunc=False)

Function to get the RAM and threads utilized by a given process

Parameters:
  • pid (integer) – the process ID of process to profile

  • mem_mb (float) – the high memory watermark so far during process execution (in MB)

  • num_threads (int) – the high thread watermark so far during process execution

Returns:

  • mem_mb (float) – the new high memory watermark of process (MB)

  • num_threads (float) – the new high thread watermark of process

nipype.utils.profiler.get_system_total_memory_gb()

Function to get the total RAM of the running system in GB

nipype.utils.profiler.log_nodes_cb(node, status)

Function to record node run statistics to a log file as json dictionaries

Parameters:
  • node (nipype.pipeline.engine.Node) – the node being logged

  • status (string) – acceptable values are ‘start’, ‘end’; otherwise it is considered and error

Returns:

this function does not return any values, it logs the node status info to the callback logger

Return type:

None