package test.appProfConverter.dcworms; import schedframe.scheduling.tasks.phases.ExecutionPhase; import dcworms.schedframe.scheduling.Executable; public class SoftwareProfile { public String taskId; public SoftwarePhase[] phases; public SoftwareProfile(Executable executable) { this.taskId = executable.getApplicationName(); int nPhases = executable.getExecutionProfile().getExecutionPhases().size(); phases = new SoftwarePhase[nPhases]; for (int i = 0; i < nPhases; i++) { ExecutionPhase resConsumption = executable.getExecutionProfile().getExecutionPhases().get(i); SoftwarePhase swPhase = new SoftwarePhase(); swPhase.Duration = (int) resConsumption.getDuration(); swPhase.RefNode = resConsumption.getReferenceHardware().get("name"); try{ swPhase.RefCores = Integer.valueOf(resConsumption.getReferenceHardware().get("cpu_cores")); } catch (Exception e){ } try{ swPhase.RefFreq = Double.valueOf(resConsumption.getReferenceHardware().get("cpu_maxfreq")); } catch (Exception e){ } for (int b = 0; b < resConsumption.getSystemLoad().size(); b++) { String name = resConsumption.getSystemLoad().get(b).getResouceName(); if (name.equals("PM_Power")) { swPhase.PM_Power = resConsumption.getSystemLoad().get(b).getUtilization(); } if (name.equals("PM_Disk_IO")) { swPhase.PM_Disk_IO = resConsumption.getSystemLoad().get(b).getUtilization(); } if (name.equals("PM_Memory_RSS")) { swPhase.PM_Memory_RSS = resConsumption.getSystemLoad().get(b).getUtilization(); } if (name.equals("PM_Memory_Usage")) { swPhase.PM_Memory_Usage = resConsumption.getSystemLoad().get(b).getUtilization(); } if (name.equals("PM_CPU_Usage")) { swPhase.PM_CPU_Usage = resConsumption.getSystemLoad().get(b).getUtilization(); } if (name.equals("PM_Threads")) { swPhase.PM_Threads = (int) resConsumption.getSystemLoad().get(b).getUtilization(); } if (name.equals("PM_Download")) { swPhase.PM_Download = resConsumption.getSystemLoad().get(b).getUtilization(); } if (name.equals("PM_Upload")) { swPhase.PM_Upload = resConsumption.getSystemLoad().get(b).getUtilization(); } } phases[i] = swPhase; } } public SoftwareProfile() { this.taskId = null; this.phases = null; } }