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