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 #include <iostream>
38 #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.8 CIMDateTime startTime = CIMDateTime::getCurrentDateTime();
53
|
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 Uint32 statType = (response->getType() >= CIM_GET_CLASS_RESPONSE_MESSAGE)? \
68 response->getType() - CIM_GET_CLASS_RESPONSE_MESSAGE:response->getType() - 1;\
69 StatisticalData::current()->addToValue(message.size(), statType, StatisticalData::BYTES_SENT);\
70 printf("SERVEREND\n");\
71 StatisticalData::current()->addToValue(StatisticalData::current()->requSize, statType,\
72 StatisticalData::BYTES_READ);\
73 cout <<"cim_get_class_resopons_message= "<< CIM_GET_CLASS_RESPONSE_MESSAGE\
74 <<"and gettype = "<< response->getType() << endl;
75
76
77
78 #define STAT_SERVEREND_ERROR \
79 response->endServer();
80
|
81 sage 1.1
|
82 w.white 1.8 #define STAT_PROVIDERSTART \
83 request->startProvider();
|
84 sage 1.1
85
|
86 w.white 1.8 #define STAT_PROVIDEREND \
87 request->endProvider();
88
89
90 #define STAT_COPYDISPATCHER \
91 response->setStartServerTime(request->getStartServerTime());
|
92 sage 1.1
93
94
95
96
97 // copy request timing info into response
98 #define STAT_COPYDISPATCHER_REP \
99 response->setStartServerTime(request->getStartServerTime()); \
100 response->setStartProviderTime(request->getStartProviderTime()); \
101 response->setEndProviderTime(request->getEndProviderTime());
102
|
103 w.white 1.8
104
105 /*the request size value must be stored (requSize) and passed to the StatisticalData object at the
106 end of processing other wise it will be the ONLY vlaue that is passed to the client which reports
107 the current state of the object, not the pevious (one command ago) state */
108
|
109 sage 1.1 #define STAT_BYTESREAD \
|
110 w.white 1.8 Uint32 statType = (request->getType() >= CIM_GET_CLASS_RESPONSE_MESSAGE)? \
111 request->getType() - CIM_GET_CLASS_RESPONSE_MESSAGE: request->getType()-1;\
112 StatisticalData::current()->requSize = contentLength;
113
114
|
115 sage 1.1
116
117 #define STAT_SERVERTIME out << "Servertime: \r\n";
118 #else
119 #define STAT_GETSTARTTIME
120 #define STAT_PMS_PROVIDEREND
121 #define STAT_SERVERSTART
122 #define STAT_SERVEREND
123 #define STAT_SERVEREND_ERROR
124 #define STAT_PROVIDERSTART
125 #define STAT_PROVIDEREND
126 #define STAT_PROVIDEREND_REP
127 #define STAT_COPYDISPATCHER
|
128 kumpf 1.2 #define STAT_COPYDISPATCHER_REP
|
129 sage 1.1 #define STAT_BYTESREAD
130 #define STAT_SERVERTIME
131 #endif
132
133 class PEGASUS_COMMON_LINKAGE StatisticalData
134 {
135 public:
136 enum StatRequestType{
137 GET_CLASS,
138 GET_INSTANCE,
|
139 w.white 1.8 EXPORT_INDICATION,
|
140 sage 1.1 DELETE_CLASS,
141 DELETE_INSTANCE,
142 CREATE_CLASS,
143 CREATE_INSTANCE,
144 MODIFY_CLASS,
145 MODIFY_INSTANCE,
146 ENUMERATE_CLASSES,
147 ENUMERATE_CLASS_NAMES,
148 ENUMERATE_INSTANCES,
149 ENUMERATE_INSTANCE_NAMES,
150 EXEC_QUERY,
151 ASSOCIATORS,
152 ASSOCIATOR_NAMES,
153 REFERENCES,
154 REFERENCE_NAMES,
155 GET_PROPERTY,
156 SET_PROPERTY,
157 GET_QUALIFIER,
158 SET_QUALIFIER,
159 DELETE_QUALIFIER,
160 ENUMERATE_QUALIFIERS,
161 sage 1.1 NUMBER_OF_TYPES
162 };
163
164 enum StatDataType{
165 SERVER,
166 PROVIDER,
167 BYTES_SENT,
168 BYTES_READ
169 };
170
171 static const Uint32 length;
172 static StatisticalData* current();
173
174 StatisticalData();
175
176 timeval timestamp;
177
178 Uint64 numCalls[NUMBER_OF_TYPES];
|
179 w.white 1.8 __int64 cimomTime[NUMBER_OF_TYPES];
180 __int64 providerTime[NUMBER_OF_TYPES];
|
181 sage 1.1 Uint64 responseSize[NUMBER_OF_TYPES];
182 Uint64 requestSize[NUMBER_OF_TYPES];
|
183 w.white 1.8 Uint64 requSize; //tempory storage for requestSize vlaue
|
184 sage 1.1 static StatisticalData* cur;
185 void addToValue(Uint64 value, Uint16 type, Uint32 t);
186 static String requestName[];
187
188 protected:
189 Mutex _mutex;
190 };
191
192
193 PEGASUS_NAMESPACE_END
194 #endif
195
|