---------- Forwarded message ----------
From: Kyle Van Berendonck <kvanberendonck@gmail.com>
Date: Sun, Apr 14, 2013 at 5:56 PM
Subject: Implemented getPageFaults for win32
To: ghc-devs@haskell.org


Author: Kyle Van Berendonck <kvanberendonck@gmail.com>  2013-04-14 17:45:39
Committer: Kyle Van Berendonck <kvanberendonck@gmail.com>  2013-04-14 17:45:39
Parent: 52efb2c8aefbd448e765e62a34c3e53ab7202a11 (No need to map over all blocks, setting up PIC.)
Branch: master
Follows: ghc-darcs-git-switchover
Precedes:

Implemented getPageFaults for win32

----------------------------- rts/win32/GetTime.c -----------------------------
index bfab43a..50a2c4d 100644
@@ -157,6 +157,13 @@ W_
 getPageFaults(void)
 {
   /* ToDo (on NT): better, get this via the performance data
-     that's stored in the registry. */
+     that's stored in the registry.
+    
+     nb: this includes the number of soft page faults, but it's better than nothing
+     */
+     PROCESS_MEMORY_COUNTERS pmc;
+     if (GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc))) {
+         return pmc.PageFaultCount;
+     }
     return 0;
 }