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

  1 karl  1.15 //%2005////////////////////////////////////////////////////////////////////////
  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 sage  1.1  //
 12            // Permission is hereby granted, free of charge, to any person obtaining a copy
 13            // of this software and associated documentation files (the "Software"), to
 14            // deal in the Software without restriction, including without limitation the
 15            // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 16            // sell copies of the Software, and to permit persons to whom the Software is
 17            // furnished to do so, subject to the following conditions:
 18 kumpf 1.3  // 
 19 sage  1.1  // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 20            // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 21            // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 22            // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 23            // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 24            // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 25            // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 26            // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 27            //
 28            //==============================================================================
 29            //
 30            // Author: Arthur Pichlkostner
 31            //             (checked in: Markus Mueller sedgewick_de@yahoo.de)
 32 kumpf 1.3  //
 33            // Modified By:
 34 sage  1.1  //
 35            //%/////////////////////////////////////////////////////////////////////////////
 36            
 37            #ifndef STATISTICAL_DATA_H
 38            #define STATISTICAL_DATA_H
 39            
 40            #include <Pegasus/Common/Config.h>
 41 w.white 1.11 #include <iostream>
 42 sage    1.1  #include <cstring>
 43 kumpf   1.6  #include <Pegasus/Common/InternalException.h>
 44 sage    1.1  #include <Pegasus/Common/IPC.h>
 45              #include <Pegasus/Common/String.h>
 46              #include <Pegasus/Common/CIMProperty.h>
 47              #include <Pegasus/Common/CIMInstance.h>
 48 w.white 1.8  #include <Pegasus/Common/CIMDateTime.h>
 49 kumpf   1.5  #include <Pegasus/Common/Linkage.h>
 50 sage    1.1  
 51              PEGASUS_NAMESPACE_BEGIN
 52              
 53 karl    1.14 #ifndef PEGASUS_DISABLE_PERFINST
 54 sage    1.1  
 55              #define STAT_GETSTARTTIME \
 56 w.white 1.16 TimeValue startTime = TimeValue::getCurrentTime();
 57 w.white 1.8  
 58 sage    1.1  
 59              #define STAT_PMS_PROVIDEREND \
 60              response->endProvider();            \
 61              response->setStartServerTime(request->getStartServerTime()); \
 62              response->setStartProviderTime(startTime);
 63              
 64 w.white 1.8  
 65              #define STAT_SERVERSTART \
 66              request->setStartServerTime(startTime);
 67              
 68 sage    1.1  
 69              #define STAT_SERVEREND \
 70 w.white 1.8  response->endServer();\
 71 w.white 1.12 
 72              #define STAT_BYTESSENT \
 73 w.white 1.10 Uint16 statType = (response->getType() >= CIM_GET_CLASS_RESPONSE_MESSAGE)? \
 74 w.white 1.12   response->getType() - CIM_GET_CLASS_RESPONSE_MESSAGE:response->getType() - 1;\
 75 denise.eckstein 1.18 StatisticalData::current()->addToValue(message.size(), statType, StatisticalData::PEGASUS_STATDATA_BYTES_SENT);
 76 w.white         1.8  
 77 w.white         1.10 
 78                      
 79 w.white         1.8  #define STAT_SERVEREND_ERROR \
 80                      response->endServer();
 81                      
 82 sage            1.1  
 83 w.white         1.8  #define STAT_PROVIDERSTART \
 84                      request->startProvider();
 85 sage            1.1  
 86                      
 87 w.white         1.8  #define STAT_PROVIDEREND   \
 88                      request->endProvider();
 89                      
 90                      #define STAT_COPYDISPATCHER \
 91                      response->setStartServerTime(request->getStartServerTime());
 92 sage            1.1  
 93                      
 94                      
 95                      // copy request timing info into response
 96                      #define STAT_COPYDISPATCHER_REP \
 97                      response->setStartServerTime(request->getStartServerTime());   \
 98                      response->setStartProviderTime(request->getStartProviderTime());   \
 99                      response->setEndProviderTime(request->getEndProviderTime());
