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

  1 martin 1.21 //%LICENSE////////////////////////////////////////////////////////////////
  2 martin 1.22 //
  3 martin 1.21 // Licensed to The Open Group (TOG) under one or more contributor license
  4             // agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
  5             // this work for additional information regarding copyright ownership.
  6             // Each contributor licenses this file to you under the OpenPegasus Open
  7             // Source License; you may not use this file except in compliance with the
  8             // License.
  9 martin 1.22 //
 10 martin 1.21 // Permission is hereby granted, free of charge, to any person obtaining a
 11             // copy of this software and associated documentation files (the "Software"),
 12             // to deal in the Software without restriction, including without limitation
 13             // the rights to use, copy, modify, merge, publish, distribute, sublicense,
 14             // and/or sell copies of the Software, and to permit persons to whom the
 15             // Software is furnished to do so, subject to the following conditions:
 16 martin 1.22 //
 17 martin 1.21 // The above copyright notice and this permission notice shall be included
 18             // in all copies or substantial portions of the Software.
 19 martin 1.22 //
 20 martin 1.21 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 21 martin 1.22 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 22 martin 1.21 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 23             // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 24             // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 25             // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 26             // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 27 martin 1.22 //
 28 martin 1.21 //////////////////////////////////////////////////////////////////////////
 29 sage   1.1  //
 30             //%/////////////////////////////////////////////////////////////////////////////
 31             
 32             #include "StatisticalData.h"
 33 denise.eckstein 1.11 #include "Tracer.h"
 34 sage            1.1  
 35                      PEGASUS_NAMESPACE_BEGIN
 36                      
 37 jim.wunderlich  1.14 
 38                      // The table on the right represents the mapping from the enumerated types
 39 kumpf           1.18 // in the CIM_CIMOMStatisticalDate class ValueMap versus the internal
 40                      // message type defined in Message.h. This conversion is performed by
 41 jim.wunderlich  1.14 // getOpType() in CIMOMStatDataProvider.cpp.
 42                      //
 43                      
 44 kumpf           1.18 String StatisticalData::requestName[] =
 45 denise.eckstein 1.11 {
 46 kumpf           1.18                                     // Enumerated     ValueMap Value
 47 jim.wunderlich  1.14                                     // value from     from class
 48                                                          // internal       CIM_StatisticalData
 49                                                          // message type
 50                                                          // -------------- -------------------
 51 kumpf           1.18   "GetClass",                       //     1           3
 52                        "GetInstance",                    //     2           4
 53                        "IndicationDelivery",             //     3           26
 54                        "DeleteClass",                    //     4           5
 55                        "DeleteInstance",                 //     5           6
 56                        "CreateClass",                    //     6           7
 57 jim.wunderlich  1.16   "CreateInstance",                 //     7           8
 58                        "ModifyClass",                    //     8           9
 59 kumpf           1.18   "ModifyInstance",                 //     9          10
 60                        "EnumerateClasses",               //    10          11
 61                        "EnumerateClassNames",            //    11          12
 62                        "EnumerateInstances",             //    12          13
 63                        "EnumerateInstanceNames",         //    13          14
 64                        "ExecQuery",                      //    14          15
 65                        "Associators",                    //    15          16
 66                        "AssociatorNames",                //    16          17
 67                        "References",                     //    17          18
 68                        "ReferenceNames",                 //    18          19
 69                        "GetProperty",                    //    19          20
 70                        "SetProperty",                    //    20          21
 71                        "GetQualifier",                   //    21          22
 72                        "SetQualifier",                   //    22          23
 73                        "DeleteQualifier",                //    23          24
 74                        "EnumerateQualifiers",            //    24          25
 75 karl            1.22.8.2 //EXP_PULL_BEGIN
 76                            "OpenEnumerateInstances",         //    24
 77                            "OpenEnumerateInstancePaths",     //    KS_TODO EXP_PULL Do this
 78                            "OpenReferences",                 //  
 79                            "OpenReferenceNames",             //
 80                            "OpenAssociators",                //
 81                            "OpenAssociatorPaths",            //
 82                            "PullInstancesWithPath",          //
 83                            "PullInstancePaths",              //
 84                            "CloseEnumeration" ,              //
 85                          //EXP_PULL_END
 86 jim.wunderlich  1.16       "InvokeMethod"                    //    25          Not Present
 87 denise.eckstein 1.11     };
 88 sage            1.1      
 89                          const Uint32 StatisticalData::length = NUMBER_OF_TYPES;
 90                          
 91                          StatisticalData* StatisticalData::cur = NULL;
 92                          
 93 denise.eckstein 1.11     StatisticalData* StatisticalData::current()
 94                          {
 95                              if (cur == NULL)
 96                              {
 97                                  cur = new StatisticalData();
 98                              }
 99                              return cur;
100 sage            1.1      }
101                          
102 denise.eckstein 1.11     StatisticalData::StatisticalData()
103                          {
104                              copyGSD = 0;
105 w.white         1.4      
106 denise.eckstein 1.11         for (unsigned int i=0; i<StatisticalData::length; i++)
107                              {
108                                  numCalls[i] = 0;
109 kumpf           1.18             cimomTime[i] = 0;
110 denise.eckstein 1.11             providerTime[i] = 0;
111                                  responseSize[i] = 0;
112                                  requestSize[i] = 0;
113                              }
114 sage            1.1      }
115                          
116 denise.eckstein 1.11     void StatisticalData::addToValue(Sint64 value, Uint16 type, Uint32 t)
117                          {
118                              if (type >= NUMBER_OF_TYPES)
119                              {
120 marek           1.19              PEG_TRACE((TRC_DISCARDED_DATA, Tracer::LEVEL2,
121 denise.eckstein 1.11                  "StatData: Statistical Data Discarded.  "
122 marek           1.19                      "Invalid Request Type =  %u", type));
123 denise.eckstein 1.11              return;
124                              }
125                          
126                              if (copyGSD)
127                              {
128                                  AutoMutex autoMut(_mutex);
129                                  switch (t)
130                                  {
131 denise.eckstein 1.12                 case PEGASUS_STATDATA_SERVER:
132 denise.eckstein 1.11                     numCalls[type] += 1;
133                                          cimomTime[type] += value;
134 marek           1.20                     PEG_TRACE((TRC_STATISTICAL_DATA, Tracer::LEVEL4,
135 denise.eckstein 1.11                         "StatData: SERVER: %s(%d): count = %"
136                                                  PEGASUS_64BIT_CONVERSION_WIDTH "d; value = %"
137                                                  PEGASUS_64BIT_CONVERSION_WIDTH "d; total = %"
138                                                  PEGASUS_64BIT_CONVERSION_WIDTH "d",
139                                              (const char *)requestName[type].getCString(), type,
140 marek           1.19                         numCalls[type], value, cimomTime[type]));
141 denise.eckstein 1.11                     break;
142 denise.eckstein 1.12                 case PEGASUS_STATDATA_PROVIDER:
143 denise.eckstein 1.11                     providerTime[type] += value;
144 marek           1.20                     PEG_TRACE((TRC_STATISTICAL_DATA, Tracer::LEVEL4,
145 denise.eckstein 1.11                         "StatData: PROVIDER: %s(%d): count = %"
146                                                  PEGASUS_64BIT_CONVERSION_WIDTH "d; value = %"
147                                                  PEGASUS_64BIT_CONVERSION_WIDTH "d; total = %"
148                                                  PEGASUS_64BIT_CONVERSION_WIDTH "d",
149                                              (const char *)requestName[type].getCString(), type,
150 marek           1.19                         numCalls[type], value, providerTime[type]));
151 denise.eckstein 1.11                     break;
152 denise.eckstein 1.12             case PEGASUS_STATDATA_BYTES_SENT:
153 denise.eckstein 1.11                     responseSize[type] += value;
154 marek           1.20                     PEG_TRACE((TRC_STATISTICAL_DATA, Tracer::LEVEL4,
155 denise.eckstein 1.11                         "StatData: BYTES_SENT: %s(%d): count = %"
156                                                  PEGASUS_64BIT_CONVERSION_WIDTH "d; value = %"
157                                                  PEGASUS_64BIT_CONVERSION_WIDTH "d; total = %"
158                                                  PEGASUS_64BIT_CONVERSION_WIDTH "d",
159                                              (const char *)requestName[type].getCString(), type,
160 marek           1.19                         numCalls[type], value, responseSize[type]));
161 denise.eckstein 1.11                     break;
162 denise.eckstein 1.12             case PEGASUS_STATDATA_BYTES_READ:
163 denise.eckstein 1.11                     requestSize[type] += value;
164 marek           1.20                     PEG_TRACE((TRC_STATISTICAL_DATA, Tracer::LEVEL4,
165 denise.eckstein 1.11                         "StatData: BYTES_READ: %s(%d): count = %"
166                                                  PEGASUS_64BIT_CONVERSION_WIDTH "d; value = %"
167                                                  PEGASUS_64BIT_CONVERSION_WIDTH "d; total = %"
168                                                  PEGASUS_64BIT_CONVERSION_WIDTH "d",
169                                              (const char *)requestName[type].getCString(), type,
170 marek           1.19                         numCalls[type], value, requestSize[type]));
171 denise.eckstein 1.11                     break;
172                                  }
173                              }
174 sage            1.1      }
175                          
176 mike            1.17     void StatisticalData::setCopyGSD(Boolean flag)
177 w.white         1.6      {
178 kumpf           1.18         copyGSD = flag;
179 w.white         1.6      }
180 w.white         1.4      
181 sage            1.1      PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2