1 | package test.appProfConverter.dcworms; |
---|
2 | import schedframe.scheduling.tasks.phases.ExecutionPhase; |
---|
3 | import dcworms.schedframe.scheduling.Executable; |
---|
4 | |
---|
5 | public class SoftwareProfile { |
---|
6 | |
---|
7 | public String taskId; |
---|
8 | public SoftwarePhase[] phases; |
---|
9 | |
---|
10 | public SoftwareProfile(Executable executable) { |
---|
11 | this.taskId = executable.getApplicationName(); |
---|
12 | |
---|
13 | int nPhases = executable.getExecutionProfile().getExecutionPhases().size(); |
---|
14 | phases = new SoftwarePhase[nPhases]; |
---|
15 | |
---|
16 | |
---|
17 | for (int i = 0; i < nPhases; i++) { |
---|
18 | ExecutionPhase resConsumption = executable.getExecutionProfile().getExecutionPhases().get(i); |
---|
19 | SoftwarePhase swPhase = new SoftwarePhase(); |
---|
20 | |
---|
21 | swPhase.Duration = (int) resConsumption.getDuration(); |
---|
22 | swPhase.RefNode = resConsumption.getReferenceHardware().get("name"); |
---|
23 | |
---|
24 | try{ |
---|
25 | swPhase.RefCores = Integer.valueOf(resConsumption.getReferenceHardware().get("cpu_cores")); |
---|
26 | } catch (Exception e){ |
---|
27 | |
---|
28 | } |
---|
29 | try{ |
---|
30 | swPhase.RefFreq = Double.valueOf(resConsumption.getReferenceHardware().get("cpu_maxfreq")); |
---|
31 | } catch (Exception e){ |
---|
32 | |
---|
33 | } |
---|
34 | |
---|
35 | for (int b = 0; b < resConsumption.getSystemLoad().size(); b++) { |
---|
36 | String name = resConsumption.getSystemLoad().get(b).getResouceName(); |
---|
37 | if (name.equals("PM_Power")) { |
---|
38 | swPhase.PM_Power = resConsumption.getSystemLoad().get(b).getUtilization(); |
---|
39 | } |
---|
40 | if (name.equals("PM_Disk_IO")) { |
---|
41 | swPhase.PM_Disk_IO = resConsumption.getSystemLoad().get(b).getUtilization(); |
---|
42 | } |
---|
43 | if (name.equals("PM_Memory_RSS")) { |
---|
44 | swPhase.PM_Memory_RSS = resConsumption.getSystemLoad().get(b).getUtilization(); |
---|
45 | } |
---|
46 | if (name.equals("PM_Memory_Usage")) { |
---|
47 | swPhase.PM_Memory_Usage = resConsumption.getSystemLoad().get(b).getUtilization(); |
---|
48 | } |
---|
49 | if (name.equals("PM_CPU_Usage")) { |
---|
50 | swPhase.PM_CPU_Usage = resConsumption.getSystemLoad().get(b).getUtilization(); |
---|
51 | } |
---|
52 | if (name.equals("PM_Threads")) { |
---|
53 | swPhase.PM_Threads = (int) resConsumption.getSystemLoad().get(b).getUtilization(); |
---|
54 | } |
---|
55 | if (name.equals("PM_Download")) { |
---|
56 | swPhase.PM_Download = resConsumption.getSystemLoad().get(b).getUtilization(); |
---|
57 | } |
---|
58 | if (name.equals("PM_Upload")) { |
---|
59 | swPhase.PM_Upload = resConsumption.getSystemLoad().get(b).getUtilization(); |
---|
60 | } |
---|
61 | } |
---|
62 | |
---|
63 | phases[i] = swPhase; |
---|
64 | } |
---|
65 | |
---|
66 | } |
---|
67 | |
---|
68 | public SoftwareProfile() { |
---|
69 | this.taskId = null; |
---|
70 | this.phases = null; |
---|
71 | } |
---|
72 | |
---|
73 | |
---|
74 | } |
---|