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

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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2