public static int AllocateCPUBudgetForThread(Thread theThread, int requestedBudget, int periodIndex) { int grantedCPU; if (theThread == itsMainThread) { return(itsMainThread.CpuBudget()); } bool result = itsProcessConstraint.AllocateCPUForThread(requestedBudget, periodIndex, false /*SPIN isAssociatedWithInterrupt*/ ); if (result) { itsMainThread.SetCPUBudget(itsMainThread.CpuBudget() - ProcessConstraint.CPUTimeToNormalizedUtilization( requestedBudget, periodIndex)); grantedCPU = requestedBudget; } else { grantedCPU = -1; } return(grantedCPU); }
public DEOSProcess() { itsMainThread = new Thread("main"); itsMainThread.SetCPUBudget(Registry.uSecsInFastestPeriod); itsMainThread.ConceptualObjectConstructor(0); itsProcessConstraint = new ProcessConstraint(cpuUtilization); }
public static void DeallocateCPUBudgetForThread(Thread theThread) { int budget = theThread.CpuBudget(); int periodIndex = theThread.PeriodIndex(); itsProcessConstraint.DeallocateCPUForThread(budget, periodIndex); itsMainThread.SetCPUBudget(itsMainThread.CpuBudget() + ProcessConstraint.CPUTimeToNormalizedUtilization( budget, periodIndex)); }
public ConstrainedProcessConstArg( IProcessManager processManager, ProcessConstraint processConstraint, float constraintValue ) : base( processManager ) { thisProcessConstraint = processConstraint; thisConstraintValue = constraintValue; }
public ProcessSuite( IProcessManager processManager, IProcessHandler handler, ProcessConstraint processConstraint, float constraintValue ) { thisProcessManager = processManager; thisHandler = handler; thisProcessConstraint = processConstraint; thisValue = constraintValue; }
public ConstArg( IProcessManager processManager, ProcessConstraint processConstraint, float constraintValue, bool useSpringT ) : base( processManager, processConstraint, constraintValue ) { thisUseSpringT = useSpringT; }
public ConstArg( IProcessManager processManager, ProcessConstraint constraint, float value, IProcessHandler handler, IProcessSuite suite ) : base( processManager, constraint, value ) { thisHandler = handler; thisSuite = suite; }
public ConstArg( IProcessManager processManager, ProcessConstraint processConstraint, float expireT, IUIAdaptorInputState state, IUIAdaptorInputStateEngine engine ) : base( processManager, processConstraint, expireT ) { thisState = state; thisEngine = engine; }
public QuantityAnimationProcessConstArg( IProcessManager processManager, ProcessConstraint processConstraint, float expireTime, bool useSpringT, int targetQuantity, IQuantityRoller quantityRoller ) : base( processManager, processConstraint, expireTime, true ) { thisTargetQuantity = targetQuantity; thisQuantityRoller = quantityRoller; }
public VisualPickednessProcessConstArg( IProcessManager processManager, ProcessConstraint processConstraint, float constraintValue, bool useSpringT, IPickableUIImage pickableUIImage, float targetPickedness, IVisualPickednessStateEngine engine ) : base( processManager, processConstraint, constraintValue, useSpringT ) { thisPickableUIImage = pickableUIImage; thisTargetPickedness = targetPickedness; thisEngine = engine; }
public void Run_ValueDiffBigEnough_ConstraintVarious_SetsConstraintValuesAccordingly( ProcessConstraint processConstraint, float constraintValue, float expectedExpireT, float expectedRateOfChange ) { IConstrainedProcessConstArg arg = CreateMockArg(); arg.processConstraint.Returns(processConstraint); arg.constraintValue.Returns(constraintValue); TestConstrainedProcess testProcess = new TestConstrainedProcess(arg); testProcess.SetLatestInitialValueDifference_Test(1f); testProcess.Run(); Assert.That(testProcess.GetExpireT(), Is.EqualTo(expectedExpireT)); Assert.That(testProcess.GetRateOfChange_Test(), Is.EqualTo(expectedRateOfChange)); }