(file) Return to StatisticalData.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

  1 karl  1.21 //%2006////////////////////////////////////////////////////////////////////////
  2 sage  1.1  //
  3 karl  1.13 // 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 karl  1.7  // IBM Corp.; EMC Corporation, The Open Group.
  7 karl  1.13 // 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.15 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 10            // EMC Corporation; VERITAS Software Corporation; The Open Group.
 11 karl  1.21 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 12            // EMC Corporation; Symantec Corporation; The Open Group.
 13 sage  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 kumpf 1.3  // 
 21 sage  1.1  // 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 kumpf 1.25 #ifndef Pegasus_StatisticalData_h
 35            #define Pegasus_StatisticalData_h
 36 sage  1.1  
 37            #include <Pegasus/Common/Config.h>
 38 w.white 1.11 #include <iostream>
 39 sage    1.1  #include <cstring>
 40 mike    1.24 #include <Pegasus/Common/Linkage.h>
 41 kumpf   1.6  #include <Pegasus/Common/InternalException.h>
 42 sage    1.1  #include <Pegasus/Common/String.h>
 43              #include <Pegasus/Common/CIMProperty.h>
 44              #include <Pegasus/Common/CIMInstance.h>
 45 w.white 1.8  #include <Pegasus/Common/CIMDateTime.h>
 46 kumpf   1.25 #include <Pegasus/Common/CIMMessage.h>
 47 mike    1.24 #include <Pegasus/Common/Mutex.h>
 48              #include <Pegasus/Common/Time.h>
 49 sage    1.1  
 50              PEGASUS_NAMESPACE_BEGIN
 51              
 52 karl    1.14 #ifndef PEGASUS_DISABLE_PERFINST
 53 sage    1.1  
 54              #define STAT_GETSTARTTIME \
 55 w.white 1.16 TimeValue startTime = TimeValue::getCurrentTime();
 56 w.white 1.8  
 57 a.dunfey 1.20 #define STAT_PMS_PROVIDERSTART                               \
 58               response->setStartServerTime(request->getStartServerTime()); \
 59               response->setStartProviderTime(TimeValue::getCurrentTime());
 60 sage     1.1  
 61 a.dunfey 1.22 #define STAT_RESPONSEEND \
 62               response->endProvider();
 63               
 64 sage     1.1  #define STAT_PMS_PROVIDEREND \
 65               response->endProvider();            \
 66               response->setStartServerTime(request->getStartServerTime()); \
 67               response->setStartProviderTime(startTime);
 68               
 69 w.white  1.8  
 70               #define STAT_SERVERSTART \
 71               request->setStartServerTime(startTime);
 72               
 73 sage     1.1  
 74               #define STAT_SERVEREND \
 75 w.white  1.8  response->endServer();\
 76 w.white  1.12 
 77               #define STAT_BYTESSENT \
 78 w.white  1.10 Uint16 statType = (response->getType() >= CIM_GET_CLASS_RESPONSE_MESSAGE)? \
 79 w.white  1.12   response->getType() - CIM_GET_CLASS_RESPONSE_MESSAGE:response->getType() - 1;\
 80 denise.eckstein 1.18 StatisticalData::current()->addToValue(message.size(), statType, StatisticalData::PEGASUS_STATDATA_BYTES_SENT);
 81 w.white         1.8  
 82 w.white         1.10 
 83                      
 84 w.white         1.8  #define STAT_SERVEREND_ERROR \
 85                      response->endServer();
 86                      
 87 sage            1.1  
 88 w.white         1.8  #define STAT_PROVIDERSTART \
 89                      request->startProvider();
 90 sage            1.1  
 91                      
 92 w.white         1.8  #define STAT_PROVIDEREND   \
 93                      request->endProvider();
 94                      
 95                      #define STAT_COPYDISPATCHER \
 96                      response->setStartServerTime(request->getStartServerTime());
 97 sage            1.1  
 98                      
 99                      
