ó
    x[hg  ã                   ót   • S SK r S SKrS SKr\R                  " \5      r " S S5      rSSS.S\S\S\4S	 jjr	g)
é    Nc                   óD   • \ rS rSrSrSSS.S\S\S\4S jjrS	 rS
 r	Sr
g)ÚTimedé   af  
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Úmsgr	   c                óR   • Xl         X l        X0l        SU l        SU l        SU l        g )NÚ g        )r
   r   r	   ÚoutputÚstartÚdelta)Úselfr
   r   r	   s       Ú7/usr/lib/python3/dist-packages/cloudinit/performance.pyÚ__init__ÚTimed.__init__%   s(   € ð ŒØ"ŒØ ŒØˆŒØˆŒ
Øˆ�
ó    c                 ó:   • [         R                  " 5       U l        U $ )N)ÚtimeÚ	monotonicr   )r   s    r   Ú	__enter__ÚTimed.__enter__3   s   € Ü—^’^Ó%ˆŒ
Øˆr   c                 óð  • [         R                  " 5       U R                  -
  U l        SU R                  S S3nSU R                  :X  a"  [
        R                  SU R                  U5        g SU R                  :X  a  g SU R                  :X  aS  U R                  U R                  :”  a8  [
        R                  SU R                  U5        U R                   SU 3U l	        g g [        S	U R                   S
35      e)Nztook z.3fz secondsÚalwaysz%s %sÚskipr   Ú zInvalid Timed log_mode value: 'z'.)r   r   r   r   r	   ÚLOGÚdebugr
   r   r   Ú
ValueError)r   Úexc_typeÚexc_valÚexc_tbÚsuffixs        r   Ú__exit__ÚTimed.__exit__7   sÇ   € Ü—^’^Ó%¨¯
©
Ñ2ˆŒ
Ø˜Ÿ™ CÐ(¨Ð1ˆØ�t—}‘}Ó$Ü�I‰I�g˜tŸx™x¨Õ0Ø�t—}‘}Ó$ØØ˜DŸM™MÓ)Ø�z‰z˜DŸN™NÓ*Ü—	‘	˜' 4§8¡8¨VÔ4Ø!%§¡ 
¨!¨F¨8Ð4�•ð +ô Ø1°$·-±-°ÀÐCóð r   )r   r	   r
   r   r   r   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__ÚstrÚfloatr   r   r%   Ú__static_attributes__© r   r   r   r      s;   † ñð@  Ø#òàðð ð	ð
 õòõr   r   r   r   r   r
   r	   c                ó   ^ ^^• UU U4S jnU$ )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
    ```
c                 óN   >^ • [         R                  " T 5      U UUU4S j5       nU$ )Nc                  ó`   >• [        TTTS9   T" U 0 UD6sS S S 5        $ ! , (       d  f       g = f)Nr   )r   )ÚargsÚkwargsÚfuncr	   r
   r   s     €€€€r   Ú	decoratorÚ)timed.<locals>.wrapper.<locals>.decoratord   s)   ø€ ä�s i¸(ÓCÙ˜TÐ, VÑ,÷ D×C×Cús   �Ÿ
-)Ú	functoolsÚwraps)r5   r6   r	   r
   r   s   ` €€€r   ÚwrapperÚtimed.<locals>.wrapperc   s&   ù€ Ü	�Š˜Ó	÷	-ó 
ð	-ð Ðr   r/   )r
   r   r	   r:   s   ``` r   Útimedr<   H   s   ú€ ÷6ð €Nr   )
r8   Úloggingr   Ú	getLoggerr'   r   r   r,   r-   r<   r/   r   r   Ú<module>r?      sJ   ðÛ Û Û à×Ò˜Ó!€÷=ñ =ð@ +/Àò #ˆsð # %ð #¸#ö #r   