Ignore:
Timestamp:
11/26/13 11:56:07 (11 years ago)
Author:
wojtekp
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • DCWoRMS/branches/coolemall/src/simulator/stats/implementation/TaskStats.java

    r1199 r1207  
    22 
    33 
    4 import java.util.List; 
    5  
     4import java.util.HashSet; 
     5import java.util.Iterator; 
     6import java.util.Set; 
     7 
     8 
     9import schedframe.resources.computing.ComputingNode; 
     10import schedframe.resources.computing.ComputingResource; 
     11import schedframe.resources.computing.Core; 
     12import schedframe.resources.computing.Processor; 
     13import simulator.stats.implementation.out.StatsSerializer; 
    614import dcworms.schedframe.scheduling.Executable; 
    7  
    8 import simulator.stats.implementation.out.StatsSerializer; 
    915 
    1016/** 
     
    1420 */ 
    1521public class TaskStats implements StatsInterface { 
    16         protected List<String> processorsName; 
     22        protected Set<ComputingResource> processingElements; 
    1723        protected double reservationStartDate; 
    1824        protected double reservationFinishDate; 
     
    2632                        "ExecutionTime", "ReadyTime", "StartTime", "FlowTime", 
    2733                        "WaitingTime", "GQ_WaitingTime", "Lateness", "Tardiness", 
    28                         "ReservStartDate", "ReservFinishDate", "ProcessorName", "Energy"}; 
     34                        "ReservStartDate", "ReservFinishDate", "HostNames", "ProcessorName", "Energy", "AppName",}; 
    2935 
    3036        public TaskStats(Executable task, long startSimulationTime) { 
     
    147153        } 
    148154 
    149         public void setProcessorsName(List<String> value) { 
    150                 this.processorsName = value; 
     155        public void setProcessors(Set<ComputingResource> value) { 
     156                this.processingElements = value; 
    151157        } 
    152158 
     
    159165        } 
    160166 
    161         public List<String> getProcessorsName() { 
    162                 return processorsName; 
    163         } 
    164  
     167        public Set<String> getProcessingElementsName() { 
     168                Set<String> processingElementsNames = new HashSet<String>(); 
     169                Iterator<ComputingResource> it = processingElements.iterator(); 
     170                while(it.hasNext()) { 
     171                        ComputingResource compRes = it.next(); 
     172                        processingElementsNames.add(compRes.getFullName()); 
     173                } 
     174                return processingElementsNames; 
     175        } 
     176 
     177        public Set<String> getHostName() { 
     178                Set<String> hostNames = new HashSet<String>(); 
     179                Iterator<ComputingResource> it = processingElements.iterator(); 
     180                while(it.hasNext()) { 
     181                        ComputingResource compRes = it.next(); 
     182                        ComputingNode node = null; 
     183                        if(compRes instanceof Core){ 
     184                                Core core =(Core) compRes; 
     185                                node = (ComputingNode)core.getNode(); 
     186                        } else if(compRes instanceof Processor){ 
     187                                Processor proc = (Processor) compRes; 
     188                                node = (ComputingNode)proc.getNode(); 
     189                        } else if(compRes instanceof ComputingNode){ 
     190                                node = (ComputingNode)compRes; 
     191                        } 
     192                        if(node != null) 
     193                                hostNames.add(node.getFullName()); 
     194                } 
     195                return hostNames; 
     196        } 
     197         
    165198        public double getReservationStartDate() { 
    166199                return reservationStartDate; 
     
    170203                return reservationFinishDate; 
    171204        } 
     205         
     206        public String getExecName() { 
     207                String execName = null; 
     208                if(task.getDescription().getExecution() != null) { 
     209                        if(task.getDescription().getExecution().getStdin()!= null && task.getDescription().getExecution().getStdin().length > 0) 
     210                                execName = task.getDescription().getExecution().getStdin()[0].getName(); 
     211                        else if(task.getDescription().getExecution().getExecutable() != null && task.getDescription().getExecution().getExecutable().getApplication() != null) 
     212                                execName = task.getDescription().getExecution().getExecutable().getApplication().getName(); 
     213                } 
     214                return execName; 
     215        } 
    172216 
    173217        public String[] getHeaders() { 
Note: See TracChangeset for help on using the changeset viewer.