100                      // copy request timing info into response
101                      #define STAT_COPYDISPATCHER_REP \
102                      response->setStartServerTime(request->getStartServerTime());   \
103                      response->setStartProviderTime(request->getStartProviderTime());   \
104                      response->setEndProviderTime(request->getEndProviderTime());
105                      
106 w.white         1.8  
107                      
108                      /*the request size value must be stored (requSize) and passed to the StatisticalData object at the
109                       end of processing other wise it will be the ONLY vlaue that is passed to the client which reports 
110                       the current state of the object, not the pevious (one command ago) state */
111                      
112 sage            1.1  #define STAT_BYTESREAD \
113 w.white         1.10 Uint16 statType = (request->getType() >= CIM_GET_CLASS_RESPONSE_MESSAGE)? \
114 w.white         1.8      request->getType() - CIM_GET_CLASS_RESPONSE_MESSAGE: request->getType()-1;\
115 w.white         1.19 StatisticalData::current()->requSize = contentLength; 
116 w.white         1.10 
117 sage            1.1  #else
118                      #define STAT_GETSTARTTIME
119 a.dunfey        1.22 #define STAT_PMS_PROVIDERSTART
120 sage            1.1  #define STAT_PMS_PROVIDEREND
121 a.dunfey        1.22 #define STAT_RESPONSEEND
122 sage            1.1  #define STAT_SERVERSTART
123                      #define STAT_SERVEREND
124                      #define STAT_SERVEREND_ERROR
125                      #define STAT_PROVIDERSTART
126                      #define STAT_PROVIDEREND
127                      #define STAT_PROVIDEREND_REP
128                      #define STAT_COPYDISPATCHER
129 kumpf           1.2  #define STAT_COPYDISPATCHER_REP
130 sage            1.1  #define STAT_BYTESREAD
131 w.white         1.12 #define STAT_BYTESSENT
132 sage            1.1  #endif
133                      
134 kumpf           1.25 class PEGASUS_COMMON_LINKAGE StatProviderTimeMeasurement
135                      {
136                      public:
137                          StatProviderTimeMeasurement(CIMMessage* message)
138                              : _message(message)
139                          {
140                      #ifndef PEGASUS_DISABLE_PERFINST
141                              _message->setStartProviderTime(TimeValue::getCurrentTime());
142                      #endif
143                          }
144                      
145                          ~StatProviderTimeMeasurement()
146                          {
147                      #ifndef PEGASUS_DISABLE_PERFINST
148                              _message->endProvider();
149                      #endif
150                          }
151                      
152                      private:
153                          StatProviderTimeMeasurement();
154                          StatProviderTimeMeasurement(const StatProviderTimeMeasurement&);
155 kumpf           1.25     StatProviderTimeMeasurement& operator=(const StatProviderTimeMeasurement&);
156                      
157                          CIMMessage* _message;
158                      };
159                      
160 sage            1.1  class PEGASUS_COMMON_LINKAGE StatisticalData
161                      {
162                         public:
163                            enum StatRequestType{
164                               GET_CLASS,
165                               GET_INSTANCE,
166 jim.wunderlich  1.23 	 INDICATION_DELIVERY,
167 sage            1.1           DELETE_CLASS,
168                               DELETE_INSTANCE,
169                               CREATE_CLASS,
170                               CREATE_INSTANCE,
171                               MODIFY_CLASS,
172                               MODIFY_INSTANCE,
173                               ENUMERATE_CLASSES,
174                               ENUMERATE_CLASS_NAMES,
175                               ENUMERATE_INSTANCES,
176                               ENUMERATE_INSTANCE_NAMES,
177                               EXEC_QUERY,
178                               ASSOCIATORS,
179                               ASSOCIATOR_NAMES,
180                               REFERENCES,
181                               REFERENCE_NAMES,
182                               GET_PROPERTY,
183                               SET_PROPERTY,
184                               GET_QUALIFIER,
185                               SET_QUALIFIER,
186                               DELETE_QUALIFIER,
187                               ENUMERATE_QUALIFIERS,
188 denise.eckstein 1.17          INVOKE_METHOD,
189 sage            1.1           NUMBER_OF_TYPES
190                            };
191                      
192                            enum StatDataType{
193 denise.eckstein 1.18          PEGASUS_STATDATA_SERVER,
194                               PEGASUS_STATDATA_PROVIDER,
195                               PEGASUS_STATDATA_BYTES_SENT,
196                               PEGASUS_STATDATA_BYTES_READ
197 sage            1.1        };
198                      
199                            static const Uint32 length;
200                            static StatisticalData* current();
201                      
202                            StatisticalData();
203                      
204                            timeval timestamp;
205                      
206 w.white         1.9        Sint64 numCalls[NUMBER_OF_TYPES];
207                            Sint64 cimomTime[NUMBER_OF_TYPES];
208                            Sint64 providerTime[NUMBER_OF_TYPES];
209                            Sint64 responseSize[NUMBER_OF_TYPES];
210                            Sint64 requestSize[NUMBER_OF_TYPES];
211 w.white         1.10 	Sint64 requSize;	//tempory storage for requestSize vlaue
212                      	Boolean copyGSD;
213                      //	Uint64 totalServTime;
214 sage            1.1        static StatisticalData* cur;
215 w.white         1.9        void addToValue(Sint64 value, Uint16 type, Uint32 t);
216 sage            1.1        static String requestName[];
217 w.white         1.10      void setCopyGSD(Boolean flag);
218 sage            1.1  
219                         protected:
220                            Mutex _mutex;
221                      };
222                      
223                      
224                      PEGASUS_NAMESPACE_END
225                      #endif
226                      

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2