This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def measure_memory_usage(target_call, target_args, log_filename=None, memory_denominator=1024.0**2, memory_usage_refresh=0.005): | |
""" | |
measure the memory usage of a function call in python.\n | |
Note: one may have to restart python to get accurate results.\n | |
:param target_call: function to be tested\n | |
:param target_args: arguments of the function in a tuple\n | |
:param memory_usage_refresh: how frequent the memory is measured, default to 0.005 seconds\n | |
:return: max memory usage in kB (on Linux/Ubuntu 14.04), may depend on OS | |
""" | |
import time |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def SomeLongRunningLibraryCall(arg1, arg2): | |
import time | |
max_dict_entries = 2500 | |
delay_per_entry = .005 | |
some_large_dictionary = {} | |
dict_entry_count = 0 | |
while(1): |