1 | package experiments.e2dc2015; |
---|
2 | |
---|
3 | import java.util.ArrayList; |
---|
4 | import java.util.List; |
---|
5 | |
---|
6 | import simulator.stats.AbstractMetricsCalculator; |
---|
7 | import simulator.stats.DCwormsAccumulator; |
---|
8 | import simulator.stats.implementation.MetricsStats; |
---|
9 | import example.energy.coolemall.CoolEmAllTestbedMeasurements; |
---|
10 | |
---|
11 | public class E2DC2015MetricsCalculator extends AbstractMetricsCalculator{ |
---|
12 | |
---|
13 | double leakage; |
---|
14 | double tempExcTime; |
---|
15 | double tempExcTimeH; |
---|
16 | public E2DC2015MetricsCalculator (long startTime, long endTime, long timestamp){ |
---|
17 | super(startTime, endTime, timestamp); |
---|
18 | } |
---|
19 | |
---|
20 | public List<MetricsStats> calulateMetrics(){ |
---|
21 | List<MetricsStats> metrics = new ArrayList<MetricsStats>(); |
---|
22 | /*for(String resourceTypeName: metricsData.keySet()){ |
---|
23 | MetricsStats metric = new MetricsStats(resourceTypeName, "energyUsage", metricsData.get(resourceTypeName).getMax()); |
---|
24 | metrics.add(metric);} |
---|
25 | }*/ |
---|
26 | |
---|
27 | leakage = calculateLeakageEnergyConsumption().getValue(); |
---|
28 | tempExcTime = calculateTempExcTime().getValue(); |
---|
29 | tempExcTimeH = calculateTempExcTimeH().getValue(); |
---|
30 | metrics.add(calculateLeakageEnergyConsumption()); |
---|
31 | metrics.add(calculateTempExcTime()); |
---|
32 | metrics.add(calculateTempExcTimeH()); |
---|
33 | metrics.add(calculateITComputingEnergyConsumption()); |
---|
34 | metrics.add(calculateITEnergyConsumption()); |
---|
35 | metrics.add(calculateNodeGroupFansEnergyConsumption()); |
---|
36 | |
---|
37 | metrics.add(calculateRackEnergyConsumption()); |
---|
38 | metrics.add(calculateDataCenterFansEnergyConsumption()); |
---|
39 | metrics.add(calculateCoolingDeviceEnergyConsumption()); |
---|
40 | metrics.add(calculateOtherDevicesEnergyConsumption()); |
---|
41 | |
---|
42 | metrics.add(calculateTotalEnergyConsumption()); |
---|
43 | |
---|
44 | metrics.add(calculateMeanRackPower()); |
---|
45 | metrics.add(calculateMeanPower()); |
---|
46 | metrics.add(calculateMaxRackPower()); |
---|
47 | metrics.add(calculateMaxPower()); |
---|
48 | |
---|
49 | metrics.add(calculatePUE()); |
---|
50 | metrics.add(calculatePUELevel4()); |
---|
51 | metrics.add(calculateEnergyWasteRate()); |
---|
52 | |
---|
53 | metrics.add(calculateUsefulWork()); |
---|
54 | metrics.add(calculateProductivity()); |
---|
55 | |
---|
56 | return metrics; |
---|
57 | } |
---|
58 | |
---|
59 | private MetricsStats calculateTempExcTime() { |
---|
60 | MetricsStats metric; |
---|
61 | try{ |
---|
62 | |
---|
63 | double tet = 0; |
---|
64 | for(String key: metricsData.keySet()){ |
---|
65 | if(key.contains("TEMPEXC")){ |
---|
66 | for(DCwormsAccumulator acc: metricsData.get(key)){ |
---|
67 | tet = tet + acc.getMean(); |
---|
68 | } |
---|
69 | } |
---|
70 | } |
---|
71 | |
---|
72 | metric = new MetricsStats("CoolEmAllTestbed", "Temp_exc_time", (tet), timestamp, "s"); |
---|
73 | } catch (Exception e){ |
---|
74 | metric = new MetricsStats("CoolEmAllTestbed", "Temp_exc_time", -1, timestamp, "s"); |
---|
75 | } |
---|
76 | return metric; |
---|
77 | } |
---|
78 | |
---|
79 | private MetricsStats calculateTempExcTimeH() { |
---|
80 | MetricsStats metric; |
---|
81 | try{ |
---|
82 | |
---|
83 | double tet = 0; |
---|
84 | for(String key: metricsData.keySet()){ |
---|
85 | if(key.contains("TEMPHEXC")){ |
---|
86 | for(DCwormsAccumulator acc: metricsData.get(key)){ |
---|
87 | tet = tet + acc.getMean(); |
---|
88 | } |
---|
89 | } |
---|
90 | } |
---|
91 | |
---|
92 | metric = new MetricsStats("CoolEmAllTestbed", "Temp_exc_time_h", (tet), timestamp, "s"); |
---|
93 | } catch (Exception e){ |
---|
94 | metric = new MetricsStats("CoolEmAllTestbed", "Temp_exc_time_h", -1, timestamp, "s"); |
---|
95 | } |
---|
96 | return metric; |
---|
97 | } |
---|
98 | |
---|
99 | private MetricsStats calculateLeakageEnergyConsumption() { |
---|
100 | MetricsStats metric; |
---|
101 | try{ |
---|
102 | |
---|
103 | double pl = 0; |
---|
104 | for(String key: metricsData.keySet()){ |
---|
105 | if(key.contains("PowerLeakage")){ |
---|
106 | for(DCwormsAccumulator acc: metricsData.get(key)){ |
---|
107 | pl = pl + acc.getSum(); |
---|
108 | } |
---|
109 | } |
---|
110 | } |
---|
111 | |
---|
112 | metric = new MetricsStats("CoolEmAllTestbed", "Power_Leakage_energy_consumption", (pl/2), timestamp, "Wh"); |
---|
113 | } catch (Exception e){ |
---|
114 | metric = new MetricsStats("CoolEmAllTestbed", "Power_Leakage_energy_consumption", -1, timestamp, "Wh"); |
---|
115 | } |
---|
116 | return metric; |
---|
117 | } |
---|
118 | |
---|
119 | private MetricsStats calculateTotalEnergyConsumption(){ |
---|
120 | |
---|
121 | MetricsStats metric; |
---|
122 | try{ |
---|
123 | |
---|
124 | double roomPower = 0; |
---|
125 | for(DCwormsAccumulator acc: metricsData.get("Room")){ |
---|
126 | roomPower = roomPower + acc.getSum(); |
---|
127 | } |
---|
128 | metric = new MetricsStats("CoolEmAllTestbed", "Total_energy_consumption", roomPower, timestamp, "Wh"); |
---|
129 | } catch (Exception e){ |
---|
130 | metric = new MetricsStats("CoolEmAllTestbed", "Total_energy_consumption", -1, timestamp, "Wh"); |
---|
131 | } |
---|
132 | return metric; |
---|
133 | } |
---|
134 | |
---|
135 | private MetricsStats calculateITComputingEnergyConsumption(){ |
---|
136 | |
---|
137 | MetricsStats metric; |
---|
138 | try{ |
---|
139 | double itComputingPower = 0; |
---|
140 | for(DCwormsAccumulator acc: metricsData.get("Processor")){ |
---|
141 | itComputingPower = itComputingPower + acc.getSum(); |
---|
142 | } |
---|
143 | metric = new MetricsStats("CoolEmAllTestbed", "Total_processors_energy_consumption", (itComputingPower), timestamp, "Wh"); |
---|
144 | } catch (Exception e){ |
---|
145 | metric = new MetricsStats("CoolEmAllTestbed", "Total_processors_energy_consumption", -1, timestamp, "Wh"); |
---|
146 | } |
---|
147 | return metric; |
---|
148 | } |
---|
149 | |
---|
150 | private MetricsStats calculateITEnergyConsumption(){ |
---|
151 | |
---|
152 | MetricsStats metric; |
---|
153 | try{ |
---|
154 | double totalSitePower = 0; |
---|
155 | for(DCwormsAccumulator acc: metricsData.get("Rack")){ |
---|
156 | totalSitePower = totalSitePower + acc.getSum(); |
---|
157 | } |
---|
158 | double nodeComputingPower = 0; |
---|
159 | for(DCwormsAccumulator acc: metricsData.get("NodeGroup")){ |
---|
160 | nodeComputingPower = nodeComputingPower+ acc.getSum(); |
---|
161 | } |
---|
162 | double itComputingPower = 0; |
---|
163 | for(DCwormsAccumulator acc: metricsData.get("Node")){ |
---|
164 | itComputingPower = itComputingPower + acc.getSum(); |
---|
165 | } |
---|
166 | double nodeGroupFansPowerConumspion = nodeComputingPower - itComputingPower - leakage; |
---|
167 | metric = new MetricsStats("CoolEmAllTestbed", "Total_IT_energy_consumption", (totalSitePower * CoolEmAllTestbedMeasurements.POWER_SUPPLY_EFFICIENCY - nodeGroupFansPowerConumspion), timestamp, "Wh"); |
---|
168 | } catch (Exception e){ |
---|
169 | metric = new MetricsStats("CoolEmAllTestbed", "Total_IT_energy_consumption", -1, timestamp, "Wh"); |
---|
170 | } |
---|
171 | return metric; |
---|
172 | } |
---|
173 | |
---|
174 | private MetricsStats calculateNodeGroupFansEnergyConsumption(){ |
---|
175 | |
---|
176 | MetricsStats metric; |
---|
177 | try{ |
---|
178 | double nodeComputingPower = 0; |
---|
179 | for(DCwormsAccumulator acc: metricsData.get("NodeGroup")){ |
---|
180 | nodeComputingPower = nodeComputingPower+ acc.getSum(); |
---|
181 | } |
---|
182 | System.out.println("nodeComputingPower " + nodeComputingPower ); |
---|
183 | double itComputingPower = 0; |
---|
184 | for(DCwormsAccumulator acc: metricsData.get("Node")){ |
---|
185 | itComputingPower = itComputingPower + acc.getSum(); |
---|
186 | } |
---|
187 | System.out.println("itComputingPower " +itComputingPower ); |
---|
188 | double nodeGroupFansPowerConumspion = nodeComputingPower - itComputingPower - leakage; |
---|
189 | metric = new MetricsStats("CoolEmAllTestbed", "Total_node_group_fans_energy_consumption", nodeGroupFansPowerConumspion, timestamp, "Wh"); |
---|
190 | } catch (Exception e){ |
---|
191 | metric = new MetricsStats("CoolEmAllTestbed", "Total_node_group_fans_energy_consumption", -1, timestamp, "Wh"); |
---|
192 | } |
---|
193 | return metric; |
---|
194 | } |
---|
195 | |
---|
196 | private MetricsStats calculatePUELevel4(){ |
---|
197 | |
---|
198 | MetricsStats metric; |
---|
199 | try{ |
---|
200 | |
---|
201 | double roomPower = 0; |
---|
202 | for(DCwormsAccumulator acc: metricsData.get("Room")){ |
---|
203 | roomPower = roomPower + acc.getSum(); |
---|
204 | } |
---|
205 | |
---|
206 | double totalSitePower = 0; |
---|
207 | for(DCwormsAccumulator acc: metricsData.get("Rack")){ |
---|
208 | totalSitePower = totalSitePower + acc.getSum(); |
---|
209 | } |
---|
210 | |
---|
211 | |
---|
212 | double nodeComputingPower = 0; |
---|
213 | for(DCwormsAccumulator acc: metricsData.get("NodeGroup")){ |
---|
214 | nodeComputingPower = nodeComputingPower+ acc.getSum(); |
---|
215 | } |
---|
216 | double itComputingPower = 0; |
---|
217 | for(DCwormsAccumulator acc: metricsData.get("Node")){ |
---|
218 | itComputingPower = itComputingPower + acc.getSum(); |
---|
219 | } |
---|
220 | double nodeGroupFansPowerConumspion = nodeComputingPower - itComputingPower - leakage; |
---|
221 | System.out.println(roomPower + "; " + totalSitePower + "; " + CoolEmAllTestbedMeasurements.POWER_SUPPLY_EFFICIENCY + "; " + nodeGroupFansPowerConumspion+ "; " + nodeComputingPower+ "; " +itComputingPower ); |
---|
222 | metric = new MetricsStats("CoolEmAllTestbed", "PUE_Level_4", roomPower/(totalSitePower * CoolEmAllTestbedMeasurements.POWER_SUPPLY_EFFICIENCY - nodeGroupFansPowerConumspion), timestamp, ""); |
---|
223 | } catch (Exception e){ |
---|
224 | metric = new MetricsStats("CoolEmAllTestbed", "PUE_Level_4", -1, timestamp, ""); |
---|
225 | } |
---|
226 | return metric; |
---|
227 | } |
---|
228 | |
---|
229 | private MetricsStats calculatePUE(){ |
---|
230 | |
---|
231 | MetricsStats metric; |
---|
232 | try{ |
---|
233 | |
---|
234 | double roomPower = 0; |
---|
235 | for(DCwormsAccumulator acc: metricsData.get("Room")){ |
---|
236 | roomPower = roomPower + acc.getSum(); |
---|
237 | } |
---|
238 | |
---|
239 | double totalSitePower = 0; |
---|
240 | for(DCwormsAccumulator acc: metricsData.get("Rack")){ |
---|
241 | totalSitePower = totalSitePower + acc.getSum(); |
---|
242 | } |
---|
243 | |
---|
244 | |
---|
245 | metric = new MetricsStats("CoolEmAllTestbed", "PUE", roomPower/totalSitePower, timestamp, ""); |
---|
246 | } catch (Exception e){ |
---|
247 | metric = new MetricsStats("CoolEmAllTestbed", "PUE", -1, timestamp, ""); |
---|
248 | } |
---|
249 | return metric; |
---|
250 | } |
---|
251 | |
---|
252 | private MetricsStats calculateUsefulWork(){ |
---|
253 | |
---|
254 | MetricsStats metric; |
---|
255 | try{ |
---|
256 | double usefulWork = 0; |
---|
257 | for(String key: metricsData.keySet()){ |
---|
258 | if(key.contains("UW_")){ |
---|
259 | for(DCwormsAccumulator acc: metricsData.get(key)){ |
---|
260 | usefulWork= usefulWork + acc.getSum(); |
---|
261 | } |
---|
262 | } |
---|
263 | } |
---|
264 | metric = new MetricsStats("CoolEmAllTestbed", "Useful_Work", usefulWork, timestamp, "UW units"); |
---|
265 | } catch (Exception e){ |
---|
266 | metric = new MetricsStats("CoolEmAllTestbed", "Useful_Work", -1, timestamp, "UW units"); |
---|
267 | } |
---|
268 | |
---|
269 | return metric; |
---|
270 | } |
---|
271 | |
---|
272 | private MetricsStats calculateProductivity(){ |
---|
273 | |
---|
274 | MetricsStats metric; |
---|
275 | try{ |
---|
276 | double usefulWork = 0; |
---|
277 | for(String key: metricsData.keySet()){ |
---|
278 | if(key.contains("UW_")){ |
---|
279 | for(DCwormsAccumulator acc: metricsData.get(key)){ |
---|
280 | usefulWork= usefulWork + acc.getSum(); |
---|
281 | } |
---|
282 | } |
---|
283 | } |
---|
284 | double totalSitePower = 0; |
---|
285 | for(DCwormsAccumulator acc: metricsData.get("Rack")){ |
---|
286 | totalSitePower = totalSitePower + acc.getSum(); |
---|
287 | } |
---|
288 | |
---|
289 | metric = new MetricsStats("CoolEmAllTestbed", "Productivity", usefulWork/totalSitePower, timestamp, "UW units/Wh"); |
---|
290 | } catch (Exception e){ |
---|
291 | metric = new MetricsStats("CoolEmAllTestbed", "Productivity", -1, timestamp, "UW units/Wh"); |
---|
292 | } |
---|
293 | |
---|
294 | return metric; |
---|
295 | } |
---|
296 | |
---|
297 | |
---|
298 | private MetricsStats calculateMaxRackPower(){ |
---|
299 | |
---|
300 | MetricsStats metric; |
---|
301 | try{ |
---|
302 | double maxPower = 0; |
---|
303 | |
---|
304 | for(DCwormsAccumulator acc: metricsData.get("Rack_MAX")){ |
---|
305 | maxPower = maxPower + acc.getSum(); |
---|
306 | } |
---|
307 | |
---|
308 | metric = new MetricsStats("CoolEmAllTestbed", "Max_rack_power", maxPower, timestamp, "W"); |
---|
309 | } catch (Exception e){ |
---|
310 | metric = new MetricsStats("CoolEmAllTestbed", "Max_rack_power", -1, timestamp, "W"); |
---|
311 | } |
---|
312 | |
---|
313 | return metric; |
---|
314 | } |
---|
315 | |
---|
316 | private MetricsStats calculateMaxPower(){ |
---|
317 | |
---|
318 | MetricsStats metric; |
---|
319 | try{ |
---|
320 | double maxPower = 0; |
---|
321 | |
---|
322 | for(DCwormsAccumulator acc: metricsData.get("Room_MAX")){ |
---|
323 | maxPower = maxPower + acc.getSum(); |
---|
324 | } |
---|
325 | |
---|
326 | metric = new MetricsStats("CoolEmAllTestbed", "Max_power", maxPower, timestamp, "W"); |
---|
327 | } catch (Exception e){ |
---|
328 | metric = new MetricsStats("CoolEmAllTestbed", "Max_power", -1, timestamp, "W"); |
---|
329 | } |
---|
330 | |
---|
331 | return metric; |
---|
332 | } |
---|
333 | |
---|
334 | private MetricsStats calculateDataCenterFansEnergyConsumptionNew(){ |
---|
335 | |
---|
336 | MetricsStats metric; |
---|
337 | try{ |
---|
338 | double inletsPower = 0; |
---|
339 | for(DCwormsAccumulator acc: metricsData.get("Inlet")){ |
---|
340 | inletsPower = inletsPower + acc.getSum(); |
---|
341 | } |
---|
342 | |
---|
343 | double outletsPower = 0; |
---|
344 | for(DCwormsAccumulator acc: metricsData.get("Outlet")){ |
---|
345 | outletsPower = outletsPower + acc.getSum(); |
---|
346 | } |
---|
347 | |
---|
348 | double nodeComputingPower = 0; |
---|
349 | for(DCwormsAccumulator acc: metricsData.get("Node")){ |
---|
350 | nodeComputingPower = nodeComputingPower+ acc.getSum(); |
---|
351 | } |
---|
352 | double itComputingPower = 0; |
---|
353 | for(DCwormsAccumulator acc: metricsData.get("Processor")){ |
---|
354 | itComputingPower = itComputingPower + acc.getSum(); |
---|
355 | } |
---|
356 | double nodeGroupFansPowerConumspion = nodeComputingPower - itComputingPower; |
---|
357 | |
---|
358 | metric = new MetricsStats("CoolEmAllTestbed", "Total_data_center_fans_energy_consumption", (inletsPower + outletsPower - nodeGroupFansPowerConumspion), timestamp, "Wh"); |
---|
359 | } catch (Exception e){ |
---|
360 | metric = new MetricsStats("CoolEmAllTestbed", "Total_data_center_fans_energy_consumption", -1, timestamp, "Wh"); |
---|
361 | } |
---|
362 | return metric; |
---|
363 | } |
---|
364 | |
---|
365 | private MetricsStats calculateRackEnergyConsumption(){ |
---|
366 | |
---|
367 | MetricsStats metric; |
---|
368 | try{ |
---|
369 | double roomPower = 0; |
---|
370 | for(DCwormsAccumulator acc: metricsData.get("Rack")){ |
---|
371 | roomPower = roomPower + acc.getSum(); |
---|
372 | } |
---|
373 | metric = new MetricsStats("CoolEmAllTestbed", "Total_rack_energy_consumption", roomPower, timestamp, "Wh"); |
---|
374 | } catch (Exception e){ |
---|
375 | metric = new MetricsStats("CoolEmAllTestbed", "Total_rack_energy_consumption", -1, timestamp, "Wh"); |
---|
376 | } |
---|
377 | return metric; |
---|
378 | } |
---|
379 | |
---|
380 | private MetricsStats calculateCoolingDeviceEnergyConsumption(){ |
---|
381 | |
---|
382 | MetricsStats metric; |
---|
383 | try{ |
---|
384 | double coolingDevicePower = 0; |
---|
385 | for(DCwormsAccumulator acc: metricsData.get("CoolingDevice")){ |
---|
386 | coolingDevicePower = coolingDevicePower + acc.getSum(); |
---|
387 | } |
---|
388 | metric = new MetricsStats("CoolEmAllTestbed", "Total_cooling_device_energy_consumption", coolingDevicePower, timestamp, "Wh"); |
---|
389 | } catch (Exception e){ |
---|
390 | metric = new MetricsStats("CoolEmAllTestbed", "Total_cooling_device_energy_consumption", -1, timestamp, "Wh"); |
---|
391 | } |
---|
392 | return metric; |
---|
393 | } |
---|
394 | |
---|
395 | private MetricsStats calculateDataCenterFansEnergyConsumption(){ |
---|
396 | |
---|
397 | MetricsStats metric; |
---|
398 | try{ |
---|
399 | |
---|
400 | double flowPump = 0; |
---|
401 | for(String key: metricsData.keySet()){ |
---|
402 | if(key.contains("FlowPump")){ |
---|
403 | for(DCwormsAccumulator acc: metricsData.get(key)){ |
---|
404 | flowPump = flowPump + acc.getSum(); |
---|
405 | } |
---|
406 | } |
---|
407 | } |
---|
408 | |
---|
409 | metric = new MetricsStats("CoolEmAllTestbed", "Total_data_center_fans_energy_consumption", (flowPump), timestamp, "Wh"); |
---|
410 | } catch (Exception e){ |
---|
411 | metric = new MetricsStats("CoolEmAllTestbed", "Total_data_center_fans_energy_consumption", -1, timestamp, "Wh"); |
---|
412 | } |
---|
413 | return metric; |
---|
414 | } |
---|
415 | |
---|
416 | |
---|
417 | private MetricsStats calculateOtherDevicesEnergyConsumption(){ |
---|
418 | |
---|
419 | MetricsStats metric; |
---|
420 | try{ |
---|
421 | double roomPower = 0; |
---|
422 | for(DCwormsAccumulator acc: metricsData.get("Room")){ |
---|
423 | roomPower = roomPower + acc.getSum(); |
---|
424 | } |
---|
425 | |
---|
426 | double totalSitePower = 0; |
---|
427 | for(DCwormsAccumulator acc: metricsData.get("Rack")){ |
---|
428 | totalSitePower = totalSitePower + acc.getSum(); |
---|
429 | } |
---|
430 | |
---|
431 | double coolingDevicePower = 0; |
---|
432 | for(DCwormsAccumulator acc: metricsData.get("CoolingDevice")){ |
---|
433 | coolingDevicePower = coolingDevicePower + acc.getSum(); |
---|
434 | } |
---|
435 | |
---|
436 | double inletsPower = 0; |
---|
437 | for(DCwormsAccumulator acc: metricsData.get("Inlet")){ |
---|
438 | inletsPower = inletsPower + acc.getSum(); |
---|
439 | } |
---|
440 | |
---|
441 | double outletsPower = 0; |
---|
442 | for(DCwormsAccumulator acc: metricsData.get("Outlet")){ |
---|
443 | outletsPower = outletsPower + acc.getSum(); |
---|
444 | } |
---|
445 | |
---|
446 | metric = new MetricsStats("CoolEmAllTestbed", "Total_other_devices_energy_consumption", roomPower - (totalSitePower + coolingDevicePower + (inletsPower + outletsPower)), timestamp, "Wh"); |
---|
447 | } catch (Exception e){ |
---|
448 | metric = new MetricsStats("CoolEmAllTestbed", "Total_other_devices_energy_consumption", -1, timestamp, "Wh"); |
---|
449 | } |
---|
450 | return metric; |
---|
451 | } |
---|
452 | |
---|
453 | |
---|
454 | private MetricsStats calculateMeanPower(){ |
---|
455 | |
---|
456 | MetricsStats metric; |
---|
457 | try{ |
---|
458 | |
---|
459 | double roomPower = 0; |
---|
460 | for(DCwormsAccumulator acc: metricsData.get("Room")){ |
---|
461 | roomPower = roomPower + acc.getSum(); |
---|
462 | } |
---|
463 | metric = new MetricsStats("CoolEmAllTestbed", "Mean_power", roomPower/((this.endTime - this.startTime)/(SEC_IN_HOUR * MILLI_SEC)), timestamp, "W"); |
---|
464 | } catch (Exception e){ |
---|
465 | metric = new MetricsStats("CoolEmAllTestbed", "Mean_power", -1, timestamp, "W"); |
---|
466 | } |
---|
467 | return metric; |
---|
468 | } |
---|
469 | |
---|
470 | |
---|
471 | private MetricsStats calculateMeanRackPower(){ |
---|
472 | |
---|
473 | MetricsStats metric; |
---|
474 | try{ |
---|
475 | |
---|
476 | double roomPower = 0; |
---|
477 | for(DCwormsAccumulator acc: metricsData.get("Rack")){ |
---|
478 | roomPower = roomPower + acc.getSum(); |
---|
479 | } |
---|
480 | metric = new MetricsStats("CoolEmAllTestbed", "Mean_rack_power", roomPower/((this.endTime - this.startTime)/(SEC_IN_HOUR * MILLI_SEC)), timestamp, "W"); |
---|
481 | } catch (Exception e){ |
---|
482 | metric = new MetricsStats("CoolEmAllTestbed", "Mean_rack_power", -1, timestamp, "W"); |
---|
483 | } |
---|
484 | return metric; |
---|
485 | } |
---|
486 | |
---|
487 | private MetricsStats calculateEnergyWasteRate(){ |
---|
488 | |
---|
489 | MetricsStats metric; |
---|
490 | try{ |
---|
491 | double itComputingEnergy = 0; |
---|
492 | |
---|
493 | for(DCwormsAccumulator acc: metricsData.get("Processor_CALC")){ |
---|
494 | itComputingEnergy = itComputingEnergy + acc.getSum(); |
---|
495 | } |
---|
496 | |
---|
497 | double itEnergy = calculateITEnergyConsumption().getValue(); |
---|
498 | |
---|
499 | metric = new MetricsStats("CoolEmAllTestbed", "Energy_waste_rate", (1 - itComputingEnergy/itEnergy) * 100, timestamp, "%"); |
---|
500 | } catch (Exception e){ |
---|
501 | metric = new MetricsStats("CoolEmAllTestbed", "Energy_waste_rate", -1, timestamp, "%"); |
---|
502 | } |
---|
503 | |
---|
504 | return metric; |
---|
505 | } |
---|
506 | |
---|
507 | } |
---|