summaryrefslogtreecommitdiff
path: root/plugins/workflow_objc/Performance.h
diff options
context:
space:
mode:
authorkat <kat@vector35.com>2025-06-20 16:17:01 -0400
committerkat <kat@vector35.com>2025-06-23 10:40:55 -0400
commit76215b86ff629da58aa94d4cf4093d2e67017412 (patch)
tree06af88506096351e99053ab5ed9901ff892801f3 /plugins/workflow_objc/Performance.h
parent17b2cb59846073fdbc08235555fd68cdb6852c42 (diff)
Move workflow_objc to API repo, remove CFString & relptr renderers
Diffstat (limited to 'plugins/workflow_objc/Performance.h')
-rw-r--r--plugins/workflow_objc/Performance.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/plugins/workflow_objc/Performance.h b/plugins/workflow_objc/Performance.h
new file mode 100644
index 00000000..7e497b4e
--- /dev/null
+++ b/plugins/workflow_objc/Performance.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2022-2023 Jon Palmisciano. All rights reserved.
+ *
+ * Use of this source code is governed by the BSD 3-Clause license; the full
+ * terms of the license can be found in the LICENSE.txt file.
+ */
+
+#pragma once
+
+#include <chrono>
+
+using high_res_clock = std::chrono::high_resolution_clock;
+
+/**
+ * Utilities for measuring performance.
+ */
+class Performance {
+public:
+ /**
+ * Get the current time.
+ */
+ static high_res_clock::time_point now()
+ {
+ return high_res_clock::now();
+ }
+
+ /**
+ * Get the current elapsed time from a given start time.
+ *
+ * Accepts a unit of measure template parameter for the result.
+ */
+ template <typename T>
+ static T elapsed(high_res_clock::time_point start)
+ {
+ auto end = high_res_clock::now();
+ return std::chrono::duration_cast<T>(end - start);
+ }
+};