/// <summary> /// Returns true / false depending on the Schedulability Condition /// </summary> /// <param name="taskSet"></param> /// <param name="configuration"></param> /// <returns></returns> public bool IsSatisfied(CTaskSet taskSet, CConfiguration configuration) { double LLB; try { CTask[] allTasks = taskSet.GetAllTasksInPriorityOrder(); double U = taskSet.Utilization; LLB = taskSet.Count * (Math.Pow(2.0, (1 / (double)taskSet.Count)) - 1); if (U < LLB) { return(true); } else { return(false); } } catch (Exception e) { _message = e.Message; return(false); } }
public bool IsSatisfied(CTaskSet taskSet, CConfiguration configuration) { try { double dUtil = 1; CTask[] taskArray = taskSet.GetAllTasksInPriorityOrder(); foreach (CTask t in taskArray) { dUtil = dUtil * (t.Utilization + 1.0); } if (dUtil <= 2) { return(true); } else { return(false); } } catch (Exception e) { _message = e.Message; return(false); } }
public bool IsSatisfied(CTaskSet taskSet, CConfiguration configuration) { long slackTime; try { CTask[] tasks = taskSet.GetAllTasksInPriorityOrder(); //Now check different in periods foreach (CTask t in tasks) { slackTime = (long)t.Period - (long)t.ExecutionTime; //Now make sure the processing time for every event in the set has a lesser slack time foreach (CTask t1 in tasks) { if (t1.ID != t.ID) { if (t1.ExecutionTime > slackTime) { return(false); } } } } return(true); } catch (Exception e) { _message = e.Message; return(false); } }
/// <summary> /// /// </summary> /// <param name="taskSet"></param> /// <param name="maxTime"></param> /// <returns></returns> public bool SimulateExecution(CTaskSet taskSet, long maxTime) { _ExecutionTrace = new CTaskExecutionTrace(); _message = ""; SortedList allTasks = new SortedList(); //Reverse Priority Order in Task Set taskSet.ReversePriorityOrder(); //Convert Task Set to SortedList CTask [] array = taskSet.GetAllTasksInPriorityOrder(); if (maxTime <= 0) { _message = "Time ro run simulation is not correct"; return(false); } foreach (CTask t in array) { allTasks.Add(t.iPriority, t); } //Get Reverse Priority Tasks //allTasksReverseOrder = ReversePriorities(allTasks); try { if (findResponseTime(allTasks, 0, maxTime) < 0) { return(false); } else { return(true); } } catch (Exception e) { _message = e.Message; return(false); } }
/// <summary> /// Write Files /// </summary> /// <param name="sFullFileName"></param> /// <param name="taskSet"></param> private void WriteToFile(string sFullFileName, string sComment, CTaskSet taskSet) { string sMain = ""; string sTmp = ""; CTask [] array = taskSet.GetAllTasksInPriorityOrder(); sMain = "//" + sComment + "\r\n"; sMain = sMain + "//Hyperperiod: " + taskSet.HyperPeriod + ", Utilization: " + taskSet.Utilization + "\r\n"; sMain = sMain + "//ID,Priority,Offset,Period, Execution Time" + "\r\n"; foreach (CTask t in array) { sTmp = t.ID + "," + t.iPriority.ToString() + "," + t.Offset.ToString() + "," + t.Period.ToString() + "," + t.ExecutionTime.ToString(); sMain = sMain + sTmp + "\r\n"; } writeToFile(sFullFileName, sMain); }