在Linsched中使用task_struct

Working with task_struct in Linsched

本文关键字:task struct Linsched      更新时间:2023-10-16

我想获得有关任务的信息,例如任务的总执行时间(带有task_exec_time(task))、未运行的时间(task->sched_info.run_delay)以及调度器调用任务的次数(task->sched_info.pcount)。为此,我想使用struct task_struct *linsched_get_task(int task_id);这在文章http://www.ibm.com/developerworks/library/l-linux-scheduler-simulator/中有描述。然后当我编译程序时,它说这个结构体没有这些成员。

void linsched_print_task_stats(void);

有人试过吗?

所有需要的信息(task_exec_time, run_delay, pcount)都由"linsched_print_stats"函数打印。如果您在测试应用程序中将"print_tasks"字段设置为1,则在模拟之后调用该函数:

linsched_global_options。Print_tasks = 1;针对linsched_run_sim(节拍);