100                      
101 w.white         1.8  
102                      
103                      /*the request size value must be stored (requSize) and passed to the StatisticalData object at the
104                       end of processing other wise it will be the ONLY vlaue that is passed to the client which reports 
105                       the current state of the object, not the pevious (one command ago) state */
106                      
107 sage            1.1  #define STAT_BYTESREAD \
108 w.white         1.10 Uint16 statType = (request->getType() >= CIM_GET_CLASS_RESPONSE_MESSAGE)? \
109 w.white         1.8      request->getType() - CIM_GET_CLASS_RESPONSE_MESSAGE: request->getType()-1;\
110 w.white         1.19 StatisticalData::current()->requSize = contentLength; 
111 w.white         1.10 
112                      
113 w.white         1.8  
114                      
115 sage            1.1  
116 w.white         1.12 //serverResponseTime should be an Uint64 but the << operator wont accept that
117                      #define STAT_SERVERTIME \
118                      if (StatisticalData::current()->copyGSD)\
119                      	 out << "WBEMServerResponseTime: " << (Uint32) serverResponseTime << "\r\n";
120 sage            1.1  #else
121                      #define STAT_GETSTARTTIME
122                      #define STAT_PMS_PROVIDEREND
123                      #define STAT_SERVERSTART
124                      #define STAT_SERVEREND
125                      #define STAT_SERVEREND_ERROR
126                      #define STAT_PROVIDERSTART
127                      #define STAT_PROVIDEREND
128                      #define STAT_PROVIDEREND_REP
129                      #define STAT_COPYDISPATCHER
130 kumpf           1.2  #define STAT_COPYDISPATCHER_REP
131 sage            1.1  #define STAT_BYTESREAD
132                      #define STAT_SERVERTIME
133 w.white         1.12 #define STAT_BYTESSENT
134 sage            1.1  #endif
135                      
136                      class PEGASUS_COMMON_LINKAGE StatisticalData
137                      {
138                         public:
139                            enum StatRequestType{
140                               GET_CLASS,
141                               GET_INSTANCE,
142 w.white         1.10 	 EXPORT_INDICATION,
143 sage            1.1           DELETE_CLASS,
144                               DELETE_INSTANCE,
145                               CREATE_CLASS,
146                               CREATE_INSTANCE,
147                               MODIFY_CLASS,
148                               MODIFY_INSTANCE,
149                               ENUMERATE_CLASSES,
150                               ENUMERATE_CLASS_NAMES,
151                               ENUMERATE_INSTANCES,
152                               ENUMERATE_INSTANCE_NAMES,
153                               EXEC_QUERY,
154                               ASSOCIATORS,
155                               ASSOCIATOR_NAMES,
156                               REFERENCES,
157                               REFERENCE_NAMES,
158                               GET_PROPERTY,
159                               SET_PROPERTY,
160                               GET_QUALIFIER,
161                               SET_QUALIFIER,
162                               DELETE_QUALIFIER,
163                               ENUMERATE_QUALIFIERS,
164 denise.eckstein 1.17          INVOKE_METHOD,
165 sage            1.1           NUMBER_OF_TYPES
166                            };
167                      
168                            enum StatDataType{
169 denise.eckstein 1.18          PEGASUS_STATDATA_SERVER,
170                               PEGASUS_STATDATA_PROVIDER,
171                               PEGASUS_STATDATA_BYTES_SENT,
172                               PEGASUS_STATDATA_BYTES_READ
173 sage            1.1        };
174                      
175                            static const Uint32 length;
176                            static StatisticalData* current();
177                      
178                            StatisticalData();
179                      
180                            timeval timestamp;
181                      
182 w.white         1.9        Sint64 numCalls[NUMBER_OF_TYPES];
183                            Sint64 cimomTime[NUMBER_OF_TYPES];
184                            Sint64 providerTime[NUMBER_OF_TYPES];
185                            Sint64 responseSize[NUMBER_OF_TYPES];
186                            Sint64 requestSize[NUMBER_OF_TYPES];
187 w.white         1.10 	Sint64 requSize;	//tempory storage for requestSize vlaue
188                      	Boolean copyGSD;
189                      //	Uint64 totalServTime;
190 sage            1.1        static StatisticalData* cur;
191 w.white         1.9        void addToValue(Sint64 value, Uint16 type, Uint32 t);
192 sage            1.1        static String requestName[];
193 w.white         1.10      void setCopyGSD(Boolean flag);
194 sage            1.1  
195                         protected:
196                            Mutex _mutex;
197                      };
198                      
199                      
200                      PEGASUS_NAMESPACE_END
201                      #endif
202                      

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2