(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 kumpf   1.29 Uint64 serverStartTimeMicroseconds = \
 56                  TimeValue::getCurrentTime().toMicroseconds();
 57 w.white 1.8  
 58              #define STAT_SERVERSTART \
 59 kumpf   1.29 request->setServerStartTime(serverStartTimeMicroseconds);
 60 w.white 1.8  
 61 sage    1.1  #define STAT_SERVEREND \
 62 w.white 1.8  response->endServer();\
 63 w.white 1.12 
 64              #define STAT_BYTESSENT \
 65 w.white 1.10 Uint16 statType = (response->getType() >= CIM_GET_CLASS_RESPONSE_MESSAGE)? \
 66 w.white 1.12   response->getType() - CIM_GET_CLASS_RESPONSE_MESSAGE:response->getType() - 1;\
 67 denise.eckstein 1.18 StatisticalData::current()->addToValue(message.size(), statType, StatisticalData::PEGASUS_STATDATA_BYTES_SENT);
 68 w.white         1.8  
 69 w.white         1.10 
 70                      
 71 w.white         1.8  #define STAT_SERVEREND_ERROR \
 72                      response->endServer();
 73                      
 74                      /*the request size value must be stored (requSize) and passed to the StatisticalData object at the
 75                       end of processing other wise it will be the ONLY vlaue that is passed to the client which reports 
 76                       the current state of the object, not the pevious (one command ago) state */
 77                      
 78 sage            1.1  #define STAT_BYTESREAD \
 79 w.white         1.10 Uint16 statType = (request->getType() >= CIM_GET_CLASS_RESPONSE_MESSAGE)? \
 80 w.white         1.8      request->getType() - CIM_GET_CLASS_RESPONSE_MESSAGE: request->getType()-1;\
 81 w.white         1.19 StatisticalData::current()->requSize = contentLength; 
 82 w.white         1.10 
 83 sage            1.1  #else
 84                      #define STAT_GETSTARTTIME
 85                      #define STAT_SERVERSTART
 86                      #define STAT_SERVEREND
 87                      #define STAT_SERVEREND_ERROR
 88                      #define STAT_BYTESREAD
 89 w.white         1.12 #define STAT_BYTESSENT
 90 sage            1.1  #endif
 91                      
 92 kumpf           1.25 class PEGASUS_COMMON_LINKAGE StatProviderTimeMeasurement
 93                      {
 94                      public:
 95                          StatProviderTimeMeasurement(CIMMessage* message)
 96                              : _message(message)
 97                          {
 98                      #ifndef PEGASUS_DISABLE_PERFINST
 99 kumpf           1.29         _startTimeMicroseconds = TimeValue::getCurrentTime().toMicroseconds();
100 kumpf           1.25 #endif
101                          }
102                      
103                          ~StatProviderTimeMeasurement()
104                          {
105                      #ifndef PEGASUS_DISABLE_PERFINST
106 kumpf           1.29         _message->setProviderTime(
107                                  TimeValue::getCurrentTime().toMicroseconds() -
108                                      _startTimeMicroseconds);
109 kumpf           1.25 #endif
110                          }
111                      
112                      private:
113                          StatProviderTimeMeasurement();
114                          StatProviderTimeMeasurement(const StatProviderTimeMeasurement&);
115                          StatProviderTimeMeasurement& operator=(const StatProviderTimeMeasurement&);
116                      
117                          CIMMessage* _message;
118 kumpf           1.29     Uint64 _startTimeMicroseconds;
119 kumpf           1.25 };
120                      
121 sage            1.1  class PEGASUS_COMMON_LINKAGE StatisticalData
122                      {
123                         public:
124                            enum StatRequestType{
125                               GET_CLASS,
126                               GET_INSTANCE,
127 jim.wunderlich  1.23 	 INDICATION_DELIVERY,
128 sage            1.1           DELETE_CLASS,
129                               DELETE_INSTANCE,
130                               CREATE_CLASS,
131                               CREATE_INSTANCE,
132                               MODIFY_CLASS,
133                               MODIFY_INSTANCE,
134                               ENUMERATE_CLASSES,
135                               ENUMERATE_CLASS_NAMES,
136                               ENUMERATE_INSTANCES,
137                               ENUMERATE_INSTANCE_NAMES,
138                               EXEC_QUERY,
139                               ASSOCIATORS,
140                               ASSOCIATOR_NAMES,
141                               REFERENCES,
142                               REFERENCE_NAMES,
143                               GET_PROPERTY,
144                               SET_PROPERTY,
145                               GET_QUALIFIER,
146                               SET_QUALIFIER,
147                               DELETE_QUALIFIER,
148                               ENUMERATE_QUALIFIERS,
149 denise.eckstein 1.17          INVOKE_METHOD,
150 sage            1.1           NUMBER_OF_TYPES
151                            };
152                      
153                            enum StatDataType{
154 denise.eckstein 1.18          PEGASUS_STATDATA_SERVER,
155                               PEGASUS_STATDATA_PROVIDER,
156                               PEGASUS_STATDATA_BYTES_SENT,
157                               PEGASUS_STATDATA_BYTES_READ
158 sage            1.1        };
159                      
160                            static const Uint32 length;
161                            static StatisticalData* current();
162                      
163                            StatisticalData();
164                      
165                            timeval timestamp;
166                      
167 w.white         1.9        Sint64 numCalls[NUMBER_OF_TYPES];
168                            Sint64 cimomTime[NUMBER_OF_TYPES];
169                            Sint64 providerTime[NUMBER_OF_TYPES];
170                            Sint64 responseSize[NUMBER_OF_TYPES];
171                            Sint64 requestSize[NUMBER_OF_TYPES];
172 w.white         1.10 	Sint64 requSize;	//tempory storage for requestSize vlaue
173                      	Boolean copyGSD;
174                      //	Uint64 totalServTime;
175 sage            1.1        static StatisticalData* cur;
176 w.white         1.9        void addToValue(Sint64 value, Uint16 type, Uint32 t);
177 sage            1.1        static String requestName[];
178 w.white         1.10      void setCopyGSD(Boolean flag);
179 sage            1.1  
180                         protected:
181                            Mutex _mutex;
182                      };
183                      
184                      
185                      PEGASUS_NAMESPACE_END
186                      #endif
187                      

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2