Ignore:
Timestamp:
04/11/12 16:30:38 (13 years ago)
Author:
piontek
Message:
 
Location:
xssim/branches/tpiontek/src
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • xssim/branches/tpiontek/src/example/energy/CPUEnergyEstimationPlugin.java

    r206 r241  
    11package example.energy; 
    22 
     3import gssim.schedframe.scheduling.ExecTaskInterface; 
     4 
     5import java.util.List; 
    36import java.util.Properties; 
    47 
     
    1619                        ComputingResource resource) { 
    1720                Processor cpu = (Processor)resource; 
     21                 
    1822                if(resource.getPowerInterface().getPowerState() == PowerState.OFF) 
    1923                        return 0; 
     24                 
     25                double factor = 1.3; 
     26                 
    2027                if(resource.getStatus() == ResourceStatus.BUSY) 
    21                         return cpu.getPowerInterface().getPState().getPower(); 
     28                { 
     29                        List<ExecTaskInterface> tasks = jobRegistry.getRunningTasks(); 
     30                        int type = Integer.parseInt( tasks.get(0).getJobId()); 
     31                         
     32                        switch( type % 4) 
     33                        { 
     34                                default: factor = 1.3;  
     35                        } 
     36                         
     37                        return cpu.getPowerInterface().getPState().getPower() * factor; 
     38                }        
    2239                else  
    23                         return 1;  
     40                        return cpu.getPowerInterface().getPState().getPower();  
    2441        } 
    2542 
  • xssim/branches/tpiontek/src/example/energy/ComputingNodeEnergyEstimationPlugin.java

    r206 r241  
    55import test.rewolucja.energy.EnergyEvent; 
    66import test.rewolucja.resources.physical.base.ComputingResource; 
     7import test.rewolucja.resources.physical.implementation.ComputingNode; 
    78import test.rewolucja.resources.physical.implementation.Processor; 
    8 import test.rewolucja.resources.physical.implementation.ComputingNode; 
    99import test.rewolucja.scheduling.JobRegistryInterface; 
    1010 
     
    1616                double power = 0; 
    1717                ComputingNode node = (ComputingNode) resource; 
     18                 
     19                if( node.getCategory().getName().equals("A")) 
     20                        power = 240; 
     21                else if( node.getCategory().getName().equals("B")) 
     22                        power = 95; 
     23                else 
     24                { 
     25                        System.err.println("Unknown Model: "  +node.getCategory().getName()); 
     26                        System.exit(1); 
     27                }        
     28                 
     29                 
     30                 
    1831                for(Processor cpu: node.getProcessors()){ 
    1932                        //try{ 
     
    2336                        //} 
    2437                } 
    25                 power += node.getPowerInterface().getPowerConsumption(node.getPowerInterface().getPowerState()); 
     38                //power += node.getPowerInterface().getPowerConsumption(node.getPowerInterface().getPowerState()); 
    2639                return power; 
    2740        } 
  • xssim/branches/tpiontek/src/example/localplugin/FCFSRandomClusterLocalPlugin.java

    r192 r241  
    33import gridsim.Gridlet; 
    44 
     5import java.util.ArrayList; 
    56import java.util.List; 
    67import java.util.Properties; 
     
    1112import schedframe.scheduling.plugin.grid.ModuleList; 
    1213import test.rewolucja.GSSIMJobInterface; 
     14import test.rewolucja.energy.profile.PStateType; 
    1315import test.rewolucja.resources.manager.implementation.ClusterResourceManager; 
    1416import test.rewolucja.resources.manager.interfaces.ResourceManagerInterface; 
    1517import test.rewolucja.resources.physical.implementation.ComputingNode; 
     18import test.rewolucja.resources.physical.implementation.Processor; 
    1619import test.rewolucja.scheduling.JobRegistryInterface; 
    1720import test.rewolucja.scheduling.plan.SchedulingPlanInterfaceNew; 
     
    2326 
    2427        private Random rand; 
     28        private boolean init = true; 
    2529         
    2630        public FCFSRandomClusterLocalPlugin() { 
     
    3034        public SchedulingPlanInterfaceNew schedule(SchedulingEvent event, QueueList queues, JobRegistryInterface jobRegistry, 
    3135                         ResourceManagerInterface resManager, ModuleList modules) { 
     36                 
     37                ClusterResourceManager resourceManager = (ClusterResourceManager) resManager; 
     38                 
     39                if( init) 
     40                { 
     41                        List<Processor> cpus = resourceManager.getProcessors(); 
     42                         
     43                        for( Processor cpu : cpus) 
     44                                cpu.getPowerInterface().setPState( PStateType.P3); 
     45                         
     46                        init = false; 
     47                } 
     48                 
    3249 
    33                 ClusterResourceManager resourceManager = (ClusterResourceManager) resManager; 
     50                 
    3451                SchedulingPlanNew plan = new SchedulingPlanNew(); 
    3552                // chose the events types to serve. 
     
    4865                                // if status of the tasks in READY 
    4966                                if (task.getStatus() == Gridlet.READY) { 
    50                                         String nodeName = chooseRandomProvider(resourceManager); 
     67                                        String nodeName = chooseRandomProvider(resourceManager, task); 
    5168                                        if (nodeName != null) { 
    5269                                                addToSchedulingPlan(plan, task, nodeName); 
     
    5976        } 
    6077 
    61         private String chooseRandomProvider(ClusterResourceManager resourceManager) { 
     78        private List<ComputingNode> findSuitableNodes(int cpuRequest, List<ComputingNode> nodes){ 
     79                List<ComputingNode> avNodes = new ArrayList<ComputingNode>(); 
     80                for(ComputingNode node: nodes){ 
     81                        if(node.getFreeProcessorsNumber() >= cpuRequest){ 
     82                                avNodes.add(node); 
     83                        } 
     84                } 
     85                return avNodes; 
     86        } 
     87         
     88        private String chooseRandomProvider(ClusterResourceManager resourceManager, TaskInterface<?> task) { 
     89                 
     90                int cpuRequest; 
     91                try { 
     92                        cpuRequest = Double.valueOf(task.getCpuCntRequest()).intValue(); 
     93                } catch (NoSuchFieldException e) { 
     94                        cpuRequest = 1; 
     95                } 
     96                 
    6297                List<ComputingNode> nodes = resourceManager.getComputingNodes(); 
     98                 
     99                nodes = findSuitableNodes(cpuRequest, nodes); 
     100                 
    63101                int nodeIdx = rand.nextInt(nodes.size()); 
    64102                return nodes.get(nodeIdx).getName(); 
  • xssim/branches/tpiontek/src/example/timeestimation/ExecTimeEstimationPlugin.java

    r184 r241  
    1010import schedframe.scheduling.plugin.SchedulingPluginConfiguration; 
    1111import schedframe.scheduling.utils.ResourceParameterName; 
     12import test.rewolucja.energy.profile.PState; 
     13import test.rewolucja.energy.profile.PStateType; 
    1214import test.rewolucja.resources.ProcessingElements; 
     15import test.rewolucja.resources.physical.implementation.Processor; 
    1316 
    1417 
     
    3841                // obtain single pe speed 
    3942                int speed = pes.getSpeed(); 
    40  
     43                 
    4144                // number of used pe   
    4245                int cnt = pes.getUsedAmount(); 
     
    4447                double remainingLength =  task.getLength() * (1- completionPercentage); 
    4548                // do the calculation 
    46                 double execTime = (remainingLength / (cnt * speed)); 
     49                double execTime = (remainingLength / (cnt * speed/1000)); 
    4750 
    4851                // if the result is very close to 0, but less then one millisecond then round this result to 0.001 
  • xssim/branches/tpiontek/src/simulator/GridSchedulingSimulator.java

    r159 r241  
    292292                }; 
    293293 
    294                 File tarArchive = new File(outputDir, "results.tar"); 
     294                /*File tarArchive = new File(outputDir, "results.tar"); 
    295295 
    296296                File networkTopologyFile = (configurationOptions.networkTopologyFileName == null) ? null 
     
    302302                } catch (IOException e) { 
    303303                        log.error("IOException occured while creating archive file", e); 
    304                 } 
    305         } 
     304                }*/     } 
    306305 
    307306        public void runMultiuser(String rootDirPath, GridSchedulingSimulator gssim) { 
  • xssim/branches/tpiontek/src/simulator/stats/implementation/GSSimStatistics.java

    r233 r241  
    326326                                                if (resourceLoadStatsFile != null) { 
    327327                                                        Object txt = resourceUsage.serialize(serializer); 
    328                                                         resourceLoadStatsFile.println(txt); 
     328                                                        if( resType == ResourceType.DATA_CENTER) 
     329                                                                resourceLoadStatsFile.println(txt); 
    329330                                                } 
    330331                                        } 
     
    340341                                                if (energyStatsFile != null) { 
    341342                                                        Object txt = energyUsage.serialize(serializer); 
    342                                                         energyStatsFile.println(txt); 
     343                                                        if( resType == ResourceType.DATA_CENTER) 
     344                                                                energyStatsFile.println(txt); 
    343345                                                } 
    344346                                        } 
  • xssim/branches/tpiontek/src/test/rewolucja/energy/profile/implementation/CPUPowerProfile.java

    r215 r241  
    3131                powerState = PowerState.ON; 
    3232                pState = getSupportedPStates().get(PStateType.P0); 
     33                //pState = getSupportedPStates().get(PStateType.P3); 
    3334        } 
    3435 
     
    103104        public boolean setPState(PStateType pStateType){ 
    104105                PState newPState = getSupportedPStates().get(pStateType); 
     106                 
    105107                if(newPState != null) 
    106108                { 
    107                         double factor = pState.getFrequency()/newPState.getFrequency(); 
     109                        double factor = newPState.getFrequency() / pState.getFrequency(); 
     110                         
    108111                        pState = newPState; 
    109112                        CpuSpeed speed = (CpuSpeed )cpu.getResourceCharacteristic().getResourceUnits().get(ResourceParameterName.CPUSPEED).get(0); 
    110                         //speed.setAmount((int)pState.getFrequency()); 
    111  
     113                        speed.setAmount( (int)(speed.getAmount() * factor)); 
     114                         
    112115                        cpu.handleEvent(new EnergyEvent(EnergyEventType.FREQUENCY_CHANGED, cpu.getName())); 
    113116                        cpu.getLogicalResource().sendInternal(GridSimTags.SCHEDULE_NOW, GssimTags.UPDATE, cpu.getName()); 
  • xssim/branches/tpiontek/src/test/rewolucja/energy/profile/implementation/CPU_A_PowerProfile.java

    r131 r241  
    2323                static { 
    2424                        Map<PStateType, PState> pStatesMap = new HashMap<PStateType, PState>(); 
    25                         pStatesMap.put(PStateType.P0, new PState(PStateType.P0, 3000, 0, 350)); 
    26                         pStatesMap.put(PStateType.P1, new PState(PStateType.P1, 2660, 0, 343)); 
    27                         pStatesMap.put(PStateType.P2, new PState(PStateType.P2, 2330, 0, 337)); 
    28                         pStatesMap.put(PStateType.P3, new PState(PStateType.P3, 2000, 0, 330)); 
     25                        pStatesMap.put(PStateType.P0, new PState(PStateType.P0, 3000, 0, 14)); 
     26                        pStatesMap.put(PStateType.P1, new PState(PStateType.P1, 2660, 0, 12)); 
     27                        pStatesMap.put(PStateType.P2, new PState(PStateType.P2, 2330, 0, 10)); 
     28                        pStatesMap.put(PStateType.P3, new PState(PStateType.P3, 2000, 0, 8)); 
    2929                        pStates = Collections.unmodifiableMap(pStatesMap); 
    3030                } 
  • xssim/branches/tpiontek/src/test/rewolucja/energy/profile/implementation/CPU_B_PowerProfile.java

    r131 r241  
    2323                static { 
    2424                        Map<PStateType, PState> pStatesMap = new HashMap<PStateType, PState>(); 
    25                         pStatesMap.put(PStateType.P0, new PState(PStateType.P0, 2660, 0, 363)); 
    26                         pStatesMap.put(PStateType.P1, new PState(PStateType.P1, 2330, 0, 357)); 
    27                         pStatesMap.put(PStateType.P2, new PState(PStateType.P2, 2000, 0, 350)); 
    28                         pStatesMap.put(PStateType.P3, new PState(PStateType.P3, 1860, 0, 343)); 
     25                        pStatesMap.put(PStateType.P0, new PState(PStateType.P0, 2200, 0, 19)); 
     26                        pStatesMap.put(PStateType.P1, new PState(PStateType.P1, 2000, 0, 16)); 
     27                        pStatesMap.put(PStateType.P2, new PState(PStateType.P2, 1800, 0, 14)); 
     28                        pStatesMap.put(PStateType.P3, new PState(PStateType.P3, 1000, 0, 10)); 
    2929                        pStates = Collections.unmodifiableMap(pStatesMap); 
    3030                } 
  • xssim/branches/tpiontek/src/test/rewolucja/resources/physical/factory/ComputingNodeFactory.java

    r104 r241  
    44import schedframe.resources.units.Memory; 
    55import test.rewolucja.resources.Category; 
    6 import test.rewolucja.resources.ResourceCharacteristics; 
    76import test.rewolucja.resources.description.ExecResourceDescription; 
    87import test.rewolucja.resources.physical.base.ComputingResource; 
     
    3736                String resName = resDesc.getResourceId(); 
    3837                Category cat = resDesc.getCategory(); 
    39                 if(cat.getName().equals("A")){ 
    40                         resDesc.addResourceUnit(new Memory(resName, 12288, 0)); 
     38                 
     39                if(cat.getName().equals("A")) 
     40                { 
     41                        resDesc.addResourceUnit(new Memory(resName, 8704, 0)); 
    4142                        resDesc.addResourceUnit(new Cost(resName, 100)); 
    4243                        return new ComputingNode(resDesc); 
    43                 } else if (cat.getName().equals("B")){ 
    44                         resDesc.addResourceUnit(new Memory(resName, 12288, 0)); 
     44                } 
     45                else if (cat.getName().equals("B")) 
     46                { 
     47                        resDesc.addResourceUnit(new Memory(resName, 6144, 0)); 
    4548                        resDesc.addResourceUnit(new Cost(resName, 100)); 
    4649                        return new ComputingNode(resDesc); 
    47                 } else if (cat.getName().equals("C")){ 
    48                         resDesc.addResourceUnit(new Memory(resName, 12288, 0)); 
     50                } 
     51                else if (cat.getName().equals("C")) 
     52                { 
     53                        resDesc.addResourceUnit(new Memory(resName, 0, 0)); 
    4954                        resDesc.addResourceUnit(new Cost(resName, 100)); 
    5055                        return new ComputingNode(resDesc); 
    51                 } else { 
    52                         resDesc.addResourceUnit(new Memory(resName, 12288, 0)); 
     56                } 
     57                else 
     58                { 
     59                        resDesc.addResourceUnit(new Memory(resName, 0, 0)); 
    5360                        resDesc.addResourceUnit(new Cost(resName, 100)); 
    5461                        return new ComputingNode(resDesc); 
  • xssim/branches/tpiontek/src/test/rewolucja/resources/physical/implementation/Processor.java

    r220 r241  
    5656        public void initCharacteristics(ExecResourceDescription resDesc){ 
    5757                resourceCharacteristic = new ResourceCharacteristics(); 
    58                 resourceCharacteristic.addResourceUnit(new CpuSpeed(name, 1, 0)); 
     58                 
     59                int speed = 1000; 
     60                if( resDesc.getCategory().getName().equals("A")) 
     61                        speed = 2000; 
     62                 
     63                resourceCharacteristic.addResourceUnit(new CpuSpeed(name, speed, 0)); 
    5964        } 
    6065         
Note: See TracChangeset for help on using the changeset viewer.