Changeset 241 for xssim/branches/tpiontek/src
- Timestamp:
- 04/11/12 16:30:38 (13 years ago)
- Location:
- xssim/branches/tpiontek/src
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
xssim/branches/tpiontek/src/example/energy/CPUEnergyEstimationPlugin.java
r206 r241 1 1 package example.energy; 2 2 3 import gssim.schedframe.scheduling.ExecTaskInterface; 4 5 import java.util.List; 3 6 import java.util.Properties; 4 7 … … 16 19 ComputingResource resource) { 17 20 Processor cpu = (Processor)resource; 21 18 22 if(resource.getPowerInterface().getPowerState() == PowerState.OFF) 19 23 return 0; 24 25 double factor = 1.3; 26 20 27 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 } 22 39 else 23 return 1;40 return cpu.getPowerInterface().getPState().getPower(); 24 41 } 25 42 -
xssim/branches/tpiontek/src/example/energy/ComputingNodeEnergyEstimationPlugin.java
r206 r241 5 5 import test.rewolucja.energy.EnergyEvent; 6 6 import test.rewolucja.resources.physical.base.ComputingResource; 7 import test.rewolucja.resources.physical.implementation.ComputingNode; 7 8 import test.rewolucja.resources.physical.implementation.Processor; 8 import test.rewolucja.resources.physical.implementation.ComputingNode;9 9 import test.rewolucja.scheduling.JobRegistryInterface; 10 10 … … 16 16 double power = 0; 17 17 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 18 31 for(Processor cpu: node.getProcessors()){ 19 32 //try{ … … 23 36 //} 24 37 } 25 power += node.getPowerInterface().getPowerConsumption(node.getPowerInterface().getPowerState());38 //power += node.getPowerInterface().getPowerConsumption(node.getPowerInterface().getPowerState()); 26 39 return power; 27 40 } -
xssim/branches/tpiontek/src/example/localplugin/FCFSRandomClusterLocalPlugin.java
r192 r241 3 3 import gridsim.Gridlet; 4 4 5 import java.util.ArrayList; 5 6 import java.util.List; 6 7 import java.util.Properties; … … 11 12 import schedframe.scheduling.plugin.grid.ModuleList; 12 13 import test.rewolucja.GSSIMJobInterface; 14 import test.rewolucja.energy.profile.PStateType; 13 15 import test.rewolucja.resources.manager.implementation.ClusterResourceManager; 14 16 import test.rewolucja.resources.manager.interfaces.ResourceManagerInterface; 15 17 import test.rewolucja.resources.physical.implementation.ComputingNode; 18 import test.rewolucja.resources.physical.implementation.Processor; 16 19 import test.rewolucja.scheduling.JobRegistryInterface; 17 20 import test.rewolucja.scheduling.plan.SchedulingPlanInterfaceNew; … … 23 26 24 27 private Random rand; 28 private boolean init = true; 25 29 26 30 public FCFSRandomClusterLocalPlugin() { … … 30 34 public SchedulingPlanInterfaceNew schedule(SchedulingEvent event, QueueList queues, JobRegistryInterface jobRegistry, 31 35 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 32 49 33 ClusterResourceManager resourceManager = (ClusterResourceManager) resManager;50 34 51 SchedulingPlanNew plan = new SchedulingPlanNew(); 35 52 // chose the events types to serve. … … 48 65 // if status of the tasks in READY 49 66 if (task.getStatus() == Gridlet.READY) { 50 String nodeName = chooseRandomProvider(resourceManager );67 String nodeName = chooseRandomProvider(resourceManager, task); 51 68 if (nodeName != null) { 52 69 addToSchedulingPlan(plan, task, nodeName); … … 59 76 } 60 77 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 62 97 List<ComputingNode> nodes = resourceManager.getComputingNodes(); 98 99 nodes = findSuitableNodes(cpuRequest, nodes); 100 63 101 int nodeIdx = rand.nextInt(nodes.size()); 64 102 return nodes.get(nodeIdx).getName(); -
xssim/branches/tpiontek/src/example/timeestimation/ExecTimeEstimationPlugin.java
r184 r241 10 10 import schedframe.scheduling.plugin.SchedulingPluginConfiguration; 11 11 import schedframe.scheduling.utils.ResourceParameterName; 12 import test.rewolucja.energy.profile.PState; 13 import test.rewolucja.energy.profile.PStateType; 12 14 import test.rewolucja.resources.ProcessingElements; 15 import test.rewolucja.resources.physical.implementation.Processor; 13 16 14 17 … … 38 41 // obtain single pe speed 39 42 int speed = pes.getSpeed(); 40 43 41 44 // number of used pe 42 45 int cnt = pes.getUsedAmount(); … … 44 47 double remainingLength = task.getLength() * (1- completionPercentage); 45 48 // do the calculation 46 double execTime = (remainingLength / (cnt * speed ));49 double execTime = (remainingLength / (cnt * speed/1000)); 47 50 48 51 // 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 292 292 }; 293 293 294 File tarArchive = new File(outputDir, "results.tar");294 /*File tarArchive = new File(outputDir, "results.tar"); 295 295 296 296 File networkTopologyFile = (configurationOptions.networkTopologyFileName == null) ? null … … 302 302 } catch (IOException e) { 303 303 log.error("IOException occured while creating archive file", e); 304 } 305 } 304 }*/ } 306 305 307 306 public void runMultiuser(String rootDirPath, GridSchedulingSimulator gssim) { -
xssim/branches/tpiontek/src/simulator/stats/implementation/GSSimStatistics.java
r233 r241 326 326 if (resourceLoadStatsFile != null) { 327 327 Object txt = resourceUsage.serialize(serializer); 328 resourceLoadStatsFile.println(txt); 328 if( resType == ResourceType.DATA_CENTER) 329 resourceLoadStatsFile.println(txt); 329 330 } 330 331 } … … 340 341 if (energyStatsFile != null) { 341 342 Object txt = energyUsage.serialize(serializer); 342 energyStatsFile.println(txt); 343 if( resType == ResourceType.DATA_CENTER) 344 energyStatsFile.println(txt); 343 345 } 344 346 } -
xssim/branches/tpiontek/src/test/rewolucja/energy/profile/implementation/CPUPowerProfile.java
r215 r241 31 31 powerState = PowerState.ON; 32 32 pState = getSupportedPStates().get(PStateType.P0); 33 //pState = getSupportedPStates().get(PStateType.P3); 33 34 } 34 35 … … 103 104 public boolean setPState(PStateType pStateType){ 104 105 PState newPState = getSupportedPStates().get(pStateType); 106 105 107 if(newPState != null) 106 108 { 107 double factor = pState.getFrequency()/newPState.getFrequency(); 109 double factor = newPState.getFrequency() / pState.getFrequency(); 110 108 111 pState = newPState; 109 112 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 112 115 cpu.handleEvent(new EnergyEvent(EnergyEventType.FREQUENCY_CHANGED, cpu.getName())); 113 116 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 23 23 static { 24 24 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)); 29 29 pStates = Collections.unmodifiableMap(pStatesMap); 30 30 } -
xssim/branches/tpiontek/src/test/rewolucja/energy/profile/implementation/CPU_B_PowerProfile.java
r131 r241 23 23 static { 24 24 Map<PStateType, PState> pStatesMap = new HashMap<PStateType, PState>(); 25 pStatesMap.put(PStateType.P0, new PState(PStateType.P0, 2 660, 0, 363));26 pStatesMap.put(PStateType.P1, new PState(PStateType.P1, 2 330, 0, 357));27 pStatesMap.put(PStateType.P2, new PState(PStateType.P2, 2000, 0, 350));28 pStatesMap.put(PStateType.P3, new PState(PStateType.P3, 1 860, 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)); 29 29 pStates = Collections.unmodifiableMap(pStatesMap); 30 30 } -
xssim/branches/tpiontek/src/test/rewolucja/resources/physical/factory/ComputingNodeFactory.java
r104 r241 4 4 import schedframe.resources.units.Memory; 5 5 import test.rewolucja.resources.Category; 6 import test.rewolucja.resources.ResourceCharacteristics;7 6 import test.rewolucja.resources.description.ExecResourceDescription; 8 7 import test.rewolucja.resources.physical.base.ComputingResource; … … 37 36 String resName = resDesc.getResourceId(); 38 37 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)); 41 42 resDesc.addResourceUnit(new Cost(resName, 100)); 42 43 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)); 45 48 resDesc.addResourceUnit(new Cost(resName, 100)); 46 49 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)); 49 54 resDesc.addResourceUnit(new Cost(resName, 100)); 50 55 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)); 53 60 resDesc.addResourceUnit(new Cost(resName, 100)); 54 61 return new ComputingNode(resDesc); -
xssim/branches/tpiontek/src/test/rewolucja/resources/physical/implementation/Processor.java
r220 r241 56 56 public void initCharacteristics(ExecResourceDescription resDesc){ 57 57 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)); 59 64 } 60 65
Note: See TracChangeset
for help on using the changeset viewer.