(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.10 StatisticalData::current()->requSize = contentLength; \
111 denise.eckstein 1.18 StatisticalData::current()->addToValue(contentLength, statType, StatisticalData::PEGASUS_STATDATA_BYTES_READ);
112 w.white         1.10 
113                      
114 w.white         1.8  
115                      
116 sage            1.1  
117 w.white         1.12 //serverResponseTime should be an Uint64 but the << operator wont accept that
118                      #define STAT_SERVERTIME \
119                      if (StatisticalData::current()->copyGSD)\
120                      	 out << "WBEMServerResponseTime: " << (Uint32) serverResponseTime << "\r\n";
121 sage            1.1  #else
122                      #define STAT_GETSTARTTIME
123                      #define STAT_PMS_PROVIDEREND
124                      #define STAT_SERVERSTART
125                      #define STAT_SERVEREND
126                      #define STAT_SERVEREND_ERROR
127                      #define STAT_PROVIDERSTART
128                      #define STAT_PROVIDEREND
129                      #define STAT_PROVIDEREND_REP
130                      #define STAT_COPYDISPATCHER
131 kumpf           1.2  #define STAT_COPYDISPATCHER_REP
132 sage            1.1  #define STAT_BYTESREAD
133                      #define STAT_SERVERTIME
134 w.white         1.12 #define STAT_BYTESSENT
135 sage            1.1  #endif
136                      
137                      class PEGASUS_COMMON_LINKAGE StatisticalData
138                      {
139                         public:
140                            enum StatRequestType{
141                               GET_CLASS,
142                               GET_INSTANCE,
143 w.white         1.10 	 EXPORT_INDICATION,
144 sage            1.1           DELETE_CLASS,
145                               DELETE_INSTANCE,
146                               CREATE_CLASS,
147                               CREATE_INSTANCE,
148                               MODIFY_CLASS,
149                               MODIFY_INSTANCE,
150                               ENUMERATE_CLASSES,
151                               ENUMERATE_CLASS_NAMES,
152                               ENUMERATE_INSTANCES,
153                               ENUMERATE_INSTANCE_NAMES,
154                               EXEC_QUERY,
155                               ASSOCIATORS,
156                               ASSOCIATOR_NAMES,
157                               REFERENCES,
158                               REFERENCE_NAMES,
159                               GET_PROPERTY,
160                               SET_PROPERTY,
161                               GET_QUALIFIER,
162                               SET_QUALIFIER,
163                               DELETE_QUALIFIER,
164                               ENUMERATE_QUALIFIERS,
165 denise.eckstein 1.17          INVOKE_METHOD,
166 sage            1.1           NUMBER_OF_TYPES
167                            };
168                      
169                            enum StatDataType{
170 denise.eckstein 1.18          PEGASUS_STATDATA_SERVER,
171                               PEGASUS_STATDATA_PROVIDER,
172                               PEGASUS_STATDATA_BYTES_SENT,
173                               PEGASUS_STATDATA_BYTES_READ
174 sage            1.1        };
175                      
176                            static const Uint32 length;
177                            static StatisticalData* current();
178                      
179                            StatisticalData();
180                      
181                            timeval timestamp;
182                      
183 w.white         1.9        Sint64 numCalls[NUMBER_OF_TYPES];
184                            Sint64 cimomTime[NUMBER_OF_TYPES];
185                            Sint64 providerTime[NUMBER_OF_TYPES];
186                            Sint64 responseSize[NUMBER_OF_TYPES];
187                            Sint64 requestSize[NUMBER_OF_TYPES];
188 w.white         1.10 	Sint64 requSize;	//tempory storage for requestSize vlaue
189                      	Boolean copyGSD;
190                      //	Uint64 totalServTime;
191 sage            1.1        static StatisticalData* cur;
192 w.white         1.9        void addToValue(Sint64 value, Uint16 type, Uint32 t);
193 sage            1.1        static String requestName[];
194 w.white         1.10      void setCopyGSD(Boolean flag);
195 sage            1.1  
196                         protected:
197                            Mutex _mutex;
198                      };
199                      
200                      
201                      PEGASUS_NAMESPACE_END
202                      #endif
203                      

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2