首页 > 其他分享 >rdtsc时间戳

rdtsc时间戳

时间:2024-02-13 12:22:37浏览次数:27  
标签:count clock since epoch 时间 time rdtsc now

【tsc】

time stamp counter

【性能】

大概只要chrono接口的1/6时延

【测试程序】

#include <x86intrin.h>
#include <chrono>
#include <cstdio>

using namespace std::chrono;
int main(){
    u_int64_t begin = duration_cast<nanoseconds>(steady_clock::now().time_since_epoch()).count();
    for(int i=0;i<100000;i++){
        u_int64_t a = __rdtsc();
//        u_int64_t a = duration_cast<nanoseconds>(steady_clock::now().time_since_epoch()).count();
    }
    u_int64_t end = duration_cast<nanoseconds>(steady_clock::now().time_since_epoch()).count();
    printf("time_elapsed=%llu\n", end - begin);
    return 0;
}

  

 

标签:count,clock,since,epoch,时间,time,rdtsc,now
From: https://www.cnblogs.com/jiangshifu/p/18014479

相关文章

  • 【数据库】postgressql设置数据库执行超时时间
    在这篇文章中,我们将深入探讨PostgreSQL数据库中的一个关键设置:SETstatement_timeout。这个设置对于管理数据库性能和优化查询执行时间非常重要。让我们一起来了解它的工作原理以及如何有效地使用它。什么是statement_timeout?statement_timeout是一个PostgreSQL服务器参数,用于设......
  • JS时间戳转时间
    functionformatDate(date){vardate=newDate(date);varYY=date.getFullYear()+'-';varMM=(date.getMonth()+1<10?'0'+(date.getMonth()+1):date.getMonth()+1)+'-';varDD=(date.getDate()......
  • 毫秒时间位数,时而1位,时而2位,时而3位,搞得我好乱呐!
    开心一刻今天我突然顿悟了,然后跟我妈聊天我:妈,我发现一个饿不死的办法妈:什么办法我:我先养个狗,再养个鸡妈:然后了我:我拉的狗吃,狗拉的鸡吃,鸡下的蛋我吃,如此反复,我们三都饿不死妈:你整那么多中间商干啥,你就自己拉的自己吃得了,还省事我又顿悟了,......
  • [word] Word快速插入时间日期
    Word快速插入时间日期。在Word中,有两个快捷键能够直接生成当前日期和时间。方法一:运用快捷键Alt+Shift+D,可以在Word上添加当前的日期。????????????快捷键Alt+Shift+T,可以添加当前时间。方法二:在中文输入法中输入“时间”,就能弹出当前的时间日期了。......
  • php,用touch 修改文件时间
     touch($path,$fc_time,$fc_time);echo"\n$path已经被建立,并且重置了修改时间和访问时间\n";echo"\n如果是windows系统,将会执行以下命令重置该文件的建立时间\n";if(PHP_OS==='WINNT'){$path=str_replace('/','\\......
  • LocalDateTime判断时间段归属
    //v2024-02-0207:52:572024-02-0214:39:14//DateinTime=Date.from(Instant.ofEpochMilli(1707150614000L));//LocalDateTimeinTimeLocalDateTime=DateUtil.dateToLocalDateTime(inTime);LocalDateTimeinTime=LocalDateTime.parse("2024-02-01......
  • 对时间强依赖的方法如何做单元测试
    背景项目当中需要进行业务时间的校验,如上午9:00-下午17:00,在9:00前或17:00后是不能处理相关业务的。因此在业务校验的Service中定义了一个checkBizTime()方法。原本代码如下:publicvoidcheckBizTime(){DatecurrentTime=newDate();//DateUtil.parse的......
  • pandas.to_datetime datetime.combine 拼接日期时间
    在Python中,如果你想要使用datetime.date对象拼接时间,你需要先将datetime.date对象转换为datetime.datetime对象,然后再添加时间。(不转化也可以啊)importpandasaspdimportdatetimedefmain():date=pd.Timestamp.today().date()#将pd.Timestamp转为datetime.date类......
  • datetime.date + datetime.timedelta 结果仍然是 datetime.date 因而不能与时间进行比
    importpandasaspdimportdatetimedefmain():foo=pd.Timestamp.now()bar=datetime.date.today()+datetime.timedelta(days=-1)res=bar+datetime.timedelta(hours=24)print(res,type(res))if__name__=='__main__':ma......
  • 【Flink】使用CoProcessFunction完成实时对账、基于时间的双流join
    【Flink】使用CoProcessFunction完成实时对账、基于时间的双流join文章目录零处理函数回顾一CoProcessFunction的使用1CoProcessFunction使用2实时对账(1)使用离线数据源(批处理)(2)使用高自定义数据源(流处理)二基于时间的双流Join1基于间隔的Join(1)正向join(2)反向join2......