Skip to content

Open Source alternative to Algolia + Pinecone and an Easier-to-Use alternative to ElasticSearch ⚡ 🔍 ✨ Fast, typo tolerant, in-memory fuzzy Search Engine for building delightful search experiences

Util for logging exec time.

Kishore Nalland8eee0d04a33
diff --git a/include/exectime.h b/include/exectime.h
new file mode 100644
index 00000000..3e269eee
--- /dev/null
+++ b/include/exectime.h
@@ -0,0 +1,17 @@
+#pragma once
+#include <iostream>
+#include <chrono>
+
+class ExecTime {
+ static auto begin = std::chrono::high_resolution_clock::now();
+
+ static void start() {
+ begin = std::chrono::high_resolution_clock::now();
+ }
+
+ static void log(std::string operation) {
+ long long int timeMicros = std::chrono::duration_cast<std::chrono::microseconds>(
+ std::chrono::high_resolution_clock::now() - begin).count();
+ std::cout << "Time taken for " << operation << ": " << timeMicros << "us" << std::endl;
+ }
+};
\ No newline at end of file