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