1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/base/Measure.h
12 #ifndef ZYPP_BASE_MEASURE_H
13 #define ZYPP_BASE_MEASURE_H
18 #include "zypp/base/PtrTypes.h"
20 ///////////////////////////////////////////////////////////////////
22 { /////////////////////////////////////////////////////////////////
23 ///////////////////////////////////////////////////////////////////
25 { /////////////////////////////////////////////////////////////////
27 ///////////////////////////////////////////////////////////////////
29 // CLASS NAME : Measure
31 /** Tool to measure elapsed real and process times.
33 * Timer is started by either passing a string to the ctor,
34 * or callign \ref start. The string passed is printed on
35 * all messages to help identifying the timer.
37 * Elapsed time is printed on calling \ref elapsed (timer
38 * keeps running) or \ref stop.
40 * Calling \ref stop, stops the timer. The same, if the timer
43 * Elapsed time is printed as:
45 * 'REAL TIME' (u 'USER TIME' s 'SYSTEM TIME' c 'TIME OF CHILDREN')
47 * In brackets the time elapsed since a previous call to \ref elapsed.
48 * All units are seconds.
51 * Measure m( "Parse" );
61 * // START MEASURE(Parse)
62 * // ELAPSED(Parse) 0 (u 0.13 s 0.00 c 0.00)
63 * // ELAPSED(Parse) 0 (u 0.15 s 0.02 c 0.00) [ 0 (u 0.02 s 0.02 c 0.00)]
64 * // ELAPSED(Parse) 0 (u 0.17 s 0.02 c 0.00) [ 0 (u 0.02 s 0.00 c 0.00)]
65 * // MEASURE(Parse) 0 (u 0.17 s 0.02 c 0.00) [ 0 (u 0.00 s 0.00 c 0.00)]
71 /** Default Ctor does nothing. */
74 /** Ctor taking \a ident_r string and auto starts timer. */
76 Measure( const std::string & ident_r );
81 /** Start timer for \a ident_r string.
82 * Implies stoping a running timer.
84 void start( const std::string & ident_r = std::string() );
86 /** re start the timer without reset-ing it. */
89 /** Print elapsed time for a running timer.
90 * Timer keeps on running.
94 /** Stop a running timer. */
98 /** Implementation. */
100 /** Pointer to implementation. */
101 RW_pointer<Impl> _pimpl;
103 ///////////////////////////////////////////////////////////////////
105 /////////////////////////////////////////////////////////////////
107 ///////////////////////////////////////////////////////////////////
108 /////////////////////////////////////////////////////////////////
110 ///////////////////////////////////////////////////////////////////
111 #endif // ZYPP_BASE_MEASURE_H