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 kumpf 1.5 #include <Pegasus/Common/Linkage.h>
|
45 sage 1.1
46 PEGASUS_NAMESPACE_BEGIN
47
48 #ifdef PEGASUS_HAS_PERFINST
49
50 #define STAT_GETSTARTTIME \
51 timeval startTime; \
52 pegasus_gettimeofday(&startTime);
53
54 #define STAT_PMS_PROVIDEREND \
55 response->endProvider(); \
56 response->setStartServerTime(request->getStartServerTime()); \
57 response->setStartProviderTime(startTime);
58
59 #define STAT_SERVERSTART request->setStartServerTime(startTime);
60
61 #define STAT_SERVEREND \
62 response->endServer(); \
63 Array<Sint8> timeOut; \
|
64 kumpf 1.4 timeOut.reserveCapacity(10); \
|
65 sage 1.1 timeOut << response->getTotalTime(); \
66 message.insert(30, timeOut.getData(), timeOut.size()); \
67 Uint32 statType = (response->getType() > CIM_GET_CLASS_RESPONSE_MESSAGE)? \
68 response->getType() - CIM_GET_CLASS_RESPONSE_MESSAGE: \
69 response->getType()-1; \
70 StatisticalData::current()->addToValue(message.size(), \
71 statType, StatisticalData::BYTES_SENT);
72
73 #define STAT_SERVEREND_ERROR response->endServer();
74
75
76 #define STAT_PROVIDERSTART request->startProvider();
77
78
79 #define STAT_PROVIDEREND request->endProvider();
80
81 #define STAT_COPYDISPATCHER response->setStartServerTime(request->getStartServerTime());
82
83
84 // copy request timing info into response
85 #define STAT_COPYDISPATCHER_REP \
86 sage 1.1 response->setStartServerTime(request->getStartServerTime()); \
87 response->setStartProviderTime(request->getStartProviderTime()); \
88 response->setEndProviderTime(request->getEndProviderTime());
89
90 #define STAT_BYTESREAD \
91 Uint32 statType = (request->getType() > CIM_GET_CLASS_RESPONSE_MESSAGE)? \
92 request->getType() - CIM_GET_CLASS_RESPONSE_MESSAGE: \
93 request->getType()-1; \
94 StatisticalData::current()->addToValue(contentLength, \
95 statType, StatisticalData::BYTES_READ);
96
97
98 #define STAT_SERVERTIME out << "Servertime: \r\n";
99 #else
100 #define STAT_GETSTARTTIME
101 #define STAT_PMS_PROVIDEREND
102 #define STAT_SERVERSTART
103 #define STAT_SERVEREND
104 #define STAT_SERVEREND_ERROR
105 #define STAT_PROVIDERSTART
106 #define STAT_PROVIDEREND
107 sage 1.1 #define STAT_PROVIDEREND_REP
108 #define STAT_COPYDISPATCHER
|
109 kumpf 1.2 #define STAT_COPYDISPATCHER_REP
|
110 sage 1.1 #define STAT_BYTESREAD
111 #define STAT_SERVERTIME
112 #endif
113
114 class PEGASUS_COMMON_LINKAGE StatisticalData
115 {
116 public:
117 enum StatRequestType{
118 GET_CLASS,
119 GET_INSTANCE,
120 DELETE_CLASS,
121 DELETE_INSTANCE,
122 CREATE_CLASS,
123 CREATE_INSTANCE,
124 MODIFY_CLASS,
125 MODIFY_INSTANCE,
126 ENUMERATE_CLASSES,
127 ENUMERATE_CLASS_NAMES,
128 ENUMERATE_INSTANCES,
129 ENUMERATE_INSTANCE_NAMES,
130 EXEC_QUERY,
131 sage 1.1 ASSOCIATORS,
132 ASSOCIATOR_NAMES,
133 REFERENCES,
134 REFERENCE_NAMES,
135 GET_PROPERTY,
136 SET_PROPERTY,
137 GET_QUALIFIER,
138 SET_QUALIFIER,
139 DELETE_QUALIFIER,
140 ENUMERATE_QUALIFIERS,
141 NUMBER_OF_TYPES
142 };
143
144 enum StatDataType{
145 SERVER,
146 PROVIDER,
147 BYTES_SENT,
148 BYTES_READ
149 };
150
151 static const Uint32 length;
152 sage 1.1 static StatisticalData* current();
153
154 StatisticalData();
155
156 timeval timestamp;
157
158 Uint64 numCalls[NUMBER_OF_TYPES];
159 Uint64 cimomTime[NUMBER_OF_TYPES];
160 Uint64 providerTime[NUMBER_OF_TYPES];
161 Uint64 responseSize[NUMBER_OF_TYPES];
162 Uint64 requestSize[NUMBER_OF_TYPES];
163 static StatisticalData* cur;
164 void addToValue(Uint64 value, Uint16 type, Uint32 t);
165 static String requestName[];
166
167 protected:
168 Mutex _mutex;
169 };
170
171
172 PEGASUS_NAMESPACE_END
173 sage 1.1 #endif
174
|