예제 #1
0
 def meth2(self):
     time.sleep(0.01)
     for x in range(5):
         # used as a context manager
         with PerfTool('internal'):
             time.sleep(0.01)
             for x in range(2):
                 with PerfTool('internal2'):
                     time.sleep(0.01)
예제 #2
0
def main():
    @perf_tool('body')
    def scoped():
        sleep(0.05)

    with PerfTool('call'):
        scoped()
    for row in range(10):
        with PerfTool('row'):
            sleep(0.001)
예제 #3
0
def main():
    """
    Dummy example of use
    """
    with PerfTool('preparation'):
        time.sleep(0.01)

    with PerfTool('calculus'):
        time.sleep(0.03)

    with PerfTool('output'):
        time.sleep(0.02)
        for row in range(100):
            with PerfTool('row write'):
                time.sleep(0.001)
예제 #4
0
def on_run_off():
    # Singleton instance
    assert PerfTool.set_enabled()
    yield
    assert PerfTool.show_stats_if_enabled(return_if_succeeded=True)
    assert not PerfTool.set_enabled(False)
    assert PerfTool.show_stats_if_enabled(return_if_succeeded=True)
    PerfTool.empty()
    assert not PerfTool.t0
    assert not PerfTool.times
    assert not PerfTool.running
예제 #5
0
def test_algo1(on_run_off):
    aa = Case1()
    for x in range(3):
        aa.meth1()
        aa.meth2()

    for x in range(5):
        # as a context manager
        with PerfTool('meth2'):
            time.sleep(0.01)

    assert PerfTool.has('meth2')
    assert PerfTool.has('meth1')
    assert PerfTool.has('nested')
    assert PerfTool.has('nested.internal')
    assert PerfTool.has('nested.internal.internal2')
예제 #6
0
 def __init__(self, instance):
     PerfTool.__init__(self, instance, 'wrk2')
예제 #7
0
 def __init__(self, instance):
     PerfTool.__init__(self, 'nuttcp-7.3.2', instance)
예제 #8
0
 def __init__(self, instance, cfg_http_tool):
     PerfTool.__init__(self, instance, cfg_http_tool)
예제 #9
0
파일: iperf_tool.py 프로젝트: mikeynap/vmtp
 def __init__(self, instance):
     PerfTool.__init__(self, 'iperf', instance)
예제 #10
0
 def __init__(self, instance):
     PerfTool.__init__(self, instance, 'fio')
예제 #11
0
 def __init__(self, instance, perf_tool_path):
     PerfTool.__init__(self, 'iperf', perf_tool_path, instance)
예제 #12
0
 def __init__(self, instance):
     PerfTool.__init__(self, instance, 'wrk2')
예제 #13
0
#!/usr/bin/env python

from time import sleep
from perf_tool import PerfTool, perf_tool


@perf_tool('main')
def main():
    @perf_tool('body')
    def scoped():
        sleep(0.05)

    with PerfTool('call'):
        scoped()
    for row in range(10):
        with PerfTool('row'):
            sleep(0.001)


PerfTool.set_enabled()
main()
PerfTool.show_stats_if_enabled()
예제 #14
0
 def __init__(self, instance):
     PerfTool.__init__(self, 'iperf-2.0.9', instance)
예제 #15
0
 def __init__(self, instance):
     PerfTool.__init__(self, 'nuttcp-8.1.4', instance)
예제 #16
0
 def __init__(self, instance):
     PerfTool.__init__(self, instance, 'nuttcp')
     self.keys = ['thoroughput', 'time', 'rate', 'tx_cpu', 'jitter', 'latency']
예제 #17
0
 def __init__(self, instance, perf_tool_path):
     PerfTool.__init__(self, 'nuttcp-7.3.2', perf_tool_path, instance)