1 karl 1.21 //%2006////////////////////////////////////////////////////////////////////////
|
2 sage 1.1 //
|
3 karl 1.13 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
4 // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
5 // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
|
6 karl 1.7 // IBM Corp.; EMC Corporation, The Open Group.
|
7 karl 1.13 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
8 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
|
9 karl 1.15 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
10 // EMC Corporation; VERITAS Software Corporation; The Open Group.
|
11 karl 1.21 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
12 // EMC Corporation; Symantec Corporation; The Open Group.
|
13 sage 1.1 //
14 // Permission is hereby granted, free of charge, to any person obtaining a copy
15 // of this software and associated documentation files (the "Software"), to
16 // deal in the Software without restriction, including without limitation the
17 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
18 // sell copies of the Software, and to permit persons to whom the Software is
19 // furnished to do so, subject to the following conditions:
|
20 kumpf 1.3 //
|
21 sage 1.1 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
22 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
23 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
24 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
25 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
26 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
27 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 //
30 //==============================================================================
31 //
32 //%/////////////////////////////////////////////////////////////////////////////
33
|
34 kumpf 1.25 #ifndef Pegasus_StatisticalData_h
35 #define Pegasus_StatisticalData_h
|
36 sage 1.1
37 #include <Pegasus/Common/Config.h>
|
38 w.white 1.11 #include <iostream>
|
39 sage 1.1 #include <cstring>
|
40 mike 1.24 #include <Pegasus/Common/Linkage.h>
|
41 kumpf 1.6 #include <Pegasus/Common/InternalException.h>
|
42 sage 1.1 #include <Pegasus/Common/String.h>
43 #include <Pegasus/Common/CIMProperty.h>
44 #include <Pegasus/Common/CIMInstance.h>
|
45 w.white 1.8 #include <Pegasus/Common/CIMDateTime.h>
|
46 kumpf 1.25 #include <Pegasus/Common/CIMMessage.h>
|
47 mike 1.24 #include <Pegasus/Common/Mutex.h>
48 #include <Pegasus/Common/Time.h>
|
49 kumpf 1.31 #include <Pegasus/Common/TimeValue.h>
|
50 sage 1.1
51 PEGASUS_NAMESPACE_BEGIN
52
|
53 karl 1.14 #ifndef PEGASUS_DISABLE_PERFINST
|
54 sage 1.1
55 #define STAT_GETSTARTTIME \
|
56 kumpf 1.29 Uint64 serverStartTimeMicroseconds = \
57 TimeValue::getCurrentTime().toMicroseconds();
|
58 w.white 1.8
59 #define STAT_SERVERSTART \
|
60 kumpf 1.29 request->setServerStartTime(serverStartTimeMicroseconds);
|
61 w.white 1.8
|
62 sage 1.1 #define STAT_SERVEREND \
|
63 w.white 1.8 response->endServer();\
|
64 w.white 1.12
65 #define STAT_BYTESSENT \
|
66 kumpf 1.30 Uint16 statType = (response->getType() >= CIM_GET_CLASS_RESPONSE_MESSAGE) ? \
67 response->getType() - CIM_GET_CLASS_RESPONSE_MESSAGE : \
68 response->getType() - 1; \
69 StatisticalData::current()->addToValue( \
70 message.size(), statType, StatisticalData::PEGASUS_STATDATA_BYTES_SENT);
|
71 w.white 1.10
72
|
73 w.white 1.8 #define STAT_SERVEREND_ERROR \
74 response->endServer();
75
|
76 kumpf 1.30 /*
77 The request size value must be stored (requSize) and passed to the
78 StatisticalData object at the end of processing other wise it will be
79 the ONLY vlaue that is passed to the client which reports the current
80 state of the object, not the pevious (one command ago) state
81 */
|
82 w.white 1.8
|
83 sage 1.1 #define STAT_BYTESREAD \
|
84 kumpf 1.30 Uint16 statType = (request->getType() >= CIM_GET_CLASS_RESPONSE_MESSAGE) ? \
85 request->getType() - CIM_GET_CLASS_RESPONSE_MESSAGE : \
86 request->getType() - 1; \
87 StatisticalData::current()->requSize = contentLength;
|
88 w.white 1.10
|
89 sage 1.1 #else
90 #define STAT_GETSTARTTIME
91 #define STAT_SERVERSTART
92 #define STAT_SERVEREND
93 #define STAT_SERVEREND_ERROR
94 #define STAT_BYTESREAD
|
95 w.white 1.12 #define STAT_BYTESSENT
|
96 sage 1.1 #endif
97
|
98 kumpf 1.25 class PEGASUS_COMMON_LINKAGE StatProviderTimeMeasurement
99 {
100 public:
101 StatProviderTimeMeasurement(CIMMessage* message)
102 : _message(message)
103 {
104 #ifndef PEGASUS_DISABLE_PERFINST
|
105 kumpf 1.29 _startTimeMicroseconds = TimeValue::getCurrentTime().toMicroseconds();
|
106 kumpf 1.25 #endif
107 }
108
109 ~StatProviderTimeMeasurement()
110 {
111 #ifndef PEGASUS_DISABLE_PERFINST
|
112 kumpf 1.29 _message->setProviderTime(
113 TimeValue::getCurrentTime().toMicroseconds() -
114 _startTimeMicroseconds);
|
115 kumpf 1.25 #endif
116 }
117
118 private:
119 StatProviderTimeMeasurement();
120 StatProviderTimeMeasurement(const StatProviderTimeMeasurement&);
121 StatProviderTimeMeasurement& operator=(const StatProviderTimeMeasurement&);
122
123 CIMMessage* _message;
|
124 kumpf 1.29 Uint64 _startTimeMicroseconds;
|
125 kumpf 1.25 };
126
|
127 sage 1.1 class PEGASUS_COMMON_LINKAGE StatisticalData
128 {
|
129 kumpf 1.30 public:
130 enum StatRequestType
131 {
132 GET_CLASS,
133 GET_INSTANCE,
134 INDICATION_DELIVERY,
135 DELETE_CLASS,
136 DELETE_INSTANCE,
137 CREATE_CLASS,
138 CREATE_INSTANCE,
139 MODIFY_CLASS,
140 MODIFY_INSTANCE,
141 ENUMERATE_CLASSES,
142 ENUMERATE_CLASS_NAMES,
143 ENUMERATE_INSTANCES,
144 ENUMERATE_INSTANCE_NAMES,
145 EXEC_QUERY,
146 ASSOCIATORS,
147 ASSOCIATOR_NAMES,
148 REFERENCES,
149 REFERENCE_NAMES,
150 kumpf 1.30 GET_PROPERTY,
151 SET_PROPERTY,
152 GET_QUALIFIER,
153 SET_QUALIFIER,
154 DELETE_QUALIFIER,
155 ENUMERATE_QUALIFIERS,
156 INVOKE_METHOD,
157 NUMBER_OF_TYPES
158 };
159
160 enum StatDataType
161 {
162 PEGASUS_STATDATA_SERVER,
163 PEGASUS_STATDATA_PROVIDER,
164 PEGASUS_STATDATA_BYTES_SENT,
165 PEGASUS_STATDATA_BYTES_READ
166 };
167
168 static const Uint32 length;
169 static StatisticalData* current();
170
171 kumpf 1.30 StatisticalData();
172
173 timeval timestamp;
174
175 Sint64 numCalls[NUMBER_OF_TYPES];
176 Sint64 cimomTime[NUMBER_OF_TYPES];
177 Sint64 providerTime[NUMBER_OF_TYPES];
178 Sint64 responseSize[NUMBER_OF_TYPES];
179 Sint64 requestSize[NUMBER_OF_TYPES];
180 Sint64 requSize; //tempory storage for requestSize vlaue
181 Boolean copyGSD;
182 static StatisticalData* cur;
183 void addToValue(Sint64 value, Uint16 type, Uint32 t);
184 static String requestName[];
185 void setCopyGSD(Boolean flag);
|
186 sage 1.1
|
187 kumpf 1.30 protected:
188 Mutex _mutex;
|
189 sage 1.1 };
190
191
192 PEGASUS_NAMESPACE_END
193 #endif
194
|