Ticks getProcessCPUTime(void) { FILETIME creationTime, exitTime, userTime, kernelTime = {0,0}; if (isWin9x()) return getProcessElapsedTime(); if (!GetProcessTimes(GetCurrentProcess(), &creationTime, &exitTime, &kernelTime, &userTime)) { return 0; } return fileTimeToTicks(userTime); }
/* * For a given microsecond delay, return the target time in LowResTime. */ LowResTime getDelayTarget (HsInt us) { Time elapsed; elapsed = getProcessElapsedTime(); // If the desired target would be larger than the maximum Time, // default to the maximum Time. (#7087) if (us > TimeToUS(TIME_MAX - elapsed)) { return TimeToLowResTimeRoundDown(TIME_MAX); } else { // round up the target time, because we never want to sleep *less* // than the desired amount. return TimeToLowResTimeRoundUp(elapsed + USToTime(us)); } }
void stat_gcWorkerThreadDone (gc_thread *gct) { Ticks thread_cpu, elapsed, gc_cpu, gc_elapsed; if (RtsFlags.GcFlags.giveStats != NO_GC_STATS) { elapsed = getProcessElapsedTime(); thread_cpu = getThreadCPUTime(); gc_cpu = thread_cpu - gct->gc_start_thread_cpu; gc_elapsed = elapsed - gct->gc_start_elapsed; taskDoneGC(gct->cap->running_task, gc_cpu, gc_elapsed); } }
void getProcessTimes(Time *user, Time *elapsed) { *user = getProcessCPUTime(); *elapsed = getProcessElapsedTime(); }
Time stat_getElapsedTime(void) { return getProcessElapsedTime() - start_init_elapsed; }
/* * Return the time since the program started, in LowResTime, * rounded down. */ static LowResTime getLowResTimeOfDay(void) { return TimeToLowResTimeRoundDown(getProcessElapsedTime()); }
/* * For a given microsecond delay, return the target time in LowResTime. */ LowResTime getDelayTarget (HsInt us) { // round up the target time, because we never want to sleep *less* // than the desired amount. return TimeToLowResTimeRoundUp(getProcessElapsedTime() + USToTime(us)); }