【问题标题】:Kernel Module Time measuring内核模块时间测量
【发布时间】: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


【解决方案1】:

我为您提供了一个指向我的内核模块的链接,我在其中解决了相同的任务。

这是GitHub project link,您可以在其中查看方法print_perf_data,了解我如何收集性能数据并打印它们以计算经过的时间。

问候。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-12-13
    • 2016-03-19
    • 2013-03-06
    • 2014-06-26
    • 1970-01-01
    • 2016-02-16
    • 2013-08-10
    • 2013-08-09
    相关资源
    最近更新 更多