/// <summary> /// Create some necessary parts and some dummy Jobs. /// </summary> public BenchmarkSystemTest() { scheduler = system.GetScheduler(); Job1 = new Job( p => { return 0; }, 1, "Michael", 4, 4 ); Job2 = new Job( p => { return 0; }, 2, "Michael", 4, 0.5 ); Job3 = new Job( p => { return 0; }, 3, "Michael", 1, 0.5 ); Job4 = new Job( p => { return 0; }, 4, "Michael", 6, 1 ); }
/// <summary> /// Remove a job from scheduler. /// </summary> /// <param name="job">Job object</param> public void Cancel(Job job) { scheduler.RemoveJob(job); }
/// <summary> /// Add a job to scheduler. /// </summary> /// <param name="job"></param> public void Submit(Job job) { scheduler.AddJob(job, false); }
/// <summary> /// Run each job. /// </summary> /// <param name="job"></param> public void RunJob(Job job) { job.state = State.Running; //DatabaseModule.LogAction(job, "running"); int runtimeMs = (int) job.runtime * 1000; Thread.Sleep(runtimeMs); lock (_cpuLocker) { cpus += job.cpus; } runningList.Remove(job); job.state = State.Terminated; //DatabaseModule.LogAction(job, "terminated"); }