[1334] | 1 | package test.appProfConverter.dcworms; |
---|
[1419] | 2 | import schedframe.scheduling.tasks.phases.ExecutionPhase; |
---|
[1334] | 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 | |
---|
[1426] | 13 | int nPhases = executable.getExecutionProfile().getExecutionPhases().size(); |
---|
[1334] | 14 | phases = new SoftwarePhase[nPhases]; |
---|
| 15 | |
---|
| 16 | |
---|
| 17 | for (int i = 0; i < nPhases; i++) { |
---|
[1426] | 18 | ExecutionPhase resConsumption = executable.getExecutionProfile().getExecutionPhases().get(i); |
---|
[1334] | 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 | |
---|
[1419] | 35 | for (int b = 0; b < resConsumption.getSystemLoad().size(); b++) { |
---|
| 36 | String name = resConsumption.getSystemLoad().get(b).getResouceName(); |
---|
[1334] | 37 | if (name.equals("PM_Power")) { |
---|
[1419] | 38 | swPhase.PM_Power = resConsumption.getSystemLoad().get(b).getUtilization(); |
---|
[1334] | 39 | } |
---|
| 40 | if (name.equals("PM_Disk_IO")) { |
---|
[1419] | 41 | swPhase.PM_Disk_IO = resConsumption.getSystemLoad().get(b).getUtilization(); |
---|
[1334] | 42 | } |
---|
| 43 | if (name.equals("PM_Memory_RSS")) { |
---|
[1419] | 44 | swPhase.PM_Memory_RSS = resConsumption.getSystemLoad().get(b).getUtilization(); |
---|
[1334] | 45 | } |
---|
| 46 | if (name.equals("PM_Memory_Usage")) { |
---|
[1419] | 47 | swPhase.PM_Memory_Usage = resConsumption.getSystemLoad().get(b).getUtilization(); |
---|
[1334] | 48 | } |
---|
| 49 | if (name.equals("PM_CPU_Usage")) { |
---|
[1419] | 50 | swPhase.PM_CPU_Usage = resConsumption.getSystemLoad().get(b).getUtilization(); |
---|
[1334] | 51 | } |
---|
| 52 | if (name.equals("PM_Threads")) { |
---|
[1419] | 53 | swPhase.PM_Threads = (int) resConsumption.getSystemLoad().get(b).getUtilization(); |
---|
[1334] | 54 | } |
---|
| 55 | if (name.equals("PM_Download")) { |
---|
[1419] | 56 | swPhase.PM_Download = resConsumption.getSystemLoad().get(b).getUtilization(); |
---|
[1334] | 57 | } |
---|
| 58 | if (name.equals("PM_Upload")) { |
---|
[1419] | 59 | swPhase.PM_Upload = resConsumption.getSystemLoad().get(b).getUtilization(); |
---|
[1334] | 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 | } |
---|