public final class LoadController extends Object implements Runnable
DefaultSimulationInfrastructure.
The LoadController is responsible for managing the desired and actual system load.
The desired system load represents the load the user wants to simulate and the actual system load represents
the actual system load that is being simulated.
All increases and decreases of FakeLoad requests arriving at DefaultSimulationInfrastructure
get propagated to the LoadController. The LoadController then uses an instance of type
SystemLoad to keep track of the currently desired system load. Within the SystemLoad instance,
the load instructions arriving from different FakeLoads get aggregated.
After the desired system load has been determined by the SystemLoad instance,
the LoadController propagates the desired load information to the individual threads responsible
for actual load simulation.
The LoadController is also responsible for adjusting the actual system load produced by
the simulator threads. Whenever a significant deviation between desired target load and actual system load is
detected, the class adjusts the load slightly in the direction of target. This way the load generated by the
simulator threads actually reaches the desired level.
DefaultSimulationInfrastructure,
SystemLoad| Constructor and Description |
|---|
LoadController(SystemLoad systemLoad,
List<CpuSimulator> cpuSimulators,
MemorySimulator memorySimulator,
DiskInputSimulator diskInputSimulator,
DiskOutputSimulator diskOutputSimulator) |
| Modifier and Type | Method and Description |
|---|---|
void |
decreaseSystemLoadBy(FakeLoad load) |
List<CpuSimulator> |
getCpuSimulators() |
DiskInputSimulator |
getDiskInputSimulator() |
DiskOutputSimulator |
getDiskOutputSimulator() |
MemorySimulator |
getMemorySimulator() |
void |
increaseSystemLoadBy(FakeLoad load) |
void |
run() |
public LoadController(SystemLoad systemLoad, List<CpuSimulator> cpuSimulators, MemorySimulator memorySimulator, DiskInputSimulator diskInputSimulator, DiskOutputSimulator diskOutputSimulator)
public void increaseSystemLoadBy(FakeLoad load) throws MaximumLoadExceededException
MaximumLoadExceededExceptionpublic void decreaseSystemLoadBy(FakeLoad load)
public List<CpuSimulator> getCpuSimulators()
public MemorySimulator getMemorySimulator()
public DiskInputSimulator getDiskInputSimulator()
public DiskOutputSimulator getDiskOutputSimulator()
Copyright © 2017. All rights reserved.