【发布时间】:2021-12-13 15:32:12
【问题描述】:
我正在尝试基于链表制作内核模块,我想测量将 1000 个项目插入链表的执行时间。
我应该使用什么头文件和什么函数来测量开始时间和结束时间?
// start clock here
for(i = 0; i < 1000; i++)
{
struct my_node* new = kmalloc(sizeof(struct my_node), GFP_KERNEL);
new->data = i;
list_add(&new->entry, &my_list);
}
// end clock here
// print out the execution time in seconds here
【问题讨论】:
标签: c linux kernel kernel-module