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