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