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


Python LineProfiler.dump_stats方法代码示例

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


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

示例1: wrapper

# 需要导入模块: from line_profiler import LineProfiler [as 别名]
# 或者: from line_profiler.LineProfiler import dump_stats [as 别名]
 def wrapper(*args, **kwargs):
     # Don't profile if debugging is off (PROD server mode)
     if DEBUG:
         logger.error('Line Profiling (@profile_this_by_line) ' + func.__name__ + '() to ' + stats_filename + '.')
         profiler = LineProfiler()
         profiled_func = profiler(func)
         try:
             retval = profiled_func(*args, **kwargs)
         finally:
            # profiler.print_stats()
             profiler.dump_stats(stats_filename)
     else:
         logger.error('Line Profiling (@profile_this_by_line) attempted on ' + func.__name__ + '() while in production mode.  Profiling Bypassed.')
         retval = func(*args, **kwargs)
     return retval
开发者ID:iamyogesh,项目名称:foodem,代码行数:17,代码来源:models.py

示例2: main

# 需要导入模块: from line_profiler import LineProfiler [as 别名]
# 或者: from line_profiler.LineProfiler import dump_stats [as 别名]
def main():
    profiler = cProfile.Profile()

    profiler.enable()
    function_runner('original_method')
    function_runner('step_one')
    function_runner('step_two')
    function_runner('step_three')
    function_runner('step_four')
    function_runner('step_five')
    function_runner('step_six')
    function_runner('step_seven')
    function_runner('step_eight')
    function_runner('step_nine')
    function_runner('current')
    profiler.disable()

    profiler.dump_stats('function_event.stats')
    line_profiler = LineProfiler(CurrentFunctionContainer().current)
    line_profiler.enable()
    function_runner('current')
    line_profiler.disable()
    line_profiler.dump_stats('function_event.line_stats')
    line_profiler.print_stats()

    print 'Original', timeit.timeit(
        lambda: function_runner('original_method'), number=7)
    print 'One', timeit.timeit(
        lambda: function_runner('step_one'), number=7)
    print 'Two', timeit.timeit(
        lambda: function_runner('step_two'), number=7)
    print 'Three', timeit.timeit(
        lambda: function_runner('step_three'), number=7)
    print 'Four', timeit.timeit(
        lambda: function_runner('step_four'), number=7)
    print 'Five', timeit.timeit(
        lambda: function_runner('step_five'), number=7)
    print 'Six', timeit.timeit(
        lambda: function_runner('step_six'), number=7)
    print 'Seven', timeit.timeit(
        lambda: function_runner('step_seven'), number=7)
    print 'Eight', timeit.timeit(
        lambda: function_runner('step_eight'), number=7)
    print 'Nine', timeit.timeit(
        lambda: function_runner('step_nine'), number=7)
    print 'Current', timeit.timeit(
        lambda: function_runner('current'), number=7)
开发者ID:enthought,项目名称:pikos,代码行数:49,代码来源:function_events.py

示例3: LineProfiler

# 需要导入模块: from line_profiler import LineProfiler [as 别名]
# 或者: from line_profiler.LineProfiler import dump_stats [as 别名]
        properties[i].append(objects[j].moments_hu())
        properties[i].append(objects[j].image())
        properties[i].append(objects[j].label)
        properties[i].append(objects[j].major_axis_length())
        properties[i].append(objects[j].max_intensity())
        properties[i].append(objects[j].mean_intensity())
        properties[i].append(objects[j].min_intensity())
        properties[i].append(objects[j].minor_axis_length())
        properties[i].append(objects[j].moments())
        properties[i].append(objects[j].moments_normalized())
        properties[i].append(objects[j].orientation())
        properties[i].append(objects[j].perimeter())
        properties[i].append(objects[j].solidity())
        properties[i].append(objects[j].weighted_moments_central())
        properties[i].append(objects[j].weighted_centroid())
        properties[i].append(objects[j].weighted_moments_hu())
        properties[i].append(objects[j].weighted_moments())
        properties[i].append(objects[j].weighted_moments_normalized())
    return properties, prop_names


if __name__ == '__main__':
    image = io.imread('test-image.png')
    green = image[..., 1].copy()
    lp = LineProfiler()
    lp.add_function(object_features)
    lp.run('intensity_object_features(green, 100)')
    lp.print_stats()
    lp.dump_stats('profile.lprof')
    print(__file__)
开发者ID:jni,项目名称:profile-regionprops,代码行数:32,代码来源:regprops.py

示例4: zip

# 需要导入模块: from line_profiler import LineProfiler [as 别名]
# 或者: from line_profiler.LineProfiler import dump_stats [as 别名]
        for timestamp in bit_2_events[-5:]:
            print "unstrobed bit 2 t=%f" % timestamp
        print "found %d bit 3 events. Last 5 events are:" %(len(bit_3_events))
        for timestamp in bit_3_events[-5:]:
            print "unstrobed bit 3 t=%f" % timestamp
        
        unstrobed_word = pu.GetExtEvents(data, event='unstrobed_word', online=False)
        print "found %d unstrobed word events in which 10 events are:" %(len(unstrobed_word['value']))
        indices = np.arange(0,len(unstrobed_word['value']),len(unstrobed_word['value'])/10)
        for value,timestamp in zip(unstrobed_word['value'][indices],unstrobed_word['timestamp'][indices]) :
            binary_value = bin(value)
            print "unstrobed word:%s t=%f" % (binary_value,timestamp)

if __name__ == "__main__":
        #run()
        profile = LineProfiler()
        profile.add_function(run)
        profile.add_function(PlexUtil.GetExtEvents)
        profile.add_function(reconstruct_word)
        profile.run('run()')
        profile.print_stats()
        profile.dump_stats("testPlexFile_profile.lprof")
        
        #cProfile.run('run()','PlexFile_profile')
        #p = pstats.Stats('testPlexFile_profile.lprof')
        #p.sort_stats('cumulative')
        #p.print_stats()
        
        #print h.heap()

开发者ID:chrox,项目名称:RealTimeElectrophy,代码行数:31,代码来源:testPlexFile.py

示例5: Copyright

# 需要导入模块: from line_profiler import LineProfiler [as 别名]
# 或者: from line_profiler.LineProfiler import dump_stats [as 别名]
# Test and profile TimeHistogram
#
# Copyright (C) 2010-2012 Huang Xin
# 
# See LICENSE.TXT that came with this file.
#import cProfile,pstats
from line_profiler import LineProfiler
import TimeHistogram

def run():
    psth = TimeHistogram.PSTHAverage('/home/chrox/dev/plexon_data/c04-stim-timing-8ms-rand-1.plx')
    psth.get_data()

if __name__ == '__main__':
    
    #cProfile.run('psth.get_data()','hist_profile')
    #p = pstats.Stats('hist_profile')
    #p.sort_stats('cumulative')
    #p.print_stats()
    
    profile = LineProfiler()
    profile.add_function(run)
    profile.add_function(TimeHistogram.PSTHAverage._process_unit)
    profile.run('run()')
    profile.print_stats()
    profile.dump_stats("hist_profile.lprof")
开发者ID:chrox,项目名称:RealTimeElectrophy,代码行数:28,代码来源:histogram_profile.py


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