Example #1
0
static double running_time( HANDLE const process )
{
    FILETIME creation;
    FILETIME exit;
    FILETIME kernel;
    FILETIME user;
    if ( GetProcessTimes( process, &creation, &exit, &kernel, &user ) )
    {
        /* Compute the elapsed time. */
        FILETIME current;
        GetSystemTimeAsFileTime( &current );
        return filetime_to_seconds( add_FILETIME( current,
            negate_FILETIME( creation ) ) );
    }
    return 0.0;
}
Example #2
0
static double
running_time(HANDLE process)
{
    FILETIME creation, exit, kernel, user, current;
    if (GetProcessTimes(process, &creation, &exit, &kernel, &user))
    {
        /* Compute the elapsed time */
        GetSystemTimeAsFileTime(&current);
        {
            double delta = filetime_seconds(
                add_FILETIME( current, negate_FILETIME(creation) )
                );
            return delta;
        }
    }
    return 0.0;
}
Example #3
0
static void
record_times(int pid, timing_info* time)
{
    FILETIME creation, exit, kernel, user;
    if (GetProcessTimes((HANDLE)pid, &creation, &exit, &kernel, &user))
    {
        /* Compute the elapsed time */
#if 0 /* We don't know how to get this number this on Unix */
        time->elapsed = filetime_seconds(
            add_FILETIME( exit, negate_FILETIME(creation) )
        );
#endif 

        time->system = filetime_seconds(kernel);
        time->user = filetime_seconds(user);            
    }
        
    CloseHandle((HANDLE)pid);
}