Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Hostetler <jeffhost@microsoft.com>2015-03-02 17:21:55 +0300
committerJeff Hostetler <jeffhost@microsoft.com>2015-03-02 17:21:55 +0300
commit9a859ef55a3de35d7e35dbaf33bd562aeb1cf081 (patch)
tree7d8a3775bbd391174eb2d7cf2c626f18707df4dd /tests/clar_libgit2_timer.h
parentf096fbf4d6a0ef37aba287a88411ad7ca3e8a365 (diff)
Added cl_perf_timer. Updated global trace to include timers.
Diffstat (limited to 'tests/clar_libgit2_timer.h')
-rw-r--r--tests/clar_libgit2_timer.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/clar_libgit2_timer.h b/tests/clar_libgit2_timer.h
new file mode 100644
index 000000000..b646c7b63
--- /dev/null
+++ b/tests/clar_libgit2_timer.h
@@ -0,0 +1,48 @@
+#ifndef __CLAR_LIBGIT2_TIMER__
+#define __CLAR_LIBGIT2_TIMER__
+
+#if defined(GIT_WIN32)
+
+struct cl_perf_timer
+{
+ /* cummulative running time across all start..stop intervals */
+ LARGE_INTEGER sum;
+ /* value of last start..stop interval */
+ LARGE_INTEGER last;
+ /* clock value at start */
+ LARGE_INTEGER time_started;
+};
+
+#define CL_PERF_TIMER_INIT {0}
+
+#else
+
+struct cl_perf_timer
+{
+ uint32_t sum;
+ uint32_t last;
+ uint32_t time_started;
+};
+
+#define CL_PERF_TIMER_INIT {0}
+
+#endif
+
+typedef struct cl_perf_timer cl_perf_timer;
+
+void cl_perf_timer__init(cl_perf_timer *t);
+void cl_perf_timer__start(cl_perf_timer *t);
+void cl_perf_timer__stop(cl_perf_timer *t);
+
+/**
+ * return value of last start..stop interval in seconds.
+ */
+double cl_perf_timer__last(const cl_perf_timer *t);
+
+/**
+ * return cummulative running time across all start..stop
+ * intervals in seconds.
+ */
+double cl_perf_timer__sum(const cl_perf_timer *t);
+
+#endif /* __CLAR_LIBGIT2_TIMER__ */