VirtualBox

Changeset 34626 in vbox


Ignore:
Timestamp:
Dec 2, 2010 4:44:03 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
68428
Message:

implemented RTThreadGetExecutionTimeMilli() for Posix and introduced a testcase

Location:
trunk/src/VBox/Runtime
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/posix/thread-posix.cpp

    r34289 r34626  
    413413RTR3DECL(int) RTThreadGetExecutionTimeMilli(uint64_t *pKernelTime, uint64_t *pUserTime)
    414414{
    415     return VERR_NOT_IMPLEMENTED;
    416 }
     415    struct timespec ts;
     416    int rc = clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts);
     417    if (rc)
     418        return RTErrConvertFromErrno(rc);
     419
     420    *pKernelTime = 0;
     421    *pUserTime = (uint64_t)ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
     422    return VINF_SUCCESS;
     423}
  • trunk/src/VBox/Runtime/testcase/Makefile.kmk

    r34464 r34626  
    110110        tstThread-1 \
    111111        tstRTThreadPoke \
     112        tstRTThreadExecutionTime \
    112113        tstTime \
    113114        tstTime-2 \
     
    465466tstRTThreadPoke_SOURCES = tstRTThreadPoke.cpp
    466467
     468tstRTThreadExecutionTime_TEMPLATE = VBOXR3TSTEXE
     469tstRTThreadExecutionTime_SOURCES = tstRTThreadExecutionTime.cpp
     470
    467471tstTime_SOURCES = tstTime.cpp
    468472
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette