diff options
author | behdad <behdad> | 2009-04-14 03:49:52 +0000 |
---|---|---|
committer | behdad <behdad> | 2009-04-14 03:49:52 +0000 |
commit | 05c2637b3618ee6785774b6d080ac345489042d5 (patch) | |
tree | d665f5e8fbc61e4130c634db2f0abbe8b9206652 | |
parent | 9282f1fa2eada341fdf05e1167e317e084e37ad1 (diff) | |
download | fribidi-05c2637b3618ee6785774b6d080ac345489042d5.tar.gz |
Support win32 benchmarking
-rw-r--r-- | bin/fribidi-benchmark.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/bin/fribidi-benchmark.c b/bin/fribidi-benchmark.c index 4dc8bac..c9f4fa5 100644 --- a/bin/fribidi-benchmark.c +++ b/bin/fribidi-benchmark.c @@ -1,10 +1,10 @@ /* FriBidi * fribidi-benchmark.c - command line benchmark tool for libfribidi * - * $Id: fribidi-benchmark.c,v 1.7 2006-01-31 03:23:12 behdad Exp $ + * $Id: fribidi-benchmark.c,v 1.8 2009-04-14 03:49:52 behdad Exp $ * $Author: behdad $ - * $Date: 2006-01-31 03:23:12 $ - * $Revision: 1.7 $ + * $Date: 2009-04-14 03:49:52 $ + * $Revision: 1.8 $ * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/bin/fribidi-benchmark.c,v $ * * Authors: @@ -58,6 +58,9 @@ #if HAVE_SYS_TIMES_H+0 # include <sys/times.h> #endif +#ifdef _WIN32 +#include <windows.h> +#endif /* _WIN32 */ #include "getopt.h" @@ -123,12 +126,26 @@ utime ( void ) { - struct tms tb; +#ifdef _WIN32 + FILETIME creationTime, exitTime, kernelTime, userTime; + HANDLE currentProcess = GetCurrentProcess(); + if (GetProcessTimes(currentProcess, &creationTime, &exitTime, &kernelTime, &userTime)) + { + unsigned __int64 myTime = userTime.dwHighDateTime; + myTime = (myTime << 32) | userTime.dwLowDateTime; + return 1e-7 * myTime; + } + else + return 0.0; +#else /* !_WIN32 */ #if HAVE_SYS_TIMES_H+0 + struct tms tb; times (&tb); return 0.01 * tb.tms_utime; #else #warning Please fill in here to use other functions for determining time. + return 0.0; +#endif #endif } |