1 | package experiments.simpat2012.recs.plugins.energy; |
---|
2 | |
---|
3 | import java.io.FileNotFoundException; |
---|
4 | import java.io.IOException; |
---|
5 | |
---|
6 | import schedframe.resources.computing.Node; |
---|
7 | import schedframe.resources.computing.Processor; |
---|
8 | import schedframe.resources.computing.profiles.energy.ResourceEvent; |
---|
9 | import schedframe.resources.devices.PhysicalResource; |
---|
10 | import schedframe.scheduling.manager.tasks.JobRegistry; |
---|
11 | |
---|
12 | public class AtomD510NodeEEP extends RecsNodeBaseEEP { |
---|
13 | |
---|
14 | public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry, |
---|
15 | PhysicalResource resource) { |
---|
16 | double powerConsumption = 0; |
---|
17 | Node node = (Node) resource; |
---|
18 | try { |
---|
19 | if(jobRegistry.getRunningTasks().size() > 0) { |
---|
20 | powerConsumption = powerConsumption + getMeasuredPower(createQuery(jobRegistry.getRunningTasks().get(0))); |
---|
21 | } |
---|
22 | else { |
---|
23 | for(Processor cpu: node.getProcessors()){ |
---|
24 | try{ |
---|
25 | //powerConsumption = powerConsumption + cpu.getPowerInterface().getRecentPowerUsage().getValue(); |
---|
26 | } catch (Exception e){ |
---|
27 | |
---|
28 | } |
---|
29 | } |
---|
30 | try { |
---|
31 | powerConsumption = powerConsumption + node.getPowerInterface().getPowerConsumption(node.getPowerInterface().getPowerState()); |
---|
32 | } catch (NoSuchFieldException e) { |
---|
33 | } |
---|
34 | } |
---|
35 | } catch (FileNotFoundException e) { |
---|
36 | // TODO Auto-generated catch block |
---|
37 | e.printStackTrace(); |
---|
38 | } catch (IOException e) { |
---|
39 | // TODO Auto-generated catch block |
---|
40 | e.printStackTrace(); |
---|
41 | } |
---|
42 | |
---|
43 | /*return powerConsumption; |
---|
44 | |
---|
45 | double nodeIdle = 19; |
---|
46 | double cpuBase = 1; |
---|
47 | double c = 1.12; |
---|
48 | double f; |
---|
49 | double fbase; |
---|
50 | double papp = 0; |
---|
51 | double load = 0; |
---|
52 | |
---|
53 | double powerConsumption = 0; |
---|
54 | ComputingNode node = (ComputingNode) resource; |
---|
55 | |
---|
56 | if(jobRegistry.getRunningTasks().size() > 0) { |
---|
57 | ExecTask task = jobRegistry.getRunningTasks().get(0); |
---|
58 | try { |
---|
59 | load = task.getCpuCntRequest()/8; |
---|
60 | } catch (NoSuchFieldException e) { |
---|
61 | // TODO Auto-generated catch block |
---|
62 | e.printStackTrace(); |
---|
63 | } |
---|
64 | f = node.getProcessors().get(0).getPowerInterface().getFrequency(); |
---|
65 | fbase = node.getProcessors().get(0).getPowerInterface().getHighestPState().getFrequency(); |
---|
66 | TaskToApp tta = new TaskToApp(); |
---|
67 | switch(tta.getAppType(task)){ |
---|
68 | case abinit:{ |
---|
69 | break; |
---|
70 | } |
---|
71 | case c_ray:{ |
---|
72 | papp = 0.05; |
---|
73 | break; |
---|
74 | } |
---|
75 | case fft: { |
---|
76 | papp = 0.1; |
---|
77 | break; |
---|
78 | } |
---|
79 | case lin_3gb: { |
---|
80 | break; |
---|
81 | } |
---|
82 | case lin_tiny: { |
---|
83 | papp = 0.2; |
---|
84 | break; |
---|
85 | } |
---|
86 | case tar: { |
---|
87 | papp = 0.5; |
---|
88 | break; |
---|
89 | } |
---|
90 | } |
---|
91 | try { |
---|
92 | load = getLoad(createQuery(jobRegistry.getRunningTasks().get(0)))/100; |
---|
93 | } catch (FileNotFoundException e) { |
---|
94 | // TODO Auto-generated catch block |
---|
95 | e.printStackTrace(); |
---|
96 | } catch (IOException e) { |
---|
97 | // TODO Auto-generated catch block |
---|
98 | e.printStackTrace(); |
---|
99 | } |
---|
100 | powerConsumption = nodeIdle + load * cpuBase * Math.pow(c, (f-fbase)/100) + papp; |
---|
101 | |
---|
102 | } |
---|
103 | else { |
---|
104 | for(Processor cpu: node.getProcessors()){ |
---|
105 | try{ |
---|
106 | //powerConsumption = powerConsumption + cpu.getPowerInterface().getRecentPowerUsage().getValue(); |
---|
107 | } catch (Exception e){ |
---|
108 | |
---|
109 | } |
---|
110 | } |
---|
111 | try { |
---|
112 | powerConsumption = powerConsumption + node.getPowerInterface().getPowerConsumption(node.getPowerInterface().getPowerState()); |
---|
113 | } catch (NoSuchFieldException e) { |
---|
114 | } |
---|
115 | } |
---|
116 | |
---|
117 | |
---|
118 | /*double powerConsumption = 0; |
---|
119 | ComputingNode node = (ComputingNode) resource; |
---|
120 | if(jobRegistry.getRunningTasks().size() > 0) { |
---|
121 | for(Processor cpu: node.getProcessors()){ |
---|
122 | try{ |
---|
123 | powerConsumption = powerConsumption + cpu.getPowerInterface().getPState().getPower(); |
---|
124 | } catch (Exception e){ |
---|
125 | |
---|
126 | } |
---|
127 | } |
---|
128 | } |
---|
129 | try { |
---|
130 | powerConsumption = powerConsumption + node.getPowerInterface().getPowerConsumption(node.getPowerInterface().getPowerState()); |
---|
131 | } catch (NoSuchFieldException e) { |
---|
132 | } |
---|
133 | System.out.println("pcd:" + powerConsumption);*/ |
---|
134 | return powerConsumption; |
---|
135 | } |
---|
136 | |
---|
137 | } |
---|