source: DCWoRMS/branches/coolemall/src/simulator/stats/DCwormsMetricsCalculator.java @ 1415

Revision 1415, 7.8 KB checked in by wojtekp, 11 years ago (diff)
  • Property svn:mime-type set to text/plain
Line 
1package simulator.stats;
2
3import java.util.ArrayList;
4import java.util.List;
5
6import simulator.stats.implementation.MetricsStats;
7
8public class DCwormsMetricsCalculator extends AbstractMetricsCalculator{
9
10        public DCwormsMetricsCalculator (long startTime, long endTime, long timestamp){
11                super(startTime, endTime, timestamp);
12        }
13       
14        public List<MetricsStats> calulateMetrics(){
15                List<MetricsStats> metrics = new ArrayList<MetricsStats>();
16
17                /*
18                metrics.add(calculateITComputingEnergyConsumption());
19                metrics.add(calculateITEnergyConsumption());
20               
21                metrics.add(calculateCoolingDeviceEnergyConsumption());
22               
23                metrics.add(calculateTotalEnergyConsumption());
24               
25                metrics.add(calculateMeanPower());
26                metrics.add(calculateMaxPower());
27               
28                metrics.add(calculatePUE());
29                metrics.add(calculatePUELevel4());
30                metrics.add(calculateEnergyWasteRate());
31               
32                metrics.add(calculateUsefulWork());
33                metrics.add(calculateProductivity());
34                 */
35               
36                return metrics;
37        }
38       
39        private MetricsStats calculateTotalEnergyConsumption(){
40               
41                MetricsStats metric;
42                try{
43                       
44                        double roomPower = 0;
45                        for(DCwormsAccumulator acc: metricsData.get("Room")){
46                                roomPower = roomPower + acc.getSum();
47                        }
48                       
49                        metric = new MetricsStats("CoolEmAllTestbed", "Total_energy_consumption - not implemented yet", 0, timestamp, "Wh");
50                } catch (Exception e){
51                        metric = new MetricsStats("CoolEmAllTestbed", "Total_energy_consumption - not implemented yet", -1, timestamp, "Wh");
52                }
53                return metric;
54        }
55       
56        private MetricsStats calculateITComputingEnergyConsumption(){
57               
58                MetricsStats metric;
59                try{
60                        double itComputingPower = 0;
61                        for(DCwormsAccumulator acc: metricsData.get("Processor")){
62                                itComputingPower = itComputingPower + acc.getSum();
63                        }
64                        metric = new MetricsStats("CoolEmAllTestbed", "Total_processors_energy_consumption - not implemented yet", 0, timestamp, "Wh");
65                } catch (Exception e){
66                        metric = new MetricsStats("CoolEmAllTestbed", "Total_processors_energy_consumption - not implemented yet", -1, timestamp, "Wh");
67                }
68                return metric;
69        }
70       
71        private MetricsStats calculateITEnergyConsumption(){
72               
73                MetricsStats metric;
74                try{
75                        double totalSitePower = 0;
76                        for(DCwormsAccumulator acc: metricsData.get("Rack")){
77                                totalSitePower = totalSitePower + acc.getSum();
78                        }
79                        double nodeComputingPower = 0;
80                        for(DCwormsAccumulator acc: metricsData.get("Node")){
81                                nodeComputingPower = nodeComputingPower+ acc.getSum();
82                        }
83                        double itComputingPower = 0;
84                        for(DCwormsAccumulator acc: metricsData.get("Processor")){
85                                itComputingPower = itComputingPower + acc.getSum();
86                        }
87                        double fanPowerConumspion = nodeComputingPower - itComputingPower;
88                        metric = new MetricsStats("CoolEmAllTestbed", "Total_IT_energy_consumption - not implemented yet", 0, timestamp, "Wh");
89                } catch (Exception e){
90                        metric = new MetricsStats("CoolEmAllTestbed", "Total_IT_energy_consumption - not implemented yet", -1, timestamp, "Wh");
91                }
92                return metric;
93        }
94       
95        private MetricsStats calculatePUELevel4(){
96               
97                MetricsStats metric;
98                try{
99                       
100                        double roomPower = 0;
101                        for(DCwormsAccumulator acc: metricsData.get("Room")){
102                                roomPower = roomPower + acc.getSum();
103                        }
104                       
105                        double totalSitePower = 0;
106                        for(DCwormsAccumulator acc: metricsData.get("Rack")){
107                                totalSitePower = totalSitePower + acc.getSum();
108                        }
109                       
110               
111                        double nodeComputingPower = 0;
112                        for(DCwormsAccumulator acc: metricsData.get("Node")){
113                                nodeComputingPower = nodeComputingPower+ acc.getSum();
114                        }
115                        double itComputingPower = 0;
116                        for(DCwormsAccumulator acc: metricsData.get("Processor")){
117                                itComputingPower = itComputingPower + acc.getSum();
118                        }
119                        double nodeGroupFansPowerConumspion = nodeComputingPower - itComputingPower;
120
121                        metric = new MetricsStats("CoolEmAllTestbed", "PUE_Level_4 - not implemented yet", 0, timestamp, "");
122                } catch (Exception e){
123                        metric = new MetricsStats("CoolEmAllTestbed", "PUE_Level_4 - not implemented yet", -1, timestamp, "");
124                }
125                return metric;
126        }
127       
128        private MetricsStats calculatePUE(){
129               
130                MetricsStats metric;
131                try{
132                       
133                        double roomPower = 0;
134                        for(DCwormsAccumulator acc: metricsData.get("Room")){
135                                roomPower = roomPower + acc.getSum();
136                        }
137                       
138                        double totalSitePower = 0;
139                        for(DCwormsAccumulator acc: metricsData.get("Rack")){
140                                totalSitePower = totalSitePower + acc.getSum();
141                        }
142
143
144                        metric = new MetricsStats("CoolEmAllTestbed", "PUE - not implemented yet", 0, timestamp, "");
145                } catch (Exception e){
146                        metric = new MetricsStats("CoolEmAllTestbed", "PUE - not implemented yet", -1, timestamp, "");
147                }
148                return metric;
149        }
150
151        private MetricsStats calculateUsefulWork(){
152               
153                MetricsStats metric;
154                try{
155                        double usefulWork = 0;
156                        for(String key: metricsData.keySet()){
157                                if(key.contains("/")){
158                                        for(DCwormsAccumulator acc: metricsData.get(key)){
159                                                usefulWork= usefulWork + acc.getSum();
160                                        }
161                                }
162                        }
163                        metric = new MetricsStats("CoolEmAllTestbed", "Useful_Work - not implemented yet", 0, timestamp, "UW units");
164                } catch (Exception e){
165                        metric = new MetricsStats("CoolEmAllTestbed", "Useful_Work - not implemented yet", -1, timestamp, "UW units");
166                }
167               
168                return metric;
169        }
170       
171        private MetricsStats calculateProductivity(){
172               
173                MetricsStats metric;
174                try{
175                        double usefulWork = 0;
176                        for(String key: metricsData.keySet()){
177                                if(key.contains("/")){
178                                        for(DCwormsAccumulator acc: metricsData.get(key)){
179                                                usefulWork= usefulWork + acc.getSum();
180                                        }
181                                }
182                        }
183                        double totalSitePower = 0;
184                        for(DCwormsAccumulator acc: metricsData.get("Rack")){
185                                totalSitePower = totalSitePower + acc.getSum();
186                        }
187                       
188                        metric = new MetricsStats("CoolEmAllTestbed", "Productivity - not implemented yet", 0, timestamp, "UW units/Wh");
189                } catch (Exception e){
190                        metric = new MetricsStats("CoolEmAllTestbed", "Productivity - not implemented yet", -1, timestamp, "UW units/Wh");
191                }
192               
193                return metric;
194        }
195       
196
197       
198        private MetricsStats calculateMaxPower(){
199               
200                MetricsStats metric;
201                try{
202                        double maxPower = 0;
203                       
204                        for(DCwormsAccumulator acc: metricsData.get("Room_MAX")){
205                                maxPower = maxPower + acc.getSum();
206                        }
207
208                        metric = new MetricsStats("CoolEmAllTestbed", "Max_power - not implemented yet", 0, timestamp, "W");
209                } catch (Exception e){
210                        metric = new MetricsStats("CoolEmAllTestbed", "Max_power - not implemented yet", -1, timestamp, "W");
211                }
212               
213                return metric;
214        }
215
216        private MetricsStats calculateCoolingDeviceEnergyConsumption(){
217               
218                MetricsStats metric;
219                try{
220                        double coolingDevicePower = 0;
221                        for(DCwormsAccumulator acc: metricsData.get("CoolingDevice")){
222                                coolingDevicePower = coolingDevicePower + acc.getSum();
223                        }
224                        metric = new MetricsStats("CoolEmAllTestbed", "Total_cooling_device_energy_consumption - not implemented yet", 0, timestamp, "Wh");
225                } catch (Exception e){
226                        metric = new MetricsStats("CoolEmAllTestbed", "Total_cooling_device_energy_consumption - not implemented yet", -1, timestamp, "Wh");
227                }
228                return metric;
229        }
230
231        private MetricsStats calculateMeanPower(){
232               
233                MetricsStats metric;
234                try{
235                       
236                        double roomPower = 0;
237                        for(DCwormsAccumulator acc: metricsData.get("Room")){
238                                roomPower = roomPower + acc.getSum();
239                        }
240                        metric = new MetricsStats("CoolEmAllTestbed", "Mean_power - not implemented yet", 0, timestamp, "W");
241                } catch (Exception e){
242                        metric = new MetricsStats("CoolEmAllTestbed", "Mean_power - not implemented yet", -1, timestamp, "W");
243                }
244                return metric;
245        }
246       
247        private MetricsStats calculateEnergyWasteRate(){
248               
249                MetricsStats metric;
250                try{
251                        double itComputingEnergy = 0;
252                        for(DCwormsAccumulator acc: metricsData.get("Processor_CALC")){
253                                itComputingEnergy = itComputingEnergy + acc.getSum();
254                        }
255                        double itEnergy = calculateITEnergyConsumption().getValue();
256                       
257                        metric = new MetricsStats("CoolEmAllTestbed", "Energy_waste_rate - not implemented yet", 0, timestamp, "%");
258                } catch (Exception e){
259                        metric = new MetricsStats("CoolEmAllTestbed", "Energy_waste_rate - not implemented yet", -1, timestamp, "%");
260                }
261                return metric;
262        }
263       
264}
265
Note: See TracBrowser for help on using the repository browser.