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 jim.wunderlich 1.16 "InvokeMethod" // 25 Not Present
|
76 denise.eckstein 1.11 };
|
77 sage 1.1
78 const Uint32 StatisticalData::length = NUMBER_OF_TYPES;
79
80 StatisticalData* StatisticalData::cur = NULL;
81
|
82 denise.eckstein 1.11 StatisticalData* StatisticalData::current()
83 {
84 if (cur == NULL)
85 {
86 cur = new StatisticalData();
87 }
88 return cur;
|
89 sage 1.1 }
90
|
91 denise.eckstein 1.11 StatisticalData::StatisticalData()
92 {
93 copyGSD = 0;
|
94 w.white 1.4
|
95 denise.eckstein 1.11 for (unsigned int i=0; i<StatisticalData::length; i++)
96 {
97 numCalls[i] = 0;
|
98 kumpf 1.18 cimomTime[i] = 0;
|
99 denise.eckstein 1.11 providerTime[i] = 0;
100 responseSize[i] = 0;
101 requestSize[i] = 0;
102 }
|
103 sage 1.1 }
104
|
105 denise.eckstein 1.11 void StatisticalData::addToValue(Sint64 value, Uint16 type, Uint32 t)
106 {
107 if (type >= NUMBER_OF_TYPES)
108 {
|
109 marek 1.19 PEG_TRACE((TRC_DISCARDED_DATA, Tracer::LEVEL2,
|
110 denise.eckstein 1.11 "StatData: Statistical Data Discarded. "
|
111 marek 1.19 "Invalid Request Type = %u", type));
|
112 denise.eckstein 1.11 return;
113 }
114
115 if (copyGSD)
116 {
117 AutoMutex autoMut(_mutex);
118 switch (t)
119 {
|
120 denise.eckstein 1.12 case PEGASUS_STATDATA_SERVER:
|
121 denise.eckstein 1.11 numCalls[type] += 1;
122 cimomTime[type] += value;
|
123 marek 1.20 PEG_TRACE((TRC_STATISTICAL_DATA, Tracer::LEVEL4,
|
124 denise.eckstein 1.11 "StatData: SERVER: %s(%d): count = %"
125 PEGASUS_64BIT_CONVERSION_WIDTH "d; value = %"
126 PEGASUS_64BIT_CONVERSION_WIDTH "d; total = %"
127 PEGASUS_64BIT_CONVERSION_WIDTH "d",
128 (const char *)requestName[type].getCString(), type,
|
129 marek 1.19 numCalls[type], value, cimomTime[type]));
|
130 denise.eckstein 1.11 break;
|
131 denise.eckstein 1.12 case PEGASUS_STATDATA_PROVIDER:
|
132 denise.eckstein 1.11 providerTime[type] += value;
|
133 marek 1.20 PEG_TRACE((TRC_STATISTICAL_DATA, Tracer::LEVEL4,
|
134 denise.eckstein 1.11 "StatData: PROVIDER: %s(%d): count = %"
135 PEGASUS_64BIT_CONVERSION_WIDTH "d; value = %"
136 PEGASUS_64BIT_CONVERSION_WIDTH "d; total = %"
137 PEGASUS_64BIT_CONVERSION_WIDTH "d",
138 (const char *)requestName[type].getCString(), type,
|
139 marek 1.19 numCalls[type], value, providerTime[type]));
|
140 denise.eckstein 1.11 break;
|
141 denise.eckstein 1.12 case PEGASUS_STATDATA_BYTES_SENT:
|
142 denise.eckstein 1.11 responseSize[type] += value;
|
143 marek 1.20 PEG_TRACE((TRC_STATISTICAL_DATA, Tracer::LEVEL4,
|
144 denise.eckstein 1.11 "StatData: BYTES_SENT: %s(%d): count = %"
145 PEGASUS_64BIT_CONVERSION_WIDTH "d; value = %"
146 PEGASUS_64BIT_CONVERSION_WIDTH "d; total = %"
147 PEGASUS_64BIT_CONVERSION_WIDTH "d",
148 (const char *)requestName[type].getCString(), type,
|
149 marek 1.19 numCalls[type], value, responseSize[type]));
|
150 denise.eckstein 1.11 break;
|
151 denise.eckstein 1.12 case PEGASUS_STATDATA_BYTES_READ:
|
152 denise.eckstein 1.11 requestSize[type] += value;
|
153 marek 1.20 PEG_TRACE((TRC_STATISTICAL_DATA, Tracer::LEVEL4,
|
154 denise.eckstein 1.11 "StatData: BYTES_READ: %s(%d): count = %"
155 PEGASUS_64BIT_CONVERSION_WIDTH "d; value = %"
156 PEGASUS_64BIT_CONVERSION_WIDTH "d; total = %"
157 PEGASUS_64BIT_CONVERSION_WIDTH "d",
158 (const char *)requestName[type].getCString(), type,
|
159 marek 1.19 numCalls[type], value, requestSize[type]));
|
160 denise.eckstein 1.11 break;
161 }
162 }
|
163 sage 1.1 }
164
|
165 mike 1.17 void StatisticalData::setCopyGSD(Boolean flag)
|
166 w.white 1.6 {
|
167 kumpf 1.18 copyGSD = flag;
|
168 w.white 1.6 }
|
169 w.white 1.4
|
170 sage 1.1 PEGASUS_NAMESPACE_END
|