[Bug 26785] SIV incorrectly reports the same CPU time usage for all it's threads

wine-bugs at winehq.org wine-bugs at winehq.org
Fri Apr 15 08:53:56 CDT 2011


http://bugs.winehq.org/show_bug.cgi?id=26785

--- Comment #3 from ray at pobox.co.uk 2011-04-15 08:53:55 CDT ---
I have updated the code as follows, but do know know how to add "-lrt" to the
link of ntdll.dll.so. I expect this will only be possible on some targets and I
also don't know how to update the build system for this. Please can someone
help me?

/* We can only (portably) do this for the current thread */
if (handle == GetCurrentThread())
{
    struct timespec spec_buf;

    /* are thread times available ? */

    if( (       sysconf( _POSIX_THREAD_CPUTIME               ) ) &&
        ( !clock_gettime( CLOCK_THREAD_CPUTIME_ID, &spec_buf ) ) )
    {
        /* yes, but no kernel time, so just return user time */

        kusrt.KernelTime.QuadPart = 0;
        kusrt.UserTime.QuadPart   = (ULONGLONG)spec_buf.tv_sec  * 10000000 +
                                               spec_buf.tv_nsec / 100;
    }
    else
    {
        struct tms  time_buf;
        long        tick_time = 10000000 / sysconf( _SC_CLK_TCK );

        /* call times(2) for kernel time or user time */

        times(&time_buf);

        kusrt.KernelTime.QuadPart = (ULONGLONG)time_buf.tms_stime * tick_time;
        kusrt.UserTime.QuadPart   = (ULONGLONG)time_buf.tms_utime * tick_time;
    }
}

-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
Do not reply to this email, post in Bugzilla using the
above URL to reply.
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the wine-bugs mailing list