added chrono time measurement

This commit is contained in:
lukas 2020-05-03 00:59:22 +02:00
parent f93891f1fd
commit 552ad65bcd

View File

@ -5,6 +5,9 @@
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
#include "vulkan/vulkan.h" #include "vulkan/vulkan.h"
#include <chrono>
#include <thread>
VkInstance instance; VkInstance instance;
VkDevice device; VkDevice device;
@ -172,7 +175,16 @@ void startVulkan() {
void gameLoop() { void gameLoop() {
while (!glfwWindowShouldClose(window)) { while (!glfwWindowShouldClose(window)) {
auto start = std::chrono::steady_clock::now();
std::chrono::system_clock::now().time_since_epoch();
glfwPollEvents(); glfwPollEvents();
auto end = std::chrono::steady_clock::now();
std::cout << "Frequency : "
<< 1000000 / (int)(std::chrono::duration_cast<std::chrono::microseconds>(end - start).count())
<< " fps" << std::endl;
std::this_thread::sleep_for(std::chrono::milliseconds(20));
} }
} }