[英]Kernel Module Time measuring
我正在尝试基于链表制作内核模块,我想测量将 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
我为您提供了一个指向我的内核模块的链接,我在其中解决了相同的任务。
这是GitHub 项目链接,您可以在其中查看方法print_perf_data
以了解我如何收集性能数据并打印它们以计算经过的时间。
问候。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.