This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libfortran/23380] [mingw32] cpu_time intrinsic malfunction
- From: "dannysmith at users dot sourceforge dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 14 Aug 2005 20:56:18 -0000
- Subject: [Bug libfortran/23380] [mingw32] cpu_time intrinsic malfunction
- References: <20050813214828.23380.edunlop@utvinternet.ie>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From dannysmith at users dot sourceforge dot net 2005-08-14 20:56 -------
>From my libgfortran/config.h, configured with --host=mingw32 --target=mingw32
and mingw runtime as distributed by mingw.org
/* Define to 1 if you have the `getrusage' function. */
/* #undef HAVE_GETRUSAGE */
and
/* Define to 1 if you have the `times' function. */
/* #undef HAVE_TIMES */
So maybe you should query the source of your binaries.
FWIW, here is how to get cpu time on NT
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
static void
__winnt_cpu_time (long *sec, long *usec)
{
union {
FILETIME ft;
unsigned long long ulltime;
} kernel_time, user_time;
FILETIME unused1, unused2;
unsigned long long total_time;
/* No support for Win9x. The high order bit of the DWORD
returned by GetVersion is 0 for NT and higher. */
if (GetVersion () >= 0x80000000)
{
*sec = -1;
*usec = 0;
return;
}
/* The FILETIME structs filled in by GetProcessTimes represent
time in 100 nanosecond units. */
GetProcessTimes (GetCurrentProcess (), &unused1, &unused2,
&kernel_time.ft, &user_time.ft);
total_time = (kernel_time.ulltime + user_time.ulltime)/10;
*sec = total_time / 1000000;
*usec = total_time % 1000000;
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23380