当前位置: 首页>>代码示例>>Python>>正文


Python memory_profiler.profile方法代码示例

本文整理汇总了Python中memory_profiler.profile方法的典型用法代码示例。如果您正苦于以下问题:Python memory_profiler.profile方法的具体用法?Python memory_profiler.profile怎么用?Python memory_profiler.profile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在memory_profiler的用法示例。


在下文中一共展示了memory_profiler.profile方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: runprofilerandshow

# 需要导入模块: import memory_profiler [as 别名]
# 或者: from memory_profiler import profile [as 别名]
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(): ... 
开发者ID:lrq3000,项目名称:pyFileFixity,代码行数:29,代码来源:debug.py

示例2: testcaptcha

# 需要导入模块: import memory_profiler [as 别名]
# 或者: from memory_profiler import profile [as 别名]
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 
开发者ID:lrq3000,项目名称:pyFileFixity,代码行数:14,代码来源:debug.py

示例3: conditionalprofile

# 需要导入模块: import memory_profiler [as 别名]
# 或者: from memory_profiler import profile [as 别名]
def conditionalprofile():
    def resdec(f):
        if memprofilerexists:
            return profile(f)
        return f

    return resdec 
开发者ID:bbfrederick,项目名称:rapidtide,代码行数:9,代码来源:rapidtide2x.py

示例4: addmemprofiling

# 需要导入模块: import memory_profiler [as 别名]
# 或者: from memory_profiler import profile [as 别名]
def addmemprofiling(thefunc, memprofile, memfile, themessage):
    if memprofile:
        return profile(thefunc, precision=2)
    else:
        tide_util.logmem(themessage, file=memfile)
        return thefunc 
开发者ID:bbfrederick,项目名称:rapidtide,代码行数:8,代码来源:rapidtide2x.py


注:本文中的memory_profiler.profile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。