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

  1 karl  1.13 //%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.13 // 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 kumpf   1.16 //%/////////////////////////////////////////////////////////////////////////////
 33 w.white 1.1  
 34              
 35              #include "ClientPerfDataStore.h"
 36 david.dillard 1.8  #include <Pegasus/Common/XmlWriter.h>
 37 w.white       1.1  
 38                    PEGASUS_USING_STD;
 39 kumpf         1.16 
 40 w.white       1.1  PEGASUS_NAMESPACE_BEGIN
 41                    
 42 kumpf         1.16 ClientPerfDataStore::ClientPerfDataStore()
 43                    {
 44 a.dunfey      1.12    _classRegistered = false;
 45 kumpf         1.16 }
 46 w.white       1.1  
 47                    void ClientPerfDataStore::reset()
 48                    {
 49 w.white       1.3      _operationType = CIMOPTYPE_INVOKE_METHOD;
 50                        _serverTimeKnown = false;
 51                        _errorCondition = false;
 52 kumpf         1.16     _serverTime = 0;
 53                        _networkStartTime = TimeValue();
 54                        _networkEndTime = TimeValue();
 55                        _requestSize = 0;
 56 w.white       1.3      _responseSize = 0;
 57                        _messID = "";
 58 w.white       1.1  
 59                    }
 60                    
 61 w.white       1.4  ClientOpPerformanceData ClientPerfDataStore::createPerfDataStruct()
 62 w.white       1.1  {
 63 w.white       1.3      ClientOpPerformanceData _ClientOpPerfData_obj;
 64 kumpf         1.16     _ClientOpPerfData_obj.roundTripTime =
 65                            _networkEndTime.toMicroseconds() - _networkStartTime.toMicroseconds();
 66 w.white       1.3      _ClientOpPerfData_obj.operationType = _operationType;
 67                        _ClientOpPerfData_obj.requestSize = _requestSize;
 68                        _ClientOpPerfData_obj.responseSize = _responseSize;
 69                        _ClientOpPerfData_obj.serverTimeKnown = _serverTimeKnown;
 70 kumpf         1.16     if (_serverTimeKnown)
 71                        {
 72 w.white       1.3          _ClientOpPerfData_obj.serverTime = _serverTime;
 73                        }
 74                        return _ClientOpPerfData_obj;
 75 kumpf         1.16 }
 76 w.white       1.1  
 77 w.white       1.7  void ClientPerfDataStore::setServerTime(Uint32 time)
 78 kumpf         1.16 {
 79                        _serverTime = time;
 80 w.white       1.3      _serverTimeKnown = true;
 81 w.white       1.1  }
 82                    
 83 w.white       1.3  void ClientPerfDataStore::setResponseSize(Uint64 size)
 84 kumpf         1.16 {
 85                        _responseSize = size;
 86                    }
 87 w.white       1.1  
 88 w.white       1.3  void ClientPerfDataStore::setRequestSize(Uint64 size)
 89 kumpf         1.16 {
 90                        _requestSize = size;
 91                    }
 92 w.white       1.3  
 93 kumpf         1.16 void ClientPerfDataStore::setStartNetworkTime()
 94                    {
 95                        _networkStartTime = TimeValue::getCurrentTime();
 96                    }
 97 w.white       1.1  
 98 w.white       1.7  void ClientPerfDataStore::setEndNetworkTime(TimeValue time)
 99 kumpf         1.16 {
100                        _networkEndTime = time;
101                    }
102 w.white       1.1  
103 w.white       1.3  void ClientPerfDataStore::setServerTimeKnown(Boolean bol)
104 kumpf         1.16 {
105                        _serverTimeKnown = bol;
106                    }
107 w.white       1.1  
108                    void ClientPerfDataStore::setMessageID(String messageID)
109 kumpf         1.16 {
110                        _messID = messageID;
111                    }
112 w.white       1.1  
113 w.white       1.3  void ClientPerfDataStore::setOperationType(Uint32 type)
114 kumpf         1.16 {
115                        _operationType = Message::convertMessageTypetoCIMOpType(type);
116 w.white       1.3  }
117 w.white       1.1  
118                    
119 kumpf         1.16 Boolean ClientPerfDataStore::checkMessageIDandType(
120                        const String& messageID,
121                        Uint32 type)
122                    {
123                        if (_messID != messageID)
124                        {
125                            _errorCondition = true;
126                            return false;
127                        }
128 w.white       1.1  
129 kumpf         1.16     if (_operationType != Message::convertMessageTypetoCIMOpType(type))
130                        {
131                            _errorCondition = true;
132                            return false;
133                        }
134                    
135                        return true;
136 w.white       1.3  }
137 kumpf         1.16 
138 w.white       1.6  String ClientPerfDataStore::toString() const
139 w.white       1.3  {
140 mike          1.10     Buffer out;
141 w.white       1.3      /*XMLWriter::append(out, String(" serverTime = ");
142                        XMLWriter::append(out, _serverTime);
143                         << "\r\n";  */
144                        out << " operation type  = " << (Uint32)_operationType << "\r\n";
145 kumpf         1.16     out << " network start time is = " << _networkStartTime.toMilliseconds()
146                            << "\r\n";
147 w.white       1.7      out << " network end time = " << _networkEndTime.toMilliseconds() << "\r\n";
148 w.white       1.3      out << " numberofRequestBytes = " << (Uint32)_requestSize << "\r\n";
149                        out << " number foRespoonse Bytes = " << (Uint32)_responseSize << "\r\n";
150                        out << "the message ID is " << _messID << "\r\n";
151 kumpf         1.16 
152                        if (_errorCondition)
153                        {
154 w.white       1.3          out << "the error condition is true " << "\r\n";
155                        }
156 kumpf         1.16     else
157                        {
158 dave.sudlik   1.15         out << "the error condition is false" << "\r\n";
159 w.white       1.3      }
160 kumpf         1.16 
161                        if (_classRegistered)
162                        {
163 w.white       1.3          out << "there is a class registered" << "\r\n";
164 w.white       1.1      }
165 kumpf         1.16     else
166                        {
167 w.white       1.3          out << "no class is registered" << "\r\n";
168 w.white       1.1      }
169 kumpf         1.16 
170                        if (_serverTimeKnown)
171                        {
172 w.white       1.3          out << "_serverTimeKnown is true" << "\r\n";
173 w.white       1.1      }
174 kumpf         1.16     else
175                        {
176 w.white       1.3          out << "_serverTimeKnown is false" << "\r\n";
177 w.white       1.1      }
178 w.white       1.3  
179 kumpf         1.18     return (String(out.getData(), out.size()));
180 w.white       1.3  }
181 w.white       1.1  
182 w.white       1.6  Boolean ClientPerfDataStore::getStatError() const
183 w.white       1.3  {
184                        return _errorCondition;
185 w.white       1.1  }
186                    
187 w.white       1.3  void ClientPerfDataStore::setClassRegistered(Boolean bol)
188                    {
189                        _classRegistered = bol;
190 w.white       1.1  }
191 w.white       1.3  
192 w.white       1.6  Boolean ClientPerfDataStore::isClassRegistered() const
193 w.white       1.1  {
194 w.white       1.3      return _classRegistered;
195 w.white       1.1  }
196                    
197                    PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2