(file) Return to ClientPerfDataStore.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Client

  1 martin 1.21 //%LICENSE////////////////////////////////////////////////////////////////
  2 martin 1.22 //
  3 martin 1.21 // Licensed to The Open Group (TOG) under one or more contributor license
  4             // agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
  5             // this work for additional information regarding copyright ownership.
  6             // Each contributor licenses this file to you under the OpenPegasus Open
  7             // Source License; you may not use this file except in compliance with the
  8             // License.
  9 martin 1.22 //
 10 martin 1.21 // Permission is hereby granted, free of charge, to any person obtaining a
 11             // copy of this software and associated documentation files (the "Software"),
 12             // to deal in the Software without restriction, including without limitation
 13             // the rights to use, copy, modify, merge, publish, distribute, sublicense,
 14             // and/or sell copies of the Software, and to permit persons to whom the
 15             // Software is furnished to do so, subject to the following conditions:
 16 martin 1.22 //
 17 martin 1.21 // The above copyright notice and this permission notice shall be included
 18             // in all copies or substantial portions of the Software.
 19 martin 1.22 //
 20 martin 1.21 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 21 martin 1.22 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 22 martin 1.21 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 23             // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 24             // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 25             // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 26             // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 27 martin 1.22 //
 28 martin 1.21 //////////////////////////////////////////////////////////////////////////
 29 w.white 1.1  //
 30 kumpf   1.16 //%/////////////////////////////////////////////////////////////////////////////
 31 w.white 1.1  
 32              
 33              #include "ClientPerfDataStore.h"
 34 david.dillard 1.8  #include <Pegasus/Common/XmlWriter.h>
 35 w.white       1.1  
 36                    PEGASUS_USING_STD;
 37 kumpf         1.16 
 38 w.white       1.1  PEGASUS_NAMESPACE_BEGIN
 39                    
 40 kumpf         1.16 ClientPerfDataStore::ClientPerfDataStore()
 41                    {
 42 a.dunfey      1.12    _classRegistered = false;
 43 kumpf         1.16 }
 44 w.white       1.1  
 45                    void ClientPerfDataStore::reset()
 46                    {
 47 w.white       1.3      _operationType = CIMOPTYPE_INVOKE_METHOD;
 48                        _serverTimeKnown = false;
 49                        _errorCondition = false;
 50 kumpf         1.16     _serverTime = 0;
 51                        _networkStartTime = TimeValue();
 52                        _networkEndTime = TimeValue();
 53                        _requestSize = 0;
 54 w.white       1.3      _responseSize = 0;
 55                        _messID = "";
 56 w.white       1.1  
 57                    }
 58                    
 59 w.white       1.4  ClientOpPerformanceData ClientPerfDataStore::createPerfDataStruct()
 60 w.white       1.1  {
 61 w.white       1.3      ClientOpPerformanceData _ClientOpPerfData_obj;
 62 kumpf         1.16     _ClientOpPerfData_obj.roundTripTime =
 63                            _networkEndTime.toMicroseconds() - _networkStartTime.toMicroseconds();
 64 w.white       1.3      _ClientOpPerfData_obj.operationType = _operationType;
 65                        _ClientOpPerfData_obj.requestSize = _requestSize;
 66                        _ClientOpPerfData_obj.responseSize = _responseSize;
 67                        _ClientOpPerfData_obj.serverTimeKnown = _serverTimeKnown;
 68 kumpf         1.16     if (_serverTimeKnown)
 69                        {
 70 w.white       1.3          _ClientOpPerfData_obj.serverTime = _serverTime;
 71                        }
 72                        return _ClientOpPerfData_obj;
 73 kumpf         1.16 }
 74 w.white       1.1  
 75 w.white       1.7  void ClientPerfDataStore::setServerTime(Uint32 time)
 76 kumpf         1.16 {
 77                        _serverTime = time;
 78 w.white       1.3      _serverTimeKnown = true;
 79 w.white       1.1  }
 80                    
 81 kumpf         1.20 void ClientPerfDataStore::setResponseSize(Uint32 size)
 82 kumpf         1.16 {
 83                        _responseSize = size;
 84                    }
 85 w.white       1.1  
 86 kumpf         1.20 void ClientPerfDataStore::setRequestSize(Uint32 size)
 87 kumpf         1.16 {
 88                        _requestSize = size;
 89                    }
 90 w.white       1.3  
 91 kumpf         1.16 void ClientPerfDataStore::setStartNetworkTime()
 92                    {
 93                        _networkStartTime = TimeValue::getCurrentTime();
 94                    }
 95 w.white       1.1  
 96 w.white       1.7  void ClientPerfDataStore::setEndNetworkTime(TimeValue time)
 97 kumpf         1.16 {
 98                        _networkEndTime = time;
 99                    }
