simpeg.utils.mem_profile_class#

simpeg.utils.mem_profile_class(input_class, *args)[source]#

Creates a new class from the target class with memory profiled methods.

Using memory_profiler.profile(), this function creates a wrapper class from the input class with the specified methods memory profiled.

Parameters:
input_classclass

Input class being used to create the wrapper

*argsstr

Method names that will be wrapped with a memory profiler. These names must correspond to methods of the input class.

Returns:
class

Memory profiled class.

Examples

>>> FooMem = mem_profile_class(Foo,'my_func')
>>> fooi = FooMem()
>>> for i in range(5):
>>>     fooi.my_func()

Then run it from the command line

python -m memory_profiler exampleMemWrapper.py