1 karl 1.9 //%2006////////////////////////////////////////////////////////////////////////
|
2 w.white 1.1 //
3 // 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 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
8 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
|
9 karl 1.2 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
10 // EMC Corporation; VERITAS Software Corporation; The Open Group.
|
11 karl 1.9 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
12 // EMC Corporation; Symantec Corporation; The Open Group.
|
13 w.white 1.1 //
14 // Permission is hereby granted, free of charge, to any person obtaining a copy
15 // of this software and associated documentation files (the "Software"), to
16 // deal in the Software without restriction, including without limitation the
17 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
18 // sell copies of the Software, and to permit persons to whom the Software is
19 // furnished to do so, subject to the following conditions:
20 //
21 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
22 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
23 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
24 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
25 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
26 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
27 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 //
30 //==============================================================================
31 //
32 //%/////////////////////////////////////////////////////////////////////////////
33
34 w.white 1.1 #ifndef ClientOpPerformanceDataHandler_h
35 #define ClientOpPerformanceDataHandler_h
36
|
37 kumpf 1.8 #include <Pegasus/Common/CIMOperationType.h>
|
38 w.white 1.3 #include <Pegasus/Client/Linkage.h>
|
39 w.white 1.1
|
40 david.dillard 1.4 PEGASUS_NAMESPACE_BEGIN
|
41 w.white 1.3
|
42 w.white 1.1
|
43 w.white 1.3 struct PEGASUS_CLIENT_LINKAGE ClientOpPerformanceData
|
44 w.white 1.1 {
|
45 kumpf 1.8 /** Identifies the operation type for the statistical information
46 provided.
|
47 w.white 1.1 */
48 CIMOperationType operationType;
49
|
50 kumpf 1.8 /** Indicates whether the serverTime member contains valid data. This
51 flag is true if a WBEMServerResponseTime value is received from the
52 CIM Server, false otherwise.
|
53 w.white 1.1 */
|
54 w.white 1.3 Boolean serverTimeKnown;
|
55 w.white 1.1
|
56 kumpf 1.8 /** Contains the number of microseconds elapsed during the CIM Server
57 processing of the request.
|
58 dave.sudlik 1.10 WARNING: This elapsed time may be constrained by limitations in the
59 granularity of the system clock on certain platforms.
|
60 w.white 1.1 */
61 Uint64 serverTime;
62
|
63 kumpf 1.8 /** Contains the number of microseconds elapsed during the complete
64 processing of the request, including time spent on the network and
65 in the CIM Server (serverTime).
|
66 dave.sudlik 1.10 WARNING: This elapsed time may be constrained by limitations in the
67 granularity of the system clock on certain platforms.
|
68 w.white 1.1 */
69 Uint64 roundTripTime;
70
|
71 kumpf 1.8 /** Contains the size of the request message (in bytes).
|
72 w.white 1.1 */
|
73 kumpf 1.8 Uint64 requestSize;
|
74 w.white 1.1
|
75 kumpf 1.8 /** Contains the size of the response message (in bytes).
|
76 w.white 1.1 */
|
77 kumpf 1.8 Uint64 responseSize;
78 };
|
79 w.white 1.3
80
|
81 kumpf 1.8 /** A ClientOpPerformanceDataHandler subclass object may be registered with a
82 CIMClient object by a client application. The subclass object must not
83 be destructed while it is registered with a CIMClient object, so it is
84 recommended that these objects have the same scope.
85 */
|
86 w.white 1.3 class PEGASUS_CLIENT_LINKAGE ClientOpPerformanceDataHandler
87 {
88 public:
89
|
90 kumpf 1.8 virtual ~ClientOpPerformanceDataHandler();
91
92 /**
93 Processes client operation performance data. When a
94 ClientOpPerformanceDataHandler subclass object is registered with a
95 CIMClient object, this method is called by the CIMClient object with
96 performance data for each completed CIM operation.
97
98 This method may, for example, accumulate the performance data to
99 calculate average processing times for multiple operations.
100
101 Exceptions thrown by this method are not caught by the CIMClient.
102 Therefore, a client application would receive an exception from this
103 method in place of CIM operation response data.
104
105 @param item A ClientOpPerformanceData object containing performance
106 data for a single CIM operation.
107 */
108 virtual void handleClientOpPerformanceData(
109 const ClientOpPerformanceData& item) = 0;
110 };
|
111 w.white 1.3
112
113 /*
114
|
115 kumpf 1.8 The following example shows how a ClientOpPerformanceDataHandler callback may
116 be used by a client application.
|
117 w.white 1.3
|
118 kumpf 1.8 // A ClientOpPerformanceDataHandler implementation that simply prints the
119 // data from the ClientOpPerformanceData object.
|
120 w.white 1.3
121 class ClientStatisticsAccumulator : public ClientOpPerformanceDataHandler
122 {
123 public:
124
|
125 kumpf 1.8 virtual void handleClientOpPerformanceData(
126 const ClientOpPerformanceData& item)
127 {
128 cout << "ClientStatisticsAccumulator data:" << endl;
129 cout << " operationType is " << (Uint32)item.operationType << endl;
130 cout << " serverTime is " << (Uint32)item.serverTime << endl;
131 cout << " roundTripTime is " << (Uint32)item.roundTripTime << endl;
132 cout << " requestSize is " << (Uint32)item.requestSize << endl;
133 cout << " responseSize is " << (Uint32)item.responseSize << endl;
134 if (item.serverTimeKnown)
135 {
136 cout << " serverTimeKnown is true" << endl;
137 }
138 else
|
139 w.white 1.3 {
|
140 kumpf 1.8 cout << " serverTimeKnown is false" << endl;
|
141 w.white 1.3 }
|
142 kumpf 1.8 }
|
143 w.white 1.3 };
144
145 int main(int argc, char** argv)
146 {
|
147 kumpf 1.8 // Establish the namespace from the input parameters
148 String nameSpace = "root/cimv2";
|
149 w.white 1.3
|
150 kumpf 1.8 //Get hostname
151 String location = "localhost";
|
152 w.white 1.3
|
153 kumpf 1.8 //Get port number
154 Uint32 port = 5988;
|
155 w.white 1.3
|
156 kumpf 1.8 //Get user name and password
157 String userN = String::EMPTY;
158 String passW = String::EMPTY;
159
160 // Connect to the server
161
162 String className = "PG_ComputerSystem";
163 CIMClient client;
164 // Note: The ClientStatisticsAccumulator object should have the same
165 // scope as the CIMClient object.
166 ClientStatisticsAccumulator accumulator;
167
168 try
169 {
170 client.connect(location, port, userN, passW);
171 }
172 catch (Exception& e)
173 {
174 cerr << argv[0] << "Exception connecting to: " << location << endl;
175 cerr << e.getMessage() << endl;
176 exit(1);
177 kumpf 1.8 }
178
179 ///////////////////////////////////////////////////
180 // Register callback and EnumerateInstances
181 /////////////////////////////////////////////////////
182
183 client.registerClientOpPerformanceDataHandler(accumulator);
184
185 try
186 {
187 Array<CIMObjectPath> instances;
188
189 // Note: Completion of this CIMClient operation will invoke the
190 // ClientOpPerformanceDataHandler callback.
191 instances = client.enumerateInstanceNames(nameSpace, className);
192 }
193 catch (Exception& e)
194 {
195 cerr << "Exception: " << e.getMessage() << endl;
196 exit(1);
197 }
|
198 w.white 1.3
|
199 kumpf 1.8 return 0;
|
200 w.white 1.3 }
201
202 */
203
|
204 w.white 1.1
205 PEGASUS_NAMESPACE_END
206
207 #endif /* ClientOpPerformanceDataHandler_h */
208
|
209 w.white 1.3
|