1 karl 1.13 //%2004////////////////////////////////////////////////////////////////////////
|
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 sage 1.1 //
10 // Permission is hereby granted, free of charge, to any person obtaining a copy
11 // of this software and associated documentation files (the "Software"), to
12 // deal in the Software without restriction, including without limitation the
13 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
14 // sell copies of the Software, and to permit persons to whom the Software is
15 // furnished to do so, subject to the following conditions:
|
16 kumpf 1.3 //
|
17 sage 1.1 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
18 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
19 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
20 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
21 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
23 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 //
26 //==============================================================================
27 //
28 // Author: Arthur Pichlkostner
29 // (checked in: Markus Mueller sedgewick_de@yahoo.de)
|
30 kumpf 1.3 //
31 // Modified By:
|
32 sage 1.1 //
33 //%/////////////////////////////////////////////////////////////////////////////
34
35 #ifndef STATISTICAL_DATA_H
36 #define STATISTICAL_DATA_H
37
38 #include <Pegasus/Common/Config.h>
|
39 w.white 1.11 #include <iostream>
|
40 sage 1.1 #include <cstring>
|
41 kumpf 1.6 #include <Pegasus/Common/InternalException.h>
|
42 sage 1.1 #include <Pegasus/Common/IPC.h>
43 #include <Pegasus/Common/String.h>
44 #include <Pegasus/Common/CIMProperty.h>
45 #include <Pegasus/Common/CIMInstance.h>
|
46 w.white 1.8 #include <Pegasus/Common/CIMDateTime.h>
|
47 kumpf 1.5 #include <Pegasus/Common/Linkage.h>
|
48 sage 1.1
49 PEGASUS_NAMESPACE_BEGIN
50
51 #ifdef PEGASUS_HAS_PERFINST
52
53 #define STAT_GETSTARTTIME \
|
54 w.white 1.9 CIMDateTime startTime = CIMDateTime::getCurrentDateTime();\
|
55 w.white 1.8
|
56 sage 1.1
57 #define STAT_PMS_PROVIDEREND \
58 response->endProvider(); \
59 response->setStartServerTime(request->getStartServerTime()); \
60 response->setStartProviderTime(startTime);
61
|
62 w.white 1.8
63 #define STAT_SERVERSTART \
64 request->setStartServerTime(startTime);
65
|
66 sage 1.1
67 #define STAT_SERVEREND \
|
68 w.white 1.8 response->endServer();\
|
69 w.white 1.12
70 #define STAT_BYTESSENT \
|
71 w.white 1.10 Uint16 statType = (response->getType() >= CIM_GET_CLASS_RESPONSE_MESSAGE)? \
|
72 w.white 1.12 response->getType() - CIM_GET_CLASS_RESPONSE_MESSAGE:response->getType() - 1;\
|
73 w.white 1.9 StatisticalData::current()->addToValue(message.size(), statType, StatisticalData::BYTES_SENT);
|
74 w.white 1.8
|
75 w.white 1.10
76
|
77 w.white 1.8 #define STAT_SERVEREND_ERROR \
78 response->endServer();
79
|
80 sage 1.1
|
81 w.white 1.8 #define STAT_PROVIDERSTART \
82 request->startProvider();
|
83 sage 1.1
84
|
85 w.white 1.8 #define STAT_PROVIDEREND \
86 request->endProvider();
87
88 #define STAT_COPYDISPATCHER \
89 response->setStartServerTime(request->getStartServerTime());
|
90 sage 1.1
91
92
93 // copy request timing info into response
94 #define STAT_COPYDISPATCHER_REP \
95 response->setStartServerTime(request->getStartServerTime()); \
96 response->setStartProviderTime(request->getStartProviderTime()); \
97 response->setEndProviderTime(request->getEndProviderTime());
98
|
99 w.white 1.8
100
101 /*the request size value must be stored (requSize) and passed to the StatisticalData object at the
102 end of processing other wise it will be the ONLY vlaue that is passed to the client which reports
103 the current state of the object, not the pevious (one command ago) state */
104
|
105 sage 1.1 #define STAT_BYTESREAD \
|
106 w.white 1.10 Uint16 statType = (request->getType() >= CIM_GET_CLASS_RESPONSE_MESSAGE)? \
|
107 w.white 1.8 request->getType() - CIM_GET_CLASS_RESPONSE_MESSAGE: request->getType()-1;\
|
108 w.white 1.10 StatisticalData::current()->requSize = contentLength; \
109 StatisticalData::current()->addToValue(contentLength, statType, StatisticalData::BYTES_READ);
110
111
|
112 w.white 1.8
113
|
114 sage 1.1
|
115 w.white 1.12 //serverResponseTime should be an Uint64 but the << operator wont accept that
116 #define STAT_SERVERTIME \
117 if (StatisticalData::current()->copyGSD)\
118 out << "WBEMServerResponseTime: " << (Uint32) serverResponseTime << "\r\n";
|
119 sage 1.1 #else
120 #define STAT_GETSTARTTIME
121 #define STAT_PMS_PROVIDEREND
122 #define STAT_SERVERSTART
123 #define STAT_SERVEREND
124 #define STAT_SERVEREND_ERROR
125 #define STAT_PROVIDERSTART
126 #define STAT_PROVIDEREND
127 #define STAT_PROVIDEREND_REP
128 #define STAT_COPYDISPATCHER
|
129 kumpf 1.2 #define STAT_COPYDISPATCHER_REP
|
130 sage 1.1 #define STAT_BYTESREAD
131 #define STAT_SERVERTIME
|
132 w.white 1.12 #define STAT_BYTESSENT
|
133 sage 1.1 #endif
134
135 class PEGASUS_COMMON_LINKAGE StatisticalData
136 {
137 public:
138 enum StatRequestType{
139 GET_CLASS,
140 GET_INSTANCE,
|
141 w.white 1.10 EXPORT_INDICATION,
|
142 sage 1.1 DELETE_CLASS,
143 DELETE_INSTANCE,
144 CREATE_CLASS,
145 CREATE_INSTANCE,
146 MODIFY_CLASS,
147 MODIFY_INSTANCE,
148 ENUMERATE_CLASSES,
149 ENUMERATE_CLASS_NAMES,
150 ENUMERATE_INSTANCES,
151 ENUMERATE_INSTANCE_NAMES,
152 EXEC_QUERY,
153 ASSOCIATORS,
154 ASSOCIATOR_NAMES,
155 REFERENCES,
156 REFERENCE_NAMES,
157 GET_PROPERTY,
158 SET_PROPERTY,
159 GET_QUALIFIER,
160 SET_QUALIFIER,
161 DELETE_QUALIFIER,
162 ENUMERATE_QUALIFIERS,
163 sage 1.1 NUMBER_OF_TYPES
164 };
165
166 enum StatDataType{
167 SERVER,
168 PROVIDER,
169 BYTES_SENT,
170 BYTES_READ
171 };
172
173 static const Uint32 length;
174 static StatisticalData* current();
175
176 StatisticalData();
177
178 timeval timestamp;
179
|
180 w.white 1.9 Sint64 numCalls[NUMBER_OF_TYPES];
181 Sint64 cimomTime[NUMBER_OF_TYPES];
182 Sint64 providerTime[NUMBER_OF_TYPES];
183 Sint64 responseSize[NUMBER_OF_TYPES];
184 Sint64 requestSize[NUMBER_OF_TYPES];
|
185 w.white 1.10 Sint64 requSize; //tempory storage for requestSize vlaue
186 Boolean copyGSD;
187 // Uint64 totalServTime;
|
188 sage 1.1 static StatisticalData* cur;
|
189 w.white 1.9 void addToValue(Sint64 value, Uint16 type, Uint32 t);
|
190 sage 1.1 static String requestName[];
|
191 w.white 1.10 void setCopyGSD(Boolean flag);
|
192 sage 1.1
193 protected:
194 Mutex _mutex;
195 };
196
197
198 PEGASUS_NAMESPACE_END
199 #endif
200
|