当前位置: 技术问答>linux和unix
获取处理时间(准确到毫秒)
来源: 互联网 发布时间:2015-05-25
本文导语: 要得到一段代码运行时间(可能在阻塞状态,但是一定会返回),用什么函数? | /* Get the current time of day and timezone information, putting it into *TV and *TZ. If TZ is NULL, *TZ is not filled. Returns 0 o...
要得到一段代码运行时间(可能在阻塞状态,但是一定会返回),用什么函数?
|
/* Get the current time of day and timezone information,
putting it into *TV and *TZ. If TZ is NULL, *TZ is not filled.
Returns 0 on success, -1 on errors.
NOTE: This form of timezone information is obsolete.
Use the functions and variables declared in instead. */
extern int gettimeofday (struct timeval *__restrict __tv,
__timezone_ptr_t __tz) __THROW;
putting it into *TV and *TZ. If TZ is NULL, *TZ is not filled.
Returns 0 on success, -1 on errors.
NOTE: This form of timezone information is obsolete.
Use the functions and variables declared in instead. */
extern int gettimeofday (struct timeval *__restrict __tv,
__timezone_ptr_t __tz) __THROW;
|
代码运行前用gettimeofday()取得系统时间并纪录,代码运行
后再用gettimeofday()取得系统时间,两者相减就是代码运行
时间。
后再用gettimeofday()取得系统时间,两者相减就是代码运行
时间。
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。