added chrono time measurement
This commit is contained in:
parent
f93891f1fd
commit
552ad65bcd
12
main.cpp
12
main.cpp
@ -5,6 +5,9 @@
|
||||
|
||||
#include <GLFW/glfw3.h>
|
||||
#include "vulkan/vulkan.h"
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
|
||||
VkInstance instance;
|
||||
VkDevice device;
|
||||
@ -172,7 +175,16 @@ void startVulkan() {
|
||||
|
||||
void gameLoop() {
|
||||
while (!glfwWindowShouldClose(window)) {
|
||||
auto start = std::chrono::steady_clock::now();
|
||||
|
||||
std::chrono::system_clock::now().time_since_epoch();
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user