//添加的头文件
# include <linux/cache.h>
# include <linux/seqlock.h>
# include <linux/math64.h>
# include <linux/time64.h>
# include <linux/time.h>
//具体方法:
printk("-*- before read page,timestamp:%lu\n",gettime());
ret = copy_page_to_iter(page, offset, nr, iter);
printk("-*- before read page,timestamp:%lu\n",gettime());
//【注意】:该方法包含了printk的时间
//改进方法:
unsigned long time1,time2; /* offset into pagecache page */
time1=gettime();
ret = copy_page_to_iter(page, offset, nr, iter);
time2=gettime()
printk("-*-time:%lu\n",time2-time1);
linux内核中添加时间函数
最新推荐文章于 2024-01-03 14:11:08 发布