linux 内核/用户空间获取时间
来源:互联网 发布:酷狗铃声制作专家 mac 编辑:程序博客网 时间:2024/05/01 01:56
1、内核空间
#include<time.h>
struct timeval stime,etime;
do_gettimeofday(&stime);
... ... ... ... ...
lsmfts_set_targe_focal(priv->lsMfts,focalLength); //设置targe focla值 focalvalue[0,100]
do_gettimeofday(&etime);
printk("----do_gettimeofday----of setFoccalLength_od time %d us----\n",(etime.tv_sec - stime.tv_sec)*1000000 + (etime.tv_usec - stime.tv_usec)); //即为时间差
return 0;
2、用户空间
#include <time.h>
#include <sys/time.h>
typedef unsigned long long guint64;
guint64 system_current_time_millis()
{
struct timeval tve;
gettimeofday(&tve,NULL);
guint64 sec=tve.tv_sec;
guint64 microseconds=tve.tv_usec;
guint64 total=sec*G_GINT64_CONSTANT(1000)+microseconds/G_GINT64_CONSTANT(1000);
return total;
}
guint64 system_current_time_nano()
{
struct timeval tve;
gettimeofday(&tve,NULL);
guint64 sec=tve.tv_sec;
guint64 microseconds=tve.tv_usec;
guint64 total=sec*G_GINT64_CONSTANT(1000*1000*1000)+microseconds*G_GINT64_CONSTANT(1000);
return total;
}
guint64 system_current_time_micro()
{
struct timeval tve;
gettimeofday(&tve,NULL);
guint64 sec=tve.tv_sec;
guint64 microseconds=tve.tv_usec;
guint64 total=sec*G_GINT64_CONSTANT(1000*1000)+microseconds;
return total;
}
guint64 time1= system_current_time_millis();
... ... ... ... ...
guint64 time2= system_current_time_millis();
printf("----system_current_time_micro:%llums-%llums = %llu ms----\n", time2,time1,time2-time1);
- linux 内核/用户空间获取时间
- linux 内核 时间 获取
- linux 内核 时间 获取
- Linux内核时间获取
- linux内核:用户空间和系统空间
- linux内核空间和用户空间详解
- Linux内核空间和用户空间
- linux 内核空间和用户空间
- linux内核和用户空间 进程空间
- linux内核空间和用户空间
- linux内核空间和用户空间通信
- Linux内核空间和用户空间详解
- Linux用户空间与内核空间
- Linux用户空间与内核空间
- Linux内核空间映射到用户空间
- linux内核空间和用户空间详解
- Linux用户空间与内核空间
- Linux用户空间与内核空间
- MySQL存储引擎中的MyISAM和InnoDB区别详解
- SoC嵌入式软件架构设计之二:内存管理单元的软、硬件协同设计
- mysql 创建sequence
- 1001害死人不偿命的(3n+1)猜想
- recycleView 滑动删除Item,拖拽切换Item,你想了解的都在这儿
- linux 内核/用户空间获取时间
- 用mapreduce计算wordCount和手机流量统计程序运行过程
- 想快速全面了解LoRa?看这篇就够了!
- NFS服务配置
- (六)文件描述符及最大打开文件个数
- vsftpd虚拟用户目录及权限分离
- PAT-乙级-1013
- 8.事件 事件发布程序
- 小学生考试系统