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

  1 a.dunfey 1.12.10.1 //%2006////////////////////////////////////////////////////////////////////////
  2 sage     1.1       //
  3 karl     1.8       // 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.3       // IBM Corp.; EMC Corporation, The Open Group.
  7 karl     1.8       // 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.9       // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 10                    // EMC Corporation; VERITAS Software Corporation; The Open Group.
 11 a.dunfey 1.12.10.1 // 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.2       // 
 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                    // Author: Arthur Pichlkostner
 33                    //             (checked in: Markus Mueller sedgewick_de@yahoo.de)
 34 a.arora  1.7       // Modified By: Amit K Arora, IBM (amita@in.ibm.com) for Bug#1090
 35 sage     1.1       //
 36                    //%/////////////////////////////////////////////////////////////////////////////
 37                    
 38                    #include "StatisticalData.h"
 39 denise.eckstein 1.11      #include "Tracer.h"
 40 sage            1.1       
 41                           PEGASUS_NAMESPACE_BEGIN
 42                           
 43 a.dunfey        1.12.10.1 
 44                           // The table on the right represents the mapping from the enumerated types
 45                           // in the CIM_CIMOMStatisticalDate class ValueMap versus the internal 
 46                           // message type defined in Message.h. This conversion is performed by 
 47                           // getOpType() in CIMOMStatDataProvider.cpp.
 48                           //
 49                           
 50 denise.eckstein 1.11      String StatisticalData::requestName[] = 
 51                           {
 52 a.dunfey        1.12.10.1                                     // Enumerated     ValueMap Value 
 53                                                               // value from     from class
 54                                                               // internal       CIM_StatisticalData
 55                                                               // message type
 56                                                               // -------------- -------------------
 57                             "GetClass",                       //     1           3  
 58                             "GetInstance",                    //     2           4  
 59                             "IndicationDelivery",             //     3           26  
 60                             "DeleteClass",                    //     4           5  
 61                             "DeleteInstance",                 //     5           6  
 62                             "CreateClass",                    //     6           7  
 63                             "CreateInstance",                 //     7           8
 64                             "ModifyClass",                    //     8           9
 65                             "ModifyInstance",                 //     9          10 
 66                             "EnumerateClasses",               //    10          11  
 67                             "EnumerateClassNames",            //    11          12  
 68                             "EnumerateInstances",             //    12          13  
 69                             "EnumerateInstanceNames",         //    13          14  
 70                             "ExecQuery",                      //    14          15  
 71                             "Associators",                    //    15          16  
 72                             "AssociatorNames",                //    16          17  
 73 a.dunfey        1.12.10.1   "References",                     //    17          18  
 74                             "ReferenceNames",                 //    18          19 
 75                             "GetProperty",                    //    19          20  
 76                             "SetProperty",                    //    20          21  
 77                             "GetQualifier",                   //    21          22  
 78                             "SetQualifier",                   //    22          23  
 79                             "DeleteQualifier",                //    23          24  
 80                             "EnumerateQualifiers",            //    24          25  
 81                             "InvokeMethod"                    //    25          Not Present
 82 denise.eckstein 1.11      };
 83 sage            1.1       
 84                           const Uint32 StatisticalData::length = NUMBER_OF_TYPES;
 85                           
 86                           StatisticalData* StatisticalData::cur = NULL;
 87                           
 88 denise.eckstein 1.11      StatisticalData* StatisticalData::current()
 89                           {
 90                               if (cur == NULL)
 91                               {
 92                                   cur = new StatisticalData();
 93                               }
 94                               return cur;
 95 sage            1.1       }
 96                           
 97 denise.eckstein 1.11      StatisticalData::StatisticalData()
 98                           {
 99                               copyGSD = 0;
100 w.white         1.4       
101 denise.eckstein 1.11          for (unsigned int i=0; i<StatisticalData::length; i++)
102                               {
103                                   numCalls[i] = 0;
104                                   cimomTime[i] = 0;      
105                                   providerTime[i] = 0;
106                                   responseSize[i] = 0;
107                                   requestSize[i] = 0;
108                               }
109 sage            1.1       }
110                           
111 denise.eckstein 1.11      void StatisticalData::addToValue(Sint64 value, Uint16 type, Uint32 t)
112                           {
113                               if (type >= NUMBER_OF_TYPES)
114                               {
115                                    Tracer::trace(TRC_DISCARDED_DATA, Tracer::LEVEL2,
116                                        "StatData: Statistical Data Discarded.  "
117                                            "Invalid Request Type =  %u", type);
118                                    return;
119                               }
120                           
121                               if (copyGSD)
122                               {
123                                   AutoMutex autoMut(_mutex);
124                                   switch (t)
125                                   {
126 denise.eckstein 1.12                  case PEGASUS_STATDATA_SERVER:
127 denise.eckstein 1.11                      numCalls[type] += 1;
128                                           cimomTime[type] += value;
129                                           Tracer::trace(TRC_STATISTICAL_DATA, Tracer::LEVEL2,
130                                               "StatData: SERVER: %s(%d): count = %"
131                                                   PEGASUS_64BIT_CONVERSION_WIDTH "d; value = %"
132                                                   PEGASUS_64BIT_CONVERSION_WIDTH "d; total = %"
133                                                   PEGASUS_64BIT_CONVERSION_WIDTH "d",
134                                               (const char *)requestName[type].getCString(), type,
135                                               numCalls[type], value, cimomTime[type]);
136                                           break;
137 denise.eckstein 1.12                  case PEGASUS_STATDATA_PROVIDER:
138 denise.eckstein 1.11                      providerTime[type] += value;
139                                           Tracer::trace(TRC_STATISTICAL_DATA, Tracer::LEVEL2,
140                                               "StatData: PROVIDER: %s(%d): count = %"
141                                                   PEGASUS_64BIT_CONVERSION_WIDTH "d; value = %"
142                                                   PEGASUS_64BIT_CONVERSION_WIDTH "d; total = %"
143                                                   PEGASUS_64BIT_CONVERSION_WIDTH "d",
144                                               (const char *)requestName[type].getCString(), type,
145                                               numCalls[type], value, providerTime[type]);
146                                           break;
147 denise.eckstein 1.12              case PEGASUS_STATDATA_BYTES_SENT:
148 denise.eckstein 1.11                      responseSize[type] += value;
149                                           Tracer::trace(TRC_STATISTICAL_DATA, Tracer::LEVEL2,
150                                               "StatData: BYTES_SENT: %s(%d): count = %"
151                                                   PEGASUS_64BIT_CONVERSION_WIDTH "d; value = %"
152                                                   PEGASUS_64BIT_CONVERSION_WIDTH "d; total = %"
153                                                   PEGASUS_64BIT_CONVERSION_WIDTH "d",
154                                               (const char *)requestName[type].getCString(), type,
155                                               numCalls[type], value, responseSize[type]);
156                                           break;
157 denise.eckstein 1.12              case PEGASUS_STATDATA_BYTES_READ:
158 denise.eckstein 1.11                      requestSize[type] += value;
159                                           Tracer::trace(TRC_STATISTICAL_DATA, Tracer::LEVEL2,
160                                               "StatData: BYTES_READ: %s(%d): count = %"
161                                                   PEGASUS_64BIT_CONVERSION_WIDTH "d; value = %"
162                                                   PEGASUS_64BIT_CONVERSION_WIDTH "d; total = %"
163                                                   PEGASUS_64BIT_CONVERSION_WIDTH "d",
164                                               (const char *)requestName[type].getCString(), type,
165                                               numCalls[type], value, requestSize[type]);
166                                           break;
167                                   }
168                               }
169 sage            1.1       }
170                           
171 w.white         1.6        void StatisticalData::setCopyGSD(Boolean flag)
172                           {
173                           
174                           	copyGSD = flag;
175                           }
176 w.white         1.4       
177 sage            1.1       PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2