1 kumpf 1.3 //%/////////////////////////////////////////////////////////////////////////////
|
2 sage 1.1 //
|
3 kumpf 1.3 // Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM,
4 // The Open Group, Tivoli Systems
|
5 sage 1.1 //
6 // Permission is hereby granted, free of charge, to any person obtaining a copy
7 // of this software and associated documentation files (the "Software"), to
8 // deal in the Software without restriction, including without limitation the
9 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 // sell copies of the Software, and to permit persons to whom the Software is
11 // furnished to do so, subject to the following conditions:
|
12 kumpf 1.3 //
|
13 sage 1.1 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
14 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
15 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
16 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
17 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
18 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
19 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 //
22 //==============================================================================
23 //
24 // Author: Arthur Pichlkostner
25 // (checked in: Markus Mueller sedgewick_de@yahoo.de)
|
26 kumpf 1.3 //
27 // Modified By:
|
28 sage 1.1 //
29 //%/////////////////////////////////////////////////////////////////////////////
30
31 #ifndef STATISTICAL_DATA_H
32 #define STATISTICAL_DATA_H
33
34 #include <Pegasus/Common/Config.h>
35 #include <iostream>
36 #include <cstring>
|
37 kumpf 1.6 #include <Pegasus/Common/InternalException.h>
|
38 sage 1.1 #include <Pegasus/Common/IPC.h>
39 #include <Pegasus/Common/String.h>
40 #include <Pegasus/Common/CIMProperty.h>
41 #include <Pegasus/Common/CIMInstance.h>
|
42 kumpf 1.5 #include <Pegasus/Common/Linkage.h>
|
43 sage 1.1
44 PEGASUS_NAMESPACE_BEGIN
45
46 #ifdef PEGASUS_HAS_PERFINST
47
48 #define STAT_GETSTARTTIME \
49 timeval startTime; \
50 pegasus_gettimeofday(&startTime);
51
52 #define STAT_PMS_PROVIDEREND \
53 response->endProvider(); \
54 response->setStartServerTime(request->getStartServerTime()); \
55 response->setStartProviderTime(startTime);
56
57 #define STAT_SERVERSTART request->setStartServerTime(startTime);
58
59 #define STAT_SERVEREND \
60 response->endServer(); \
61 Array<Sint8> timeOut; \
|
62 kumpf 1.4 timeOut.reserveCapacity(10); \
|
63 sage 1.1 timeOut << response->getTotalTime(); \
64 message.insert(30, timeOut.getData(), timeOut.size()); \
65 Uint32 statType = (response->getType() > CIM_GET_CLASS_RESPONSE_MESSAGE)? \
66 response->getType() - CIM_GET_CLASS_RESPONSE_MESSAGE: \
67 response->getType()-1; \
68 StatisticalData::current()->addToValue(message.size(), \
69 statType, StatisticalData::BYTES_SENT);
70
71 #define STAT_SERVEREND_ERROR response->endServer();
72
73
74 #define STAT_PROVIDERSTART request->startProvider();
75
76
77 #define STAT_PROVIDEREND request->endProvider();
78
79 #define STAT_COPYDISPATCHER response->setStartServerTime(request->getStartServerTime());
80
81
82 // copy request timing info into response
83 #define STAT_COPYDISPATCHER_REP \
84 sage 1.1 response->setStartServerTime(request->getStartServerTime()); \
85 response->setStartProviderTime(request->getStartProviderTime()); \
86 response->setEndProviderTime(request->getEndProviderTime());
87
88 #define STAT_BYTESREAD \
89 Uint32 statType = (request->getType() > CIM_GET_CLASS_RESPONSE_MESSAGE)? \
90 request->getType() - CIM_GET_CLASS_RESPONSE_MESSAGE: \
91 request->getType()-1; \
92 StatisticalData::current()->addToValue(contentLength, \
93 statType, StatisticalData::BYTES_READ);
94
95
96 #define STAT_SERVERTIME out << "Servertime: \r\n";
97 #else
98 #define STAT_GETSTARTTIME
99 #define STAT_PMS_PROVIDEREND
100 #define STAT_SERVERSTART
101 #define STAT_SERVEREND
102 #define STAT_SERVEREND_ERROR
103 #define STAT_PROVIDERSTART
104 #define STAT_PROVIDEREND
105 sage 1.1 #define STAT_PROVIDEREND_REP
106 #define STAT_COPYDISPATCHER
|
107 kumpf 1.2 #define STAT_COPYDISPATCHER_REP
|
108 sage 1.1 #define STAT_BYTESREAD
109 #define STAT_SERVERTIME
110 #endif
111
112 class PEGASUS_COMMON_LINKAGE StatisticalData
113 {
114 public:
115 enum StatRequestType{
116 GET_CLASS,
117 GET_INSTANCE,
118 DELETE_CLASS,
119 DELETE_INSTANCE,
120 CREATE_CLASS,
121 CREATE_INSTANCE,
122 MODIFY_CLASS,
123 MODIFY_INSTANCE,
124 ENUMERATE_CLASSES,
125 ENUMERATE_CLASS_NAMES,
126 ENUMERATE_INSTANCES,
127 ENUMERATE_INSTANCE_NAMES,
128 EXEC_QUERY,
129 sage 1.1 ASSOCIATORS,
130 ASSOCIATOR_NAMES,
131 REFERENCES,
132 REFERENCE_NAMES,
133 GET_PROPERTY,
134 SET_PROPERTY,
135 GET_QUALIFIER,
136 SET_QUALIFIER,
137 DELETE_QUALIFIER,
138 ENUMERATE_QUALIFIERS,
139 NUMBER_OF_TYPES
140 };
141
142 enum StatDataType{
143 SERVER,
144 PROVIDER,
145 BYTES_SENT,
146 BYTES_READ
147 };
148
149 static const Uint32 length;
150 sage 1.1 static StatisticalData* current();
151
152 StatisticalData();
153
154 timeval timestamp;
155
156 Uint64 numCalls[NUMBER_OF_TYPES];
157 Uint64 cimomTime[NUMBER_OF_TYPES];
158 Uint64 providerTime[NUMBER_OF_TYPES];
159 Uint64 responseSize[NUMBER_OF_TYPES];
160 Uint64 requestSize[NUMBER_OF_TYPES];
161 static StatisticalData* cur;
162 void addToValue(Uint64 value, Uint16 type, Uint32 t);
163 static String requestName[];
164
165 protected:
166 Mutex _mutex;
167 };
168
169
170 PEGASUS_NAMESPACE_END
171 sage 1.1 #endif
172
|