sipxportlib  Version 3.3
OsTimeLog.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2004-2006 SIPfoundry Inc.
3 // Licensed by SIPfoundry under the LGPL license.
4 //
5 // Copyright (C) 2004-2006 Pingtel Corp. All rights reserved.
6 // Licensed to SIPfoundry under a Contributor Agreement.
7 //
8 // $$
10 
11 
12 #ifndef _OsTimeLog_h_
13 #define _OsTimeLog_h_
14 
15 // SYSTEM INCLUDES
16 
17 // APPLICATION INCLUDES
18 #include "os/OsTime.h"
19 
20 // DEFINES
21 // MACROS
22 // EXTERNAL FUNCTIONS
23 // EXTERNAL VARIABLES
24 // CONSTANTS
25 // STRUCTS
26 // TYPEDEFS
27 // FORWARD DECLARATIONS
28 class UtlString;
29 
30 //:Class short description which may consist of multiple lines (note the ':')
31 // Class detailed description which may extend to multiple lines
32 class OsTimeLog
33 {
34 /* //////////////////////////// PUBLIC //////////////////////////////////// */
35 public:
36 
37 /* ============================ CREATORS ================================== */
38 
39  OsTimeLog(int maxEventCount = 100);
40  //:Default constructor
41 
42  OsTimeLog(const OsTimeLog& rOsTimeLog);
43  //:Copy constructor
44 
45  virtual
46  ~OsTimeLog();
47  //:Destructor
48 
49 /* ============================ MANIPULATORS ============================== */
50 
51  OsTimeLog& operator=(const OsTimeLog& rhs);
52  //:Assignment operator
53 
54  void addEvent(const char* eventName);
55  //: Adds an event to the log for the current time
56 
57  void addEvent(const char* eventName, OsTime* eventTime);
58  //: Adds an event to the log for the given time
59  // Note: eventTime must be allocated off the heap and is
60  // freed by the OsTimeLog destructor.
61 
62  void dumpLog() const;
63  //: Dumps the log out using osPrintf
64 
65 /* ============================ ACCESSORS ================================= */
66 
67  void getLogString(UtlString& logString) const;
68  //: Get log with column headers and rows of named events with lapse and incremental time
69  // i.e.:
70  // Name Time Incremental Time
71  // CREATED 0.000000 N/A
72  // SENDING 0.160000 0.160000
73  // SENDING 0.771000 0.771000
74  // SENDING 1.823000 1.823000
75  // SENDING 3.866000 2.866000
76  // SENDING 7.931000 4.931000
77  // SENDING 11.987000 4.987000
78 
79  UtlBoolean getEventTime(const char* eventName, OsTime& time) const;
80  //: Get the named event time
81 
82  UtlBoolean getEventTime(int eventIndex, OsTime& time) const;
83  //: get the event time indicated by the index
84  // Note: the first event index = 0
85 
86 /* ============================ INQUIRY =================================== */
87 
88 /* //////////////////////////// PROTECTED ///////////////////////////////// */
89 protected:
90 
91 /* //////////////////////////// PRIVATE /////////////////////////////////// */
92 private:
93 
94  UtlString** mpaEventNames;
95  OsTime** mpaEventTimes;
96  int mMaxEventCount;
97  int mNumEvents;
98 
99 };
100 
101 /* ============================ INLINE METHODS ============================ */
102 
103 #endif // _OsTimeLog_h_
void addEvent(const char *eventName)
Definition: OsTimeLog.cpp:163
OsTimeLog & operator=(const OsTimeLog &rhs)
Definition: OsTimeLog.cpp:110
time_t __cdecl time(time_t *ptt)
UtlBoolean getEventTime(const char *eventName, OsTime &time) const
void dumpLog() const
Definition: OsTimeLog.cpp:191
Definition: UtlString.h:48
OsTimeLog(int maxEventCount=100)
Definition: OsTimeLog.cpp:35
void getLogString(UtlString &logString) const
Definition: OsTimeLog.cpp:201
Definition: OsTimeLog.h:32
Definition: OsTime.h:37
int UtlBoolean
Definition: UtlDefs.h:41
virtual ~OsTimeLog()
Definition: OsTimeLog.cpp:81