Python memory_profiler.profile() Examples
The following are 7
code examples of memory_profiler.profile().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
memory_profiler
, or try the search function
.
Example #1
Source File: debug.py From pyFileFixity with MIT License | 5 votes |
def runprofilerandshow(funcname, profilepath, argv='', *args, **kwargs): ''' Run a functions profiler and show it in a GUI visualisation using RunSnakeRun Note: can also use calibration for more exact results ''' functionprofiler.runprofile(funcname+'(\''+argv+'\')', profilepath, *args, **kwargs) print 'Showing profile (windows should open in the background)'; sys.stdout.flush(); functionprofiler.browseprofilegui(profilepath) #### DECORATOR FUNCTIONS #### ############################# # @profile: use profilehooks to profile functions # @profileit: profile using python's profile (works with threads) # @showprofile: show the functions profile in a nice GUI using RunSnakeRun (alternative: using the generated profile log files you can use pyprof2calltree and kcachegrind to get a lot more informations and interactive call graph) # @memorytrack: use Pympler to track and show memory usage (only console, no GUI) #@callgraph: save the call graph in text format and image (if GraphViz is available, more specifically the dot program) #@profile_linebyline: profile a function with line by line CPU consumption (using line_profiler, need to install it because it is compiled in C) #@memoryprofile_linebyline: memory profile a function with line by line memory consumption (using memory_profiler, needs psutils on Windows) # eg: # @showprofile # @profileit # def func(): ...
Example #2
Source File: debug.py From pyFileFixity with MIT License | 5 votes |
def testcaptcha(): import captchagenerator captcha = captchagenerator.CaptchaGenerator(True, True, debugPng=True, debug=False, nbElem=10, modelsPath='bammodels', windowWidth='320', windowHeight='240') #captcha.renderCaptcha('solmasks', 'solmasks') captcha.renderCaptchaMulti(4, 'solmasks', 'solmasks') #time.sleep(20) #@memoryprofile_linebyline #@profile_linebyline
Example #3
Source File: rapidtide2x.py From rapidtide with Apache License 2.0 | 5 votes |
def conditionalprofile(): def resdec(f): if memprofilerexists: return profile(f) return f return resdec
Example #4
Source File: rapidtide2x.py From rapidtide with Apache License 2.0 | 5 votes |
def addmemprofiling(thefunc, memprofile, memfile, themessage): if memprofile: return profile(thefunc, precision=2) else: tide_util.logmem(themessage, file=memfile) return thefunc
Example #5
Source File: rapidtideX.py From rapidtide with Apache License 2.0 | 5 votes |
def conditionalprofile(): def resdec(f): if memprofilerexists: return profile(f) return f return resdec
Example #6
Source File: rapidtideX.py From rapidtide with Apache License 2.0 | 5 votes |
def addmemprofiling(thefunc, memprofile, memfile, themessage): if memprofile: return profile(thefunc, precision=2) else: tide_util.logmem(themessage, file=memfile) return thefunc
Example #7
Source File: rapidtide2x_trans.py From rapidtide with Apache License 2.0 | 5 votes |
def conditionalprofile(): def resdec(f): if memprofilerexists: return profile(f) return f return resdec