ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/LJMet/Utils/interface/MeanCounter.h
Revision: 1.2
Committed: Sat Oct 10 05:26:18 2009 UTC (15 years, 6 months ago) by kukartse
Content type: text/plain
Branch: MAIN
CVS Tags: V00-00-02, V00-00-01_BeamSplash09, gak110409, HEAD
Changes since 1.1: +1 -1 lines
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 kukartse 1.1 /* -*- mode: c++ -*- */
2    
3     #ifndef Mean_Counter
4     #define Mean_Counter
5    
6     #include <iostream>
7     #include <string>
8     #include <time.h>
9     #include <sys/times.h>
10     using namespace std;
11    
12     class MeanCounter {
13    
14     public:
15     MeanCounter();
16 kukartse 1.2 MeanCounter( const char *message, unsigned long int theFirst = 0, unsigned long int theDivider = 100 );
17 kukartse 1.1 MeanCounter( unsigned long int theFirst, unsigned long int theDivider );
18     ~MeanCounter();
19    
20     void setCounter( unsigned long int );
21     void setDivider( unsigned int );
22     void setPrintCount( bool _printCount );
23     void setNewLine( bool newLine );
24     void setMessage( const char* );
25     void count( void );
26     unsigned long int getCount( void );
27     double getCountDouble( void );
28     void increment( long int _incr );
29     void incrementDouble( double _incr );
30    
31     void set_times_mark(void);
32     clock_t get_times_diff(void);
33     clock_t get_times(void);
34    
35     void start_clock(void);
36     void end_clock(char *msg);
37     clock_t st_time;
38     clock_t en_time;
39     struct tms st_cpu;
40     struct tms en_cpu;
41    
42    
43     time_t chime(std::string message); // chimes with a message and the time passed since last tick
44    
45     private:
46     unsigned long int _count;
47     double _count_double_type;
48     unsigned long int _firstCount;
49     unsigned int _divider;
50     bool printCount;
51     bool firstCountEntry;
52     string _message;
53     bool _newLine;
54    
55     time_t initTime, firstTickTime, lastPrintTime, lastTickTime;
56    
57     clock_t time_mark;
58    
59    
60    
61     void init( void );
62    
63     //ClassDef(MeanCounter,1)
64     };
65    
66     #endif