+#ifndef PMPROF_H
+#define PMPROF_H
+
+#ifdef _WIN32
+#include <windows.h>
+#else
+#include <sys/time.h>
+#endif
+
+#include <iomanip>
+#include <iostream>
+
+
+#if defined(__GNUG__) && defined(_GLIBCXX_DEBUG)
+#error Profiling is not usable when run-time debugging is in effect
+#endif
+
+#ifdef _WIN32
+/* This function does not really returns the "time of day",
+ * but it will suffice to evaluate elapsed times.
+ */
+int gettimeofday(struct timeval * tv, struct timezone * /*tz*/)
+{
+ LARGE_INTEGER frequency, t;
+ QueryPerformanceFrequency(&frequency);
+ QueryPerformanceCounter(&t);
+
+ tv->tv_sec = long(t.QuadPart / frequency.QuadPart);
+ tv->tv_usec = long((1000000.0 * (t.QuadPart % frequency.QuadPart)) / frequency.QuadPart);
+ return 0;
+}
+
+#endif // _WIN32