eygle.com   eygle.com
eygle.com  
 

« 龙枪编年史 | Blog首页 | Le Papillon(法语:蝴蝶) »

Man Page Of gethrtime

作者:eygle |【转载时请以超链接形式标明文章和作者信息及本声明
链接:

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

$ man gethrtime

Standard C Library Functions gethrtime(3C)

NAME
gethrtime, gethrvtime - get high resolution time

SYNOPSIS
#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\n", (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 1

Standard 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




历史上的今天...
      >> 2007-04-12文章:
             《深入浅出Oracle》与10g XE
      >> 2006-04-12文章:
      >> 2005-04-12文章:
             更新了一下留言板程序
------
这篇 【Man Page Of gethrtime】来自 eygle.com | CSDN网摘| del.icio.us|Google订阅 | 鲜果订阅 | 抓虾订阅

By eygle on 2004-11-19 21:02 | Comments (0) | Posted to Unix&Linux | Edit |Pageviews:

相关文章 随机文章
  • 如何查看Veritas VCS安装版本号
  • 如何将Unix Time转换为系统时间
  • AIX不完整的补丁安装以及Oracle的Bug
  • 故障总是在同一个地方出现
  • LGWR与AIX上的进程优先级
  • Oracle Open World上OTN Lounge的活动安排
    关于Oracle学习以及DBA工作机会
    《循序渐进Oracle》一书第三章目录
    明天赴杭参加"中国网络工程师侠客行"大会
    BUG带来的BUG-kjdrpkey2hv: called with pkey
    搜索本站:

    留言 (0)

    发表留言:



    Remember Me?
    (输入验证码后方可评论,谢谢支持)



    CopyRight © 2004 eygle.com, All rights reserved.