Esempio n. 1
0
def genTasks(number_of_cores, number_of_tasks):
    for i in range(1000):
        for total_utilisation_perc in range(1, 10):
            total_utilisation = (total_utilisation_perc /
                                 float(10)) * number_of_cores
            print(number_of_tasks, "tasks with utilisation", total_utilisation)

            task_set = main(number_of_tasks, total_utilisation, "automotive")
            test_hyper_period = header.computeHyperperiod(task_set)
            job_count = sum(
                [test_hyper_period / task.period for task in task_set])

            #to discard tasks sets with > 10000 jobs in hyper period
            while job_count > 10000:
                task_set = main(number_of_tasks, total_utilisation,
                                "automotive")
                test_hyper_period = header.computeHyperperiod(task_set)
                job_count = sum(
                    [test_hyper_period / task.period for task in task_set])

            task_list = [(task.number, task.period, task.utilisation,
                          task.ex_time) for task in task_set]
            results = [
                task_list, total_utilisation, total_utilisation_perc * 10
            ]
            file_name = str(number_of_cores) + "Cores" + str(
                number_of_tasks) + "Tasks" + str(total_utilisation_perc * 10)
            lg.log_results(file_name, results)
def create_jobs(task_set):
	hyperperiod = header.computeHyperperiod(task_set)
	for task in task_set:
		task.jobs_in_hyper_period = hyperperiod/task.period;
		for jobnum in range(0,int(task.jobs_in_hyper_period)):
			job = header.Job(ex_time=task.ex_time, arr_time = (jobnum*task.period), abs_deadline = ((jobnum*task.period) + task.rel_deadline), job_number=jobnum, task_number=task.number)
			task.task_joblist.append(job)
def firstFit(task_set, criteria=None, scheduler=None):

    hyper_period = header.computeHyperperiod(task_set)
    '''task_order_list = permutations(task_set)'''
    '''takes too long just do rate monotonic task order'''
    if criteria == "extime":
        task_order_list = sorted(task_set, key=lambda x: x.ex_time)
    elif criteria == "utilisation":
        task_order_list = sorted(task_set, key=lambda x: x.utilisation)
    else:
        task_order_list = sorted(task_set, key=lambda x: x.period)

    processor_to_fit = header.Processor(num_cores=1)
    core_search = coreSearch(task_order_list, processor_to_fit, scheduler)

    return core_search, processor_to_fit.core_tasklist
def testSAGFP(task_set):
	folder = "JobSets"
	try:
		os.remove(folder + "/currentJobSet.csv")
	except:
		pass

	hyperperiod = header.computeHyperperiod(task_set)
	jg.create_jobs(task_set,hyperperiod)
	jg.write_jobs(task_set, "currentJobSet" ,folder, 0)

	testPath = 'np-schedulability-analysis/build/nptest'
	jobSetPath = folder + "/currentJobSet.csv"

	result = subprocess.run([testPath, '-t', 'dense', jobSetPath], stdout=subprocess.PIPE)
	result = result.stdout.decode("utf-8")
	result = result.replace(',', '')
	result = result.split()

	os.remove(folder + "/currentJobSet.csv")
	return int(result[1])
Esempio n. 5
0
def jobFit(processor, task_list):
    hyperperiod = header.computeHyperperiod(task_list)
    for task in task_list:
        for job in task.task_joblist:
            # print("\n")
            # print("Checking job ", job.job_number, " of task ", job.task_number)

            est = job.arr_time
            lst = job.abs_deadline - job.ex_time
            for core in processor.cores:
                positions = findPositions(core, job, est, lst, hyperperiod)
                status = checkCoreFit(core, job, est, lst, hyperperiod,
                                      positions)
                # print("Core under check is ", core.number)
                # print (status)
                # print([(item.task_number, item.job_number, item.start_time, item.end_time) for item in core.path])
                if status:
                    break
                else:
                    if core.number == len(processor.cores) - 1:
                        return False
    return True
def set_overlap_var(task_set):
	hyperperiod = header.computeHyperperiod(task_set)
	M = 3*hyperperiod
	return M
                    real_util = sum([task.utilisation for task in task_set])
                    necessary = uniNecTest(task_set)

                task_list = [(task.number, task.period, task.utilisation, task.ex_time) for task in task_set]
                results = [task_list,real_util,num_tasks]
                lg.log_results("uniprocessor_test", results)'''
    number_of_cores = 16
    number_of_tasks = 32
    for i in range(300):
        for total_utilisation_perc in range(1, 11):
            total_utilisation = (total_utilisation_perc /
                                 float(10)) * number_of_cores
            print(number_of_tasks, "tasks with utilisation", total_utilisation)

            task_set = main(number_of_tasks, total_utilisation, "automotive")
            test_hyper_period = header.computeHyperperiod(task_set)
            job_count = sum(
                [test_hyper_period / task.period for task in task_set])

            #to discard tasks sets with > 10000 jobs in hyper period
            while job_count > 10000:
                task_set = main(number_of_tasks, total_utilisation,
                                "automotive")
                test_hyper_period = header.computeHyperperiod(task_set)
                job_count = sum(
                    [test_hyper_period / task.period for task in task_set])

            task_list = [(task.number, task.period, task.utilisation,
                          task.ex_time) for task in task_set]
            results = [
                task_list, total_utilisation,
Esempio n. 8
0
def testCWEDF(task_list):
	hyper_period = header.computeHyperperiod(task_list)
	status = runScheduler(task_list, hyper_period)
	return status