Man Page Of gethrtime

网友投稿 747 2022-10-04

本站部分文章、图片属于网络上可搜索到的公开信息,均用于学习和交流用途,不能代表睿象云的观点、立场或意见。我们接受网民的监督,如发现任何违法内容或侵犯了您的权益,请第一时间联系小编邮箱jiasou666@gmail.com 处理。

Man Page Of gethrtime

题注:Man Page这里我辑录一些我在学习研究过程中关注过,应用过的,供自己参考,也希望可以见证自己的学习历程。

$ man gethrtimeStandard C Library Functions gethrtime(3C)NAME gethrtime, gethrvtime - get high resolution timeSYNOPSIS #include hrtime_t gethrtime(void); hrtime_t gethrvtime(void);DESCRIPTION The gethrtime() function returns the current high-resolution real time. Time is expressed as nanoseconds since some arbitrary time in the past; it is not correlated in any way to the time of day, and thus is not subject to resetting or drifting by way of adjtime(2) or settimeofday(3C). The hires timer is ideally suited to performance measurement tasks, where cheap, accurate interval timing is required. The gethrvtime() function returns the current high-resolution LWP virtual time, expressed as total nanoseconds of execution time. This function requires that micro state accounting be enabled with the ptime utility (see proc(1)). The gethrtime() and gethrvtime() functions both return an hrtime_t, which is a 64-bit (long long) signed integer.EXAMPLES The following code fragment measures the average cost of getpid(2): hrtime_t start, end; int i, iters = 100; start = gethrtime(); for (i = 0; i < iters; i++) getpid(); end = gethrtime(); printf("Avg getpid() time = %lld nsec\", (end - start) / iters);ATTRIBUTES See attributes(5) for descriptions of the following attributes: ____________________________________________________________ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | |_____________________________|_____________________________| | MT-Level | MT-Safe | |_____________________________|_____________________________|SunOS 5.8 Last change: 10 Apr 1997 1Standard C Library Functions gethrtime(3C)SEE ALSO proc(1), adjtime(2), gettimeofday(3C), settimeofday(3C), attributes(5)NOTES Although the units of hi-res time are always the same (nanoseconds), the actual resolution is hardware dependent. Hi-res time is guaranteed to be monotonic (it won't go backward, it won't periodically wrap) and linear (it won't occasionally speed up or slow down for adjustment, like the time of day can), but not necessarily unique: two sufficiently proximate calls may return the same value.SunOS 5.8 Last change: 10 Apr 1997 2

上一篇:早报│腾讯云数据库发布“诺亚计划”;李开复惹祸上身!数据隐私再遭热议;麒麟芯片今日起停产;字节跳动拒绝微软收购;首个国产超导量子计算机云平台上线……
下一篇:使用pg_ctl和systemctl交叉启停服务测试
相关文章

 发表评论

暂时没有评论,来抢沙发吧~