def insideroutine(numberOfRuns, fr): c_prob = [] seq_prob = [] for i in range(numberOfRuns): tasks = [] tasks = task_generator.taskGeneration_p(20, 60) tasks = mixed_task_builder.hardtaskWCET(tasks, 1.83, fr) print tasks #the following part is for testing #c_prob.append(cprta.cprta(tasks)) seq_prob.append(EPST.probabilisticTest_p(tasks, 3, 3)) return [c_prob, seq_prob]
def insideroutine(numberOfRuns, fr): seq_prob = [] for i in range(numberOfRuns): tasks = [] tasks = task_generator.taskGeneration_p(10, 60) tasks = mixed_task_builder.hardtaskWCET(tasks, 1.83, fr) keepTasks = tasks[:] #the following part is for testing resP = EPST.probabilisticTest_p(tasks, 3, 3) seq_prob.append( resP ) #this will get the maximum probability among the tasks in a task set. return seq_prob
def taskGenerationMatlab(numTasks, uTotal, ind): global ofile, PSet random.seed() init() UUniFast(numTasks,uTotal/100) CSet_generate(1,2) ofile = "taskset-matlab.m" PSet = mixed_task_builder.hardtaskWCET(PSet, 1.83, 10**-6.) fo = open(ofile, "ab") fo.write("if index == "+str(ind)+"\n") j = 0 for i in PSet: j+=1 fo.write("taskSet{"+str(j)+"}{1} = ["+str(i['execution'])+","+str(i['abnormal_exe'])+";0.999999, 0.000001];\n") fo.write("taskSet{"+str(j)+"}{2} = ["+str(i['period'])+"; 1];\n") fo.write("end\n") ofile = "taskset-p.txt" fo = open(ofile, "ab") print >>fo, json.dumps(PSet)
def insideroutine(numberOfRuns, fr, tib): seq_prob = [] for i in range(numberOfRuns): tasks=[] tasks=task_generator.taskGeneration_p(tib,60) tasks=mixed_task_builder.hardtaskWCET(tasks, 1.83, fr) keepTasks = tasks[:] #the following part is for testing timing.tlog_start("CPRTA starts", 0 ) resEPSTK = cprta.cprta(tasks) timing.tlog_end("CPRTA ends", stampCPRTA, 0) timing.tlog_start("EPST method starts", 0) resEPST = EPST.probabilisticTest_ptda_pt(tasks, nd, 3) #no opt timing.tlog_end("EPST method ends", stampEPST, 0) timing.tlog_start("EPSTK starts", 0 ) resEPSTK = EPST.probabilisticTest_pt(tasks, nd, 3) #no opt timing.tlog_end("EPSTK ends", stampEPSTK, 0) return seq_prob
for htf in hardTaskFactor: for nd in numDeadline: for percentageU in range(60, 61, 10): for fr in faultRate: numberOfRuns = 500 print('Tasks: ' + repr(tib) + ', NumDeadline:' + repr(nd) + ', FaultRate:' + repr(fr)) + ', Utilization:' + repr(percentageU) for i in range(numberOfRuns): print "sample: ", i file.write('Generated ' + repr(tib) + 'samples:' + repr(i) + '\n') tasks = [] tasks = task_generator.taskGeneration_p( tib, percentageU) tasks = mixed_task_builder.hardtaskWCET(tasks, htf, fr) keepTasks = tasks[:] for k in tasks: file.write(repr(k) + ',') file.write('\n') #the following part is for testing timing.tlog_start("CPRTA starts", 1) resEPSTK = cprta.cprtao(tasks) timing.tlog_end("CPRTA ends", stampCPRTA, 1) if len(stampCPRTA) > 0: file.write('Duration: ' + repr(stampCPRTA[-1]) + '\n')
numberOfRuns = 100 c_prob = [] seq_prob = [] for j in tasksinBkt: fileName = 'mp_tasks'+repr(j)+'_utilization'+repr(60) folder = 'comparison/' file = open(folder + 'txt/' + fileName + '.txt', "w") file.write('Num of deadline miss: ' + repr(1) + '\n') file.write('Utilization: '+repr(60) + '\n') for i in range(numberOfRuns): print "Sample", i file.write('Generated '+ repr(j) +'samples:'+repr(i)+'\n') tasks=[] tasks=task_generator.taskGeneration_p(j,60) tasks=mixed_task_builder.hardtaskWCET(tasks, 1.83, 10**-6.) keepsTasks=tasks[:] for k in tasks: file.write(repr(k) + ',') file.write('\n') #the following part is for testing file.write('DMP:\n') tdar = EPST.probabilisticTest_po(tasks, 3, 10) cpa = cprta.cprtao(keepsTasks) if tdar < cpa: file.write('bug?\n') file.write('EPST-K:\n') file.write(repr(tdar) + ',') file.write('\n')
from bounds import * # Information about the general task set tasksinBkt = [5] # Information about the number of testing runs numberOfRuns = 1 # Information about the mixed task set wcetF2 = 2.2/1.2 faultRate = [10**-6.] hardTaskFactor = [wcetF2] numDeadline = [1] tasks=[] for j in tasksinBkt: for tib in tasksinBkt: for fr in faultRate: print('Tasks: ' + repr(tib) +', NumDeadline:'+repr(1)+', FaultRate:'+repr(10**-6.)+', Utilization:'+repr(60)) seq_prob = [] for i in range(numberOfRuns): tasks=[] tasks=task_generator.taskGeneration_p(j,60) tasks=mixed_task_builder.hardtaskWCET(tasks, 1.83, fr) #print tasks #the following part is for testing seq_prob.append(EPST.probabilisticTest_p(tasks, 1, Chernoff_bounds, 1)) seq_prob.append(EPST.probabilisticTest_p(tasks, 1, Hoeffding_inequality)) seq_prob.append(EPST.probabilisticTest_p(tasks, 1, Bernstein_inequality)) print seq_prob