+
    ig                     n    ^ RI t ^ RIt^ RIt]P                  ! ]4      t ! R R4      tRRRR/R R lltR# )	    Nc                   N   a  ] tR t^t o RtRRRR/V 3R lR lltR tR tR	tV t	R
# )Timedaf  
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
    ```
	threshold{Gz?log_modec                ,   < V ^8  d   QhRS[ RS[RS[ /#    msgr   r   strfloat)format__classdict__s   "7/usr/lib/python3/dist-packages/cloudinit/performance.py__annotate__Timed.__annotate__%   s)       	
     c               T    Wn         W n        W0n        R V n        RV n        RV n        R# ) g        N)r   r   r   outputstartdelta)selfr   r   r   s   &&$$r   __init__Timed.__init__%   s(     " 

r   c                :    \         P                  ! 4       V n        V # )N)time	monotonicr   )r   s   &r   	__enter__Timed.__enter__3   s    ^^%
r   c                   \         P                  ! 4       V P                  ,
          V n        R V P                  R R2pRV P                  8X  d$   \
        P                  RV P                  V4       R# RV P                  8X  d   R# RV P                  8X  dW   V P                  V P                  8  d:   \
        P                  RV P                  V4       V P                   RV 2V n	        R# R# \        R	V P                   R
24      h)ztook z.3fz secondsalwaysz%s %sskipNr    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}}$IIgtxx0t}}$DMM)zzDNN*		'488V4!%
!F84 + 1$--C r   )r   r   r   r   r   r   N)
__name__
__module____qualname____firstlineno____doc__r   r    r-   __static_attributes____classdictcell__)r   s   @r   r   r      s7     8  	
 $  r   r   r   r   r   c                <    V ^8  d   QhR\         R\        R\         /# r	   r   )r   s   "r   r   r   H   s!     # #s #% ## #r   c                  a aa VV V3R lpV# )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   <a  \         P                  ! S 4      V VVV3R  l4       pV# )c                  ~   < \        SSSR 7      ;_uu_ 4        S! V / VB uuRRR4       #   + '       g   i     R# ; i))r   r   N)r   )argskwargsfuncr   r   r   s   *,r   	decorator)timed.<locals>.wrapper.<locals>.decoratord   s/    si(CCT,V, DCCCs   +<	)	functoolswraps)r<   r=   r   r   r   s   f r   wrappertimed.<locals>.wrapperc   s&    			- 
	- r    )r   r   r   rA   s   fdd r   timedrD   H   s    6 Nr   )r?   loggingr   	getLoggerr/   r&   r   rD   rC   r   r   <module>rG      sA      != =@#$ # # #r   