lemon/time_measure.h
branch1.0
changeset 369 65f80c81d41c
parent 366 daddd623ac9a
child 383 097d7c4634ea
     1.1 --- a/lemon/time_measure.h	Tue Feb 10 17:29:39 2009 +0000
     1.2 +++ b/lemon/time_measure.h	Mon Feb 16 18:11:10 2009 +0000
     1.3 @@ -24,14 +24,7 @@
     1.4  ///\brief Tools for measuring cpu usage
     1.5  
     1.6  #ifdef WIN32
     1.7 -#ifndef WIN32_LEAN_AND_MEAN
     1.8 -#define WIN32_LEAN_AND_MEAN
     1.9 -#endif
    1.10 -#ifndef NOMINMAX
    1.11 -#define NOMINMAX
    1.12 -#endif
    1.13 -#include <windows.h>
    1.14 -#include <cmath>
    1.15 +#include <lemon/bits/windows.h>
    1.16  #else
    1.17  #include <unistd.h>
    1.18  #include <sys/times.h>
    1.19 @@ -92,26 +85,7 @@
    1.20        cutime=ts.tms_cutime/tck;
    1.21        cstime=ts.tms_cstime/tck;
    1.22  #else
    1.23 -      static const double ch = 4294967296.0e-7;
    1.24 -      static const double cl = 1.0e-7;
    1.25 -
    1.26 -      FILETIME system;
    1.27 -      GetSystemTimeAsFileTime(&system);
    1.28 -      rtime = ch * system.dwHighDateTime + cl * system.dwLowDateTime;
    1.29 -
    1.30 -      FILETIME create, exit, kernel, user;
    1.31 -      if (GetProcessTimes(GetCurrentProcess(),&create, &exit, &kernel, &user)) {
    1.32 -        utime = ch * user.dwHighDateTime + cl * user.dwLowDateTime;
    1.33 -        stime = ch * kernel.dwHighDateTime + cl * kernel.dwLowDateTime;
    1.34 -        cutime = 0;
    1.35 -        cstime = 0;
    1.36 -      } else {
    1.37 -        rtime = 0;
    1.38 -        utime = 0;
    1.39 -        stime = 0;
    1.40 -        cutime = 0;
    1.41 -        cstime = 0;
    1.42 -      }
    1.43 +      bits::getWinProcTimes(rtime, utime, stime, cutime, cstime);
    1.44  #endif
    1.45      }
    1.46