aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CycleClock/src/cycleclock.h
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@gmail.com>2012-12-21 19:19:38 -0500
committerErik Schnetter <schnetter@gmail.com>2012-12-21 19:19:38 -0500
commita60b2971fc200c8f30e43579beb3770ff30af422 (patch)
treec3336e5048ae8f83829d881aa8290fde8b101e7a /Carpet/CycleClock/src/cycleclock.h
parent2c6ced8b7e84af5509e58d09865a88b52385321e (diff)
CarpetLib, CycleClock: Move cycle counting clock into its own thorn
New thorn CycleClock, mostly taken out of CarpetLib. This thorn provides an (almost) cycle-accurate clock, taken from FFTW. This clock is both directly accessible, and is also wrapped in a Cactus clock. Note: Applying this commit will require adding thorn CycleClock to thorn lists and parameter files.
Diffstat (limited to 'Carpet/CycleClock/src/cycleclock.h')
-rw-r--r--Carpet/CycleClock/src/cycleclock.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/Carpet/CycleClock/src/cycleclock.h b/Carpet/CycleClock/src/cycleclock.h
new file mode 100644
index 000000000..c985609f1
--- /dev/null
+++ b/Carpet/CycleClock/src/cycleclock.h
@@ -0,0 +1,32 @@
+#ifndef CYCLECLOCK_H
+#define CYCLECLOCK_H
+
+/* This defines:
+ * typedef XXX ticks;
+ * ticks getticks();
+ * double elapsed(ticks t1, ticks t0);
+ * Use as:
+ * #include <cycleclock.h>
+ * ticks t0 = getticks();
+ * ...
+ * ticks t1 = getticks();
+ * double elapsed_ticks = elapsed(t1, t0);
+ * double elapsed_seconds = seconds_per_tick() * elapsed_ticks;
+*/
+
+//#include <cctk.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "cycle.h"
+
+ double seconds_per_tick();
+ void measure_tick();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* CYCLECLOCK_H */