Mercurial > hg > octave-avbm
changeset 5698:e33aff8ba378
[project @ 2006-03-21 16:36:58 by dbateman]
author | dbateman |
---|---|
date | Tue, 21 Mar 2006 16:36:58 +0000 |
parents | 2fe20065a545 |
children | 8459ed2e2668 |
files | src/DLD-FUNCTIONS/getrusage.cc |
diffstat | 1 files changed, 19 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/DLD-FUNCTIONS/getrusage.cc +++ b/src/DLD-FUNCTIONS/getrusage.cc @@ -35,6 +35,10 @@ #include <sys/resource.h> #endif +#if defined (__MINGW32__) +#include <windows.h> +#endif + #if defined (HAVE_TIMES) && defined (HAVE_SYS_TIMES_H) #if defined (HAVE_SYS_PARAM_H) @@ -133,6 +137,7 @@ Octave_map m; Octave_map tv_tmp; + // XXX FIXME XX -- maybe encapsulate all of this in a liboctave class #if defined (HAVE_GETRUSAGE) struct rusage ru; @@ -191,6 +196,20 @@ tv_tmp.assign ("usec", static_cast<double> (fraction * 1e6 / HZ)); m.assign ("stime", octave_value (tv_tmp)); +#elif defined (__MINGW32__) + HANDLE hProcess = GetCurrentProcess (); + FILETIME ftCreation, ftExit, ftUser, ftKernel; + GetProcessTimes (hProcess, &ftCreation, &ftExit, &ftKernel, &ftUser); + + EIGHT_BYTE_INT itmp = *(reinterpret_cast<EIGHT_BYTE_INT *> (&ftUser)); + tv_tmp.assign ("sec", static_cast<double> (itmp / 10000000U)); + tv_tmp.assign ("usec", static_cast<double> (itmp % 10000000U) / 10.); + m.assign ("utime", octave_value (tv_tmp)); + + itmp = *(reinterpret_cast<EIGHT_BYTE_INT *> (&ftKernel)); + tv_tmp.assign ("sec", static_cast<double> (itmp / 10000000U)); + tv_tmp.assign ("usec", static_cast<double> (itmp % 10000000U) / 10.); + m.assign ("stime", octave_value (tv_tmp)); #else tv_tmp.assign ("sec", 0);