Metadata-Version: 2.1
Name: python-stopwatch
Version: 1.0.0
Summary: A simple stopwatch for measuring code performance
Home-page: https://github.com/jonghwanhyeon/python-stopwatch
Author: Jonghwan Hyeon
Author-email: hyeon0145@gmail.com
License: MIT
Description: # Stopwatch
        A simple stopwatch for measuring code performance.
        
        ## Examples
        ```python
        import time
        from stopwatch import Stopwatch, profile
        
        stopwatch = Stopwatch()
        stopwatch.start()
        time.sleep(3.0)
        stopwatch.stop()
        print(stopwatch.elapsed) # 3.003047182224691
        
        with Stopwatch(name='outer') as outer_stopwatch:
            with Stopwatch(name='inner') as inner_stopwatch:
                for i in range(5):
                    with inner_stopwatch.lap():
                        time.sleep(i / 10)
        print(inner_stopwatch.elapsed) # 1.0013675531372428
        print(inner_stopwatch.laps) # [3.256136551499367e-05, 0.10015189787372947, 0.20030939625576138, 0.3003752687945962, 0.40049842884764075]
        print(outer_stopwatch.report()) # [Stopwatch#outer] total=1.0015s
        print(inner_stopwatch.report()) # [Stopwatch#inner] total=1.0014s, mean=0.2003s, min=0.0000s, median=0.2003s, max=0.4005s, dev=0.1416s
        
        @profile(name='wait_for')
        def wait_for(ts):
            if not ts:
                return
        
            time.sleep(ts[0])
            wait_for(ts[1:])
        
        wait_for([0.1, 0.2, 0.3, 0.4, 0.5])
        # [profile#wait_for] hits=1, mean=0.0000s, min=0.0000s, median=0.0000s, max=0.0000s, dev=0.0000s
        # [profile#wait_for] hits=2, mean=0.2507s, min=0.0000s, median=0.2507s, max=0.5013s, dev=0.2506s
        # [profile#wait_for] hits=3, mean=0.4679s, min=0.0000s, median=0.5013s, max=0.9025s, dev=0.3692s
        # [profile#wait_for] hits=4, mean=0.6519s, min=0.0000s, median=0.7019s, max=1.2037s, dev=0.4514s
        # [profile#wait_for] hits=5, mean=0.8025s, min=0.0000s, median=0.9025s, max=1.4048s, dev=0.5037s
        # [profile#wait_for] hits=6, mean=0.9197s, min=0.0000s, median=1.0531s, max=1.5060s, dev=0.5293s
        ```
Keywords: stopwatch profile
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3 :: Only
Requires-Python: >=3.4
Description-Content-Type: text/markdown