100 w.white       1.1  
101 w.white       1.3  void ClientPerfDataStore::setServerTimeKnown(Boolean bol)
102 kumpf         1.16 {
103                        _serverTimeKnown = bol;
104                    }
105 w.white       1.1  
106                    void ClientPerfDataStore::setMessageID(String messageID)
107 kumpf         1.16 {
108                        _messID = messageID;
109                    }
110 w.white       1.1  
111 kumpf         1.19 void ClientPerfDataStore::setOperationType(MessageType type)
112 kumpf         1.16 {
113                        _operationType = Message::convertMessageTypetoCIMOpType(type);
114 w.white       1.3  }
115 w.white       1.1  
116                    
117 kumpf         1.16 Boolean ClientPerfDataStore::checkMessageIDandType(
118                        const String& messageID,
119 kumpf         1.19     MessageType type)
120 kumpf         1.16 {
121                        if (_messID != messageID)
122                        {
123                            _errorCondition = true;
124                            return false;
125                        }
126 w.white       1.1  
127 kumpf         1.16     if (_operationType != Message::convertMessageTypetoCIMOpType(type))
128                        {
129                            _errorCondition = true;
130                            return false;
131                        }
132                    
133                        return true;
134 w.white       1.3  }
135 kumpf         1.16 
136 w.white       1.6  String ClientPerfDataStore::toString() const
137 w.white       1.3  {
138 mike          1.10     Buffer out;
139 kumpf         1.20     out << " operation type = " << (Uint32)_operationType << "\r\n";
140                        out << " network start time = "
141                            << CIMValue(_networkStartTime.toMilliseconds()).toString()
142 kumpf         1.16         << "\r\n";
143 kumpf         1.20     out << " network end time = "
144                            << CIMValue(_networkEndTime.toMilliseconds()).toString()
145                            << "\r\n";
146                        out << " number of request bytes = " << _requestSize << "\r\n";
147                        out << " number of response bytes = " << _responseSize << "\r\n";
148                        out << "message ID = " << _messID << "\r\n";
149 kumpf         1.16 
150                        if (_errorCondition)
151                        {
152 w.white       1.3          out << "the error condition is true " << "\r\n";
153                        }
154 kumpf         1.16     else
155                        {
156 dave.sudlik   1.15         out << "the error condition is false" << "\r\n";
157 w.white       1.3      }
158 kumpf         1.16 
159                        if (_classRegistered)
160                        {
161 w.white       1.3          out << "there is a class registered" << "\r\n";
162 w.white       1.1      }
163 kumpf         1.16     else
164                        {
165 w.white       1.3          out << "no class is registered" << "\r\n";
166 w.white       1.1      }
167 kumpf         1.16 
168                        if (_serverTimeKnown)
169                        {
170 w.white       1.3          out << "_serverTimeKnown is true" << "\r\n";
171 kumpf         1.20         out << "_serverTime = " << _serverTime << "\r\n";
172 w.white       1.1      }
173 kumpf         1.16     else
174                        {
175 w.white       1.3          out << "_serverTimeKnown is false" << "\r\n";
176 w.white       1.1      }
177 w.white       1.3  
178 kumpf         1.18     return (String(out.getData(), out.size()));
179 w.white       1.3  }
180 w.white       1.1  
181 w.white       1.6  Boolean ClientPerfDataStore::getStatError() const
182 w.white       1.3  {
183                        return _errorCondition;
184 w.white       1.1  }
185                    
186 w.white       1.3  void ClientPerfDataStore::setClassRegistered(Boolean bol)
187                    {
188                        _classRegistered = bol;
189 w.white       1.1  }
190 w.white       1.3  
191 w.white       1.6  Boolean ClientPerfDataStore::isClassRegistered() const
192 w.white       1.1  {
193 w.white       1.3      return _classRegistered;
194 w.white       1.1  }
195                    
196                    PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2