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 // Author: Arthur Pichlkostner
33 // (checked in: Markus Mueller sedgewick_de@yahoo.de)
|
34 kumpf 1.3 //
35 // Modified By:
|
36 sage 1.1 //
37 //%/////////////////////////////////////////////////////////////////////////////
38
39 #ifndef STATISTICAL_DATA_H
40 #define STATISTICAL_DATA_H
41
42 #include <Pegasus/Common/Config.h>
|
43 w.white 1.11 #include <iostream>
|
44 sage 1.1 #include <cstring>
|
45 mike 1.23.14.1 #include <Pegasus/Common/Linkage.h>
|
46 kumpf 1.6 #include <Pegasus/Common/InternalException.h>
|
47 sage 1.1 #include <Pegasus/Common/String.h>
48 #include <Pegasus/Common/CIMProperty.h>
49 #include <Pegasus/Common/CIMInstance.h>
|
50 w.white 1.8 #include <Pegasus/Common/CIMDateTime.h>
|
51 mike 1.23.14.1 #include <Pegasus/Common/Mutex.h>
|
52 mike 1.23.14.2 #include <Pegasus/Common/Time.h>
|
53 sage 1.1
54 PEGASUS_NAMESPACE_BEGIN
55
|
56 karl 1.14 #ifndef PEGASUS_DISABLE_PERFINST
|
57 sage 1.1
58 #define STAT_GETSTARTTIME \
|
59 w.white 1.16 TimeValue startTime = TimeValue::getCurrentTime();
|
60 w.white 1.8
|
61 a.dunfey 1.20 #define STAT_PMS_PROVIDERSTART \
62 response->setStartServerTime(request->getStartServerTime()); \
63 response->setStartProviderTime(TimeValue::getCurrentTime());
|
64 sage 1.1
|
65 a.dunfey 1.22 #define STAT_RESPONSEEND \
66 response->endProvider();
67
|
68 sage 1.1 #define STAT_PMS_PROVIDEREND \
69 response->endProvider(); \
70 response->setStartServerTime(request->getStartServerTime()); \
71 response->setStartProviderTime(startTime);
72
|
73 w.white 1.8
74 #define STAT_SERVERSTART \
75 request->setStartServerTime(startTime);
76
|
77 sage 1.1
78 #define STAT_SERVEREND \
|
79 w.white 1.8 response->endServer();\
|
80 w.white 1.12
81 #define STAT_BYTESSENT \
|
82 w.white 1.10 Uint16 statType = (response->getType() >= CIM_GET_CLASS_RESPONSE_MESSAGE)? \
|
83 w.white 1.12 response->getType() - CIM_GET_CLASS_RESPONSE_MESSAGE:response->getType() - 1;\
|
84 denise.eckstein 1.18 StatisticalData::current()->addToValue(message.size(), statType, StatisticalData::PEGASUS_STATDATA_BYTES_SENT);
|
85 w.white 1.8
|
86 w.white 1.10
87
|
88 w.white 1.8 #define STAT_SERVEREND_ERROR \
89 response->endServer();
90
|
91 sage 1.1
|
92 w.white 1.8 #define STAT_PROVIDERSTART \
93 request->startProvider();
|
94 sage 1.1
95
|
96 w.white 1.8 #define STAT_PROVIDEREND \
97 request->endProvider();
98
99 #define STAT_COPYDISPATCHER \
100 response->setStartServerTime(request->getStartServerTime());
|
101 sage 1.1
102
103
104 // copy request timing info into response
105 #define STAT_COPYDISPATCHER_REP \
106 response->setStartServerTime(request->getStartServerTime()); \
107 response->setStartProviderTime(request->getStartProviderTime()); \
108 response->setEndProviderTime(request->getEndProviderTime());
109
|
110 w.white 1.8
111
112 /*the request size value must be stored (requSize) and passed to the StatisticalData object at the
113 end of processing other wise it will be the ONLY vlaue that is passed to the client which reports
114 the current state of the object, not the pevious (one command ago) state */
115
|
116 sage 1.1 #define STAT_BYTESREAD \
|
117 w.white 1.10 Uint16 statType = (request->getType() >= CIM_GET_CLASS_RESPONSE_MESSAGE)? \
|
118 w.white 1.8 request->getType() - CIM_GET_CLASS_RESPONSE_MESSAGE: request->getType()-1;\
|
119 w.white 1.19 StatisticalData::current()->requSize = contentLength;
|
120 w.white 1.10
121
|
122 w.white 1.8
123
|
124 sage 1.1
|
125 w.white 1.12 //serverResponseTime should be an Uint64 but the << operator wont accept that
126 #define STAT_SERVERTIME \
127 if (StatisticalData::current()->copyGSD)\
128 out << "WBEMServerResponseTime: " << (Uint32) serverResponseTime << "\r\n";
|
129 sage 1.1 #else
130 #define STAT_GETSTARTTIME
|
131 a.dunfey 1.22 #define STAT_PMS_PROVIDERSTART
|
132 sage 1.1 #define STAT_PMS_PROVIDEREND
|
133 a.dunfey 1.22 #define STAT_RESPONSEEND
|
134 sage 1.1 #define STAT_SERVERSTART
135 #define STAT_SERVEREND
136 #define STAT_SERVEREND_ERROR
137 #define STAT_PROVIDERSTART
138 #define STAT_PROVIDEREND
139 #define STAT_PROVIDEREND_REP
140 #define STAT_COPYDISPATCHER
|
141 kumpf 1.2 #define STAT_COPYDISPATCHER_REP
|
142 sage 1.1 #define STAT_BYTESREAD
143 #define STAT_SERVERTIME
|
144 w.white 1.12 #define STAT_BYTESSENT
|
145 sage 1.1 #endif
146
147 class PEGASUS_COMMON_LINKAGE StatisticalData
148 {
149 public:
150 enum StatRequestType{
151 GET_CLASS,
152 GET_INSTANCE,
|
153 jim.wunderlich 1.23 INDICATION_DELIVERY,
|
154 sage 1.1 DELETE_CLASS,
155 DELETE_INSTANCE,
156 CREATE_CLASS,
157 CREATE_INSTANCE,
158 MODIFY_CLASS,
159 MODIFY_INSTANCE,
160 ENUMERATE_CLASSES,
161 ENUMERATE_CLASS_NAMES,
162 ENUMERATE_INSTANCES,
163 ENUMERATE_INSTANCE_NAMES,
164 EXEC_QUERY,
165 ASSOCIATORS,
166 ASSOCIATOR_NAMES,
167 REFERENCES,
168 REFERENCE_NAMES,
169 GET_PROPERTY,
170 SET_PROPERTY,
171 GET_QUALIFIER,
172 SET_QUALIFIER,
173 DELETE_QUALIFIER,
174 ENUMERATE_QUALIFIERS,
|
175 denise.eckstein 1.17 INVOKE_METHOD,
|
176 sage 1.1 NUMBER_OF_TYPES
177 };
178
179 enum StatDataType{
|
180 denise.eckstein 1.18 PEGASUS_STATDATA_SERVER,
181 PEGASUS_STATDATA_PROVIDER,
182 PEGASUS_STATDATA_BYTES_SENT,
183 PEGASUS_STATDATA_BYTES_READ
|
184 sage 1.1 };
185
186 static const Uint32 length;
187 static StatisticalData* current();
188
189 StatisticalData();
190
191 timeval timestamp;
192
|
193 w.white 1.9 Sint64 numCalls[NUMBER_OF_TYPES];
194 Sint64 cimomTime[NUMBER_OF_TYPES];
195 Sint64 providerTime[NUMBER_OF_TYPES];
196 Sint64 responseSize[NUMBER_OF_TYPES];
197 Sint64 requestSize[NUMBER_OF_TYPES];
|
198 w.white 1.10 Sint64 requSize; //tempory storage for requestSize vlaue
199 Boolean copyGSD;
200 // Uint64 totalServTime;
|
201 sage 1.1 static StatisticalData* cur;
|
202 w.white 1.9 void addToValue(Sint64 value, Uint16 type, Uint32 t);
|
203 sage 1.1 static String requestName[];
|
204 w.white 1.10 void setCopyGSD(Boolean flag);
|
205 sage 1.1
206 protected:
207 Mutex _mutex;
208 };
209
210
211 PEGASUS_NAMESPACE_END
212 #endif
213
|