+ *
+ * Some examples of profiling scope: In the snippets below, c1, c2...
+ * designate code chunks, and the identifiers of profiling blocks are
+ * chosen to reflect what they count.
+ *
+ * {
+ * c1
+ * PROFILE_THIS_BLOCK(c2)
+ * c2
+ * }
+ *
+ *
+ * {
+ * PROFILE_THIS_BLOCK(c1_c2)
+ * c1
+ * PROFILE_THIS_BLOCK(c2)
+ * c2
+ * }
+ *
+ *
+ * {
+ * {
+ * PROFILE_THIS_BLOCK(c1)
+ * c1
+ * }
+ * PROFILE_THIS_BLOCK(c2)
+ * c2
+ * }
+ *
+ *
+ * {
+ * PROFILE_THIS_BLOCK(c1_c2_c3)
+ * c1
+ * {
+ * PROFILE_THIS_BLOCK(c2)
+ * c2
+ * }
+ * c3
+ * }
+ *
+ * Influence of identifier names: they are mainly used for display
+ * purpose, but the same name should not be used twice in the same
+ * scope.
+ *
+ * {
+ * PROFILE_THIS_BLOCK(foo)
+ * c1
+ * PROFILE_THIS_BLOCK(foo) // error: identifier clash
+ * c2
+ * }
+ *
+ * In the example below, c1+c2 and c2 are counted separately, but in
+ * the output, both are confusingly labelled `foo'.
+ *
+ * {
+ * PROFILE_THIS_BLOCK(foo)
+ * c1
+ * {
+ * PROFILE_THIS_BLOCK(foo) // error: identifier clash
+ * c2
+ * }
+ * }
+
+ */
+
+#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.