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( ¤t ); return filetime_to_seconds( add_FILETIME( current, negate_FILETIME( creation ) ) ); } return 0.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(¤t); { double delta = filetime_seconds( add_FILETIME( current, negate_FILETIME(creation) ) ); return delta; } } return 0.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); }