使用 C++ 和 Linux 的高分辨率计时器? [英] High resolution timer with C++ and Linux?

查看:24
本文介绍了使用 C++ 和 Linux 的高分辨率计时器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Windows 下,有一些方便的函数,例如 mmsystem.h 中的 QueryPerformanceCounter,可以创建高分辨率计时器.Linux 有没有类似的东西?

Under Windows there are some handy functions like QueryPerformanceCounter from mmsystem.h to create a high resolution timer. Is there something similar for Linux?

推荐答案

之前在这里询问过 -- 但基本上,您可以使用 boost ptime 函数,或者可以用于基本相同目的的 POSIX clock_gettime() 函数.

It's been asked before here -- but basically, there is a boost ptime function you can use, or a POSIX clock_gettime() function which can serve basically the same purpose.

这篇关于使用 C++ 和 Linux 的高分辨率计时器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