【问题标题】:Is CLOCK_THREAD_CPUTIME_ID the same as pthread_getcpuclockid(pthread_self(),..)?CLOCK_THREAD_CPUTIME_ID 是否与 pthread_getcpuclockid(pthread_self(),..) 相同?
【发布时间】:2015-01-14 23:57:20
【问题描述】:

在使用Posix clock_gettime() 获取每个线程的CPU 时间方面:使用从pthread_getcpuclockid(pthread_self(),..) 获得的时钟ID 和使用CLOCK_THREAD_CPUTIME_ID 有什么区别?

【问题讨论】:

    标签: cpu-time


    【解决方案1】:

    根据man page

    NOTES
    
       When thread refers to the calling thread, this function returns an
       identifier that refers to the same clock manipulated by
       clock_gettime(2) and clock_settime(2) when given the clock ID
       CLOCK_THREAD_CPUTIME_ID.
    

    【讨论】:

    • 谢谢,这让我很满意,因为操作系统确实是 linux。提示问题是因为我正在查看 POSIX 手册页 (pubs.opengroup.org) 但没有找到任何此类注释。我想知道是否所有 POSIX 操作系统都是如此?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2010-09-13
    • 2011-01-28
    • 2013-06-21
    • 1970-01-01
    • 2021-08-17
    • 2019-11-12
    • 1970-01-01
    相关资源
    最近更新 更多