HEX
Server: nginx/1.24.0
System: Linux localhost 5.15.0-46-generic #49-Ubuntu SMP Thu Aug 4 18:03:25 UTC 2022 x86_64
User: www (1000)
PHP: 8.3.27
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: //usr/lib/python3/dist-packages/cloudinit/__pycache__/performance.cpython-310.pyc
o

쑛hg�@sRddlZddlZddlZe�e�ZGdd�d�Zddd�dededefd	d
�Z	dS)�Nc@s>eZdZdZddd�dededefdd�Zd	d
�Zdd�Zd
S)�Timeda�
    A context manager which measures and optionally logs context run time.

    :param msg: A message that describes the thing that is being measured
    :param threshold: Threshold, in seconds. When the context exceeds this
        threshold, a log will be made.
    :param log_mode: Control whether to log. Defaults to "threshold". Possible
        values include:
        "always" - Always log 'msg', even when 'threshold' is not reached.
        "threshold" - Log when context time exceeds 'threshold'.
        "skip" - Do not log. Context time and message are stored in the
            'output' and 'delta' attributes, respectively. Used to manually
            coalesce with other logs at the call site.

    usage:

        this call:
        ```
        with Timed("Configuring the network"):
            run_configure()
        ```

        might produce this log:
        ```
            Configuring the network took 0.100 seconds
        ```
    �{�G�z�?�	threshold�r�log_mode�msgrcCs(||_||_||_d|_d|_d|_dS)N�g)rrr�output�start�delta)�selfrrr�r
�7/usr/lib/python3/dist-packages/cloudinit/performance.py�__init__%s
zTimed.__init__cCst��|_|S)N)�time�	monotonicr
)rr
r
r�	__enter__3s
zTimed.__enter__cCs�t��|j|_d|jd�d�}d|jkrt�d|j|�dSd|jkr&dSd|jkrF|j|jkrDt�d|j|�|j�d|��|_	dSdSt
d	|j�d
���)Nztook z.3fz seconds�alwaysz%s %s�skipr� zInvalid Timed log_mode value: 'z'.)rrr
rr�LOG�debugrrr	�
ValueError)r�exc_type�exc_val�exc_tb�suffixr
r
r�__exit__7s


��zTimed.__exit__N)	�__name__�
__module__�__qualname__�__doc__�str�floatrrrr
r
r
rrs ���
�rrrrrrcs���fdd�}|S)a�
    A decorator which measures and optionally logs context run time.

    :param msg: A message that describes the thing that is being measured
    :param threshold: Threshold, in seconds. When the context exceeds this
        threshold, a log will be made.
    :param log_mode: Control whether to log. Defaults to "threshold". Possible
        values include:
        "always" - Always log 'msg', even when 'threshold' is not reached.
        "threshold" - Log when context time exceeds 'threshold'.

    usage:

        this call:
        ```
        @timed("Configuring the network")
        def run_configure():
            ...
        ```

        might produce this log:
        ```
            Configuring the network took 0.100 seconds
        ```
    cs t�������fdd��}|S)Ncs@t���d���|i|��Wd�S1swYdS)Nr)r)�args�kwargs)�funcrrrr
r�	decoratords$�z)timed.<locals>.wrapper.<locals>.decorator)�	functools�wraps)r&r'�rrr)r&r�wrappercsztimed.<locals>.wrapperr
)rrrr+r
r*r�timedHsr,)
r(�loggingr�	getLoggerrrrr"r#r,r
r
r
r�<module>s
"@