From 91b6685487e46fa86b239362477328c11dea5ce5 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Mon, 4 Dec 2006 03:50:07 +0000 Subject: [PATCH] [SIGAR-19] change process cpu time units to milliseconds --- src/os/win32/win32_sigar.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/os/win32/win32_sigar.c b/src/os/win32/win32_sigar.c index 9b2c0693..14c16a0c 100644 --- a/src/os/win32/win32_sigar.c +++ b/src/os/win32/win32_sigar.c @@ -107,6 +107,8 @@ typedef enum { /* 1/100ns units to seconds */ #define NS100_2SEC(t) ((t) / 10000000) +#define NS100_2MSEC(t) ((t) / 10000) + #define PERF_VAL_CPU(ix) \ NS100_2SEC(PERF_VAL(ix)) @@ -1085,8 +1087,8 @@ SIGAR_DECLARE(int) sigar_proc_cred_get(sigar_t *sigar, sigar_pid_t pid, return SIGAR_ENOTIMPL; } -#define FILETIME2SEC(ft) \ - NS100_2SEC(((ft.dwHighDateTime << 32) | ft.dwLowDateTime)) +#define FILETIME2MSEC(ft) \ + NS100_2MSEC(((ft.dwHighDateTime << 32) | ft.dwLowDateTime)) SIGAR_DECLARE(int) sigar_proc_time_get(sigar_t *sigar, sigar_pid_t pid, sigar_proc_time_t *proctime) @@ -1114,8 +1116,8 @@ SIGAR_DECLARE(int) sigar_proc_time_get(sigar_t *sigar, sigar_pid_t pid, proctime->start_time = 0; } - proctime->user = FILETIME2SEC(user_time); - proctime->sys = FILETIME2SEC(system_time); + proctime->user = FILETIME2MSEC(user_time); + proctime->sys = FILETIME2MSEC(system_time); proctime->total = proctime->user + proctime->sys; return SIGAR_OK;