diff --git a/android/base/vulkanandroidbase.hpp b/android/base/vulkanandroidbase.hpp index 8b3d05ba..3a468cbd 100644 --- a/android/base/vulkanandroidbase.hpp +++ b/android/base/vulkanandroidbase.hpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include "vulkanandroid.h" @@ -25,6 +26,7 @@ class VulkanAndroidExampleBase { private: + std::chrono::high_resolution_clock::time_point tStart; VkShaderModule loadShaderModule(const char *fileName, VkShaderStageFlagBits stage) { // Load shader from compressed asset @@ -58,6 +60,7 @@ public: struct android_app* app; uint32_t width; uint32_t height; + float frameTimer = 0; struct Texture { VkSampler sampler; @@ -863,4 +866,16 @@ public: vkFreeMemory(device, texture->deviceMemory, nullptr); } + void startTiming() + { + tStart = std::chrono::high_resolution_clock::now(); + } + + void endTiming() + { + auto tEnd = std::chrono::high_resolution_clock::now(); + auto tDiff = std::chrono::duration(tEnd - tStart).count(); + frameTimer = (float)tDiff; + } + }; \ No newline at end of file