Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2013-06-14 13:09:41 +0400
committerCorinna Vinschen <corinna@vinschen.de>2013-06-14 13:09:41 +0400
commit0ff057d5a5f811d13cbab893d61bade826eaf223 (patch)
treed75f30ba0f58b31cb7c410f53dc7b70e36d12724 /winsup/cygwin/resource.cc
parentba763af5599bf80e488b98a1cf973c2388eeeac9 (diff)
Streamline time/times functionality. Remove last remains of former
Windows 9x compatibility. * fhandler_disk_file.cc (fhandler_base::fstat_helper): Drop now unneeded casts in calls to_timestruc_t. (fhandler_base::utimens_fs): Ditto for timespec_to_filetime. * fhandler_proc.cc (format_proc_stat): Ditto for to_time_t. * hires.h (class hires_ms): Remove unused member initime_ns. Remove declarations for timeGetTime_ns and prime. (hires_ms::uptime): Remove. * posix_ipc.cc (ipc_cond_timedwait): Ditto for timespec_to_filetime. * fhandler_registry.cc (fhandler_registry::fstat): Add cast. * resource.cc (fill_rusage): Call NtQueryInformationProcess rather than GetProcessTimes to deal with LARGE_INTEGER rather than FILETIME. * times.cc: Simplify time handling. Throughout, use LARGE_INTEGER rather than FILETIME to simplify computations. Throughout use {u}int64_t rather than {unsigned} long long. Drop unneeded casts since NSPERSEC is 64 bit anyway. (systime_ns): Remove. (times): Call NtQuerySystemInformation to fetch boot time. Call NtQueryInformationProcess rather than GetProcessTimes to deal with LARGE_INTEGER rather than FILETIME. Call GetSystemTimeAsFileTime. (totimeval): Use constant 1000000 as in other functions. (time_t_to_filetime): Remove. (to_time_t): Change return type to time_t. (time_as_timestruc_t): Rename filetime to systime. (time): Ditto. Add cast. (hires_ns::nsecs): Fix return type cast. (hires_ms::timeGetTime_ns): Remove. (hires_ns::prime): Remove. (hires_ms::nsecs): Drop call to prime. Call GetSystemTimeAsFileTime directly. Subtract FACTOR here since it's the only function needing to do so. (minperiod): Cosmetically change to ULONG. (hires_ns::resolution): Fix return type cast. (hires_ms::resolution): Simplify, rely on NtQueryTimerResolution. * winsup.h: Align time related prototypes to above changes.
Diffstat (limited to 'winsup/cygwin/resource.cc')
-rw-r--r--winsup/cygwin/resource.cc14
1 files changed, 6 insertions, 8 deletions
diff --git a/winsup/cygwin/resource.cc b/winsup/cygwin/resource.cc
index 15ca2208a..25e87e6e0 100644
--- a/winsup/cygwin/resource.cc
+++ b/winsup/cygwin/resource.cc
@@ -65,18 +65,16 @@ add_rusage (struct rusage *r1, struct rusage *r2)
void __stdcall
fill_rusage (struct rusage *r, HANDLE h)
{
- FILETIME creation_time = {0,0};
- FILETIME exit_time = {0,0};
- FILETIME kernel_time = {0,0};
- FILETIME user_time = {0,0};
+ KERNEL_USER_TIMES kut;
struct timeval tv;
- memset (r, 0, sizeof (*r));
- GetProcessTimes (h, &creation_time, &exit_time, &kernel_time, &user_time);
- totimeval (&tv, &kernel_time, 0, 0);
+ memset (&kut, 0, sizeof kut);
+ memset (r, 0, sizeof *r);
+ NtQueryInformationProcess (h, ProcessTimes, &kut, sizeof kut, NULL);
+ totimeval (&tv, &kut.KernelTime, 0, 0);
add_timeval (&r->ru_stime, &tv);
- totimeval (&tv, &user_time, 0, 0);
+ totimeval (&tv, &kut.UserTime, 0, 0);
add_timeval (&r->ru_utime, &tv);
VM_COUNTERS vmc;