smi.smi
get_mem(dir_prefix='/dev/shm' if sys.platform != 'win32' else '.')
The get_mem function is a wrapper around the go tool pprof command. It takes in an optional argument, dir_prefix, which defaults to /dev/shm. The function then runs the go tool pprof command with arguments -tags and dir_prefix/memory.prof, and returns its stdout as a string.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dir_prefix |
str
|
str: Specify the directory where |
'/dev/shm' if platform != 'win32' else '.'
|
Returns:
Type | Description |
---|---|
A string of the memory profile |
Source code in src/python/easydel/smi/smi.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
|
initialise_tracking(interval=0.5, dir_prefix='/dev/shm' if sys.platform != 'win32' else '.')
The initialise_tracking function starts a daemon thread that periodically saves the current memory profile to disk.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
interval |
float
|
float: Specify the time interval between each memory profile |
0.5
|
dir_prefix |
str
|
str: Specify the directory where the memory profile will be saved |
'/dev/shm' if platform != 'win32' else '.'
|
Returns:
Type | Description |
---|---|
None
|
Nothing, but it starts a thread that |
Source code in src/python/easydel/smi/smi.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
|
run(note_book=None, interval=1, dir_prefix='/dev/shm', dpr=True)
The run function is a simple wrapper around the go tool pprof command. It runs the command every interval seconds and prints out its output to stdout. If you are running this in a notebook, it will print to IPython's display instead of stdout.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
note_book |
Determine whether the program is running in a notebook or not |
None
|
|
interval |
float
|
float: Specify the time interval between each refresh |
1
|
dir_prefix |
str
|
str: Specify the directory where the memory |
'/dev/shm'
|
dpr |
Control whether the output is displayed in a notebook or not |
True
|
Returns:
Type | Description |
---|---|
The output of the pprof command |
Source code in src/python/easydel/smi/smi.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
|