U
    !?h                     @   s   d dl Z G dd deZdS )    Nc                   @   s"   e Zd ZdZdd ZdddZdS )TimerzTimer for benchmarkingc                 C   s   t  | _dS )zStarts a timerN)timeperf_countert)self r   F/var/www/html/venv/lib/python3.8/site-packages/pymatting/util/timer.py__init__   s    zTimer.__init__Nc                 C   s2   t  | j }|dk	r$t|d|  t  | _|S )a  Return and print time since last stop-call or initialization.
        Also print elapsed time if message is provided.

        Parameters
        ----------
        message: str
            Message to print in front of passed seconds

        Example
        -------
        >>> from pymatting import *
        >>> t = Timer()
        >>> t.stop()
        2.6157200919999966
        >>> t = Timer()
        >>> t.stop('Test')
        Test  - 11.654551 seconds
        11.654551381000001
        Nz - %f seconds)r   r   r   print)r   messageZ
delta_timer   r   r   stop   s
    
z
Timer.stop)N)__name__
__module____qualname____doc__r	   r   r   r   r   r   r      s   r   )r   objectr   r   r   r   r   <module>   s   