(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 karl            1.22.8.3 //// TODO these are not defined in CIM_StatisticalData class
 77                            "OpenEnumerateInstances",         //    71
 78                            "OpenEnumerateInstancePaths",     //    72
 79                            "OpenReferences",                 //    73   
 80                            "OpenReferenceNames",             //    74
 81                            "OpenAssociators",                //    75
 82                            "OpenAssociatorPaths",            //    76
 83                            "PullInstancesWithPath",          //    77
 84                            "PullInstancePaths",              //    77
 85                            "CloseEnumeration" ,              //    79
 86 karl            1.22.8.2 //EXP_PULL_END
 87 jim.wunderlich  1.16       "InvokeMethod"                    //    25          Not Present
 88 denise.eckstein 1.11     };
 89 sage            1.1      
 90                          const Uint32 StatisticalData::length = NUMBER_OF_TYPES;
 91                          
 92                          StatisticalData* StatisticalData::cur = NULL;
 93                          
 94 denise.eckstein 1.11     StatisticalData* StatisticalData::current()
 95                          {
 96                              if (cur == NULL)
 97                              {
 98                                  cur = new StatisticalData();
 99                              }
100                              return cur;
101 sage            1.1      }
102                          
103 denise.eckstein 1.11     StatisticalData::StatisticalData()
104                          {
105                              copyGSD = 0;
106 w.white         1.4      
107 denise.eckstein 1.11         for (unsigned int i=0; i<StatisticalData::length; i++)
108                              {
109                                  numCalls[i] = 0;
110 kumpf           1.18             cimomTime[i] = 0;
111 denise.eckstein 1.11             providerTime[i] = 0;
112                                  responseSize[i] = 0;
113                                  requestSize[i] = 0;
114                              }
115 sage            1.1      }
116                          
117 denise.eckstein 1.11     void StatisticalData::addToValue(Sint64 value, Uint16 type, Uint32 t)
118                          {
119                              if (type >= NUMBER_OF_TYPES)
120                              {
121 marek           1.19              PEG_TRACE((TRC_DISCARDED_DATA, Tracer::LEVEL2,
122 denise.eckstein 1.11                  "StatData: Statistical Data Discarded.  "
123 marek           1.19                      "Invalid Request Type =  %u", type));
124 denise.eckstein 1.11              return;
125                              }
126                          
127                              if (copyGSD)
128                              {
129                                  AutoMutex autoMut(_mutex);
130                                  switch (t)
131                                  {
132 denise.eckstein 1.12                 case PEGASUS_STATDATA_SERVER:
133 denise.eckstein 1.11                     numCalls[type] += 1;
134                                          cimomTime[type] += value;
135 marek           1.20                     PEG_TRACE((TRC_STATISTICAL_DATA, Tracer::LEVEL4,
136 denise.eckstein 1.11                         "StatData: SERVER: %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, cimomTime[type]));
142 denise.eckstein 1.11                     break;
143 denise.eckstein 1.12                 case PEGASUS_STATDATA_PROVIDER:
144 denise.eckstein 1.11                     providerTime[type] += value;
145 marek           1.20                     PEG_TRACE((TRC_STATISTICAL_DATA, Tracer::LEVEL4,
146 denise.eckstein 1.11                         "StatData: PROVIDER: %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, providerTime[type]));
152 denise.eckstein 1.11                     break;
153 denise.eckstein 1.12             case PEGASUS_STATDATA_BYTES_SENT:
154 denise.eckstein 1.11                     responseSize[type] += value;
155 marek           1.20                     PEG_TRACE((TRC_STATISTICAL_DATA, Tracer::LEVEL4,
156 denise.eckstein 1.11                         "StatData: BYTES_SENT: %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, responseSize[type]));
162 denise.eckstein 1.11                     break;
163 denise.eckstein 1.12             case PEGASUS_STATDATA_BYTES_READ:
164 denise.eckstein 1.11                     requestSize[type] += value;
165 marek           1.20                     PEG_TRACE((TRC_STATISTICAL_DATA, Tracer::LEVEL4,
166 denise.eckstein 1.11                         "StatData: BYTES_READ: %s(%d): count = %"
167                                                  PEGASUS_64BIT_CONVERSION_WIDTH "d; value = %"
168                                                  PEGASUS_64BIT_CONVERSION_WIDTH "d; total = %"
169                                                  PEGASUS_64BIT_CONVERSION_WIDTH "d",
170                                              (const char *)requestName[type].getCString(), type,
171 marek           1.19                         numCalls[type], value, requestSize[type]));
172 denise.eckstein 1.11                     break;
173                                  }
174                              }
175 sage            1.1      }
176                          
177 mike            1.17     void StatisticalData::setCopyGSD(Boolean flag)
178 w.white         1.6      {
179 kumpf           1.18         copyGSD = flag;
180 w.white         1.6      }
181 w.white         1.4      
182 sage            1.1      PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2