本文整理汇总了Python中Task.Task.allocated_jiffies方法的典型用法代码示例。如果您正苦于以下问题:Python Task.allocated_jiffies方法的具体用法?Python Task.allocated_jiffies怎么用?Python Task.allocated_jiffies使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Task.Task
的用法示例。
在下文中一共展示了Task.allocated_jiffies方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: generate_tasks
# 需要导入模块: from Task import Task [as 别名]
# 或者: from Task.Task import allocated_jiffies [as 别名]
def generate_tasks(self):
self.tasks = []
run_time_distribution_list = self.adjust_distribution(self.conf.RUN_TIME_DISTRIBUTION)
start_time_distribution_list = self.adjust_distribution(self.conf.START_TIME_DISTRIBUTION)
task_type_distribution_list = self.adjust_distribution(self.conf.TASK_TYPE_DISTRIBUTION)
initial_cpu_distribution_list = self.adjust_distribution(self.conf.INITIAL_CPU_DISTRIBUTION)
static_priority_distribution = self.adjust_distribution(self.conf.STATIC_PRIORITY_DISTRIBUTION)
for i in range(1, self.conf.TASK_AMOUNT + 1):
task = Task(self.conf)
task.pid = i
task.start_jiffies = self.get_rand_from_distribution(start_time_distribution_list)
task.allocated_jiffies = self.get_rand_from_distribution(run_time_distribution_list)
task.static_priority = self.get_rand_from_distribution(static_priority_distribution)
task.initial_cpu = self.get_rand_from_distribution(initial_cpu_distribution_list)
"""if task_type is the same with the cpu's type,
process will perform better on this cpu"""
task.task_type = self.get_rand_from_distribution(task_type_distribution_list)
task = self.adjust_task(task)
self.tasks.append(task)
pass
return self.tasks