add more timers to headless test
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include <llmr/llmr.hpp>
|
||||
#include <llmr/util/image.hpp>
|
||||
#include <llmr/util/io.hpp>
|
||||
#include <llmr/util/timer.hpp>
|
||||
|
||||
#include <uv.h>
|
||||
|
||||
@@ -23,6 +24,7 @@ TEST(Headless, initialize) {
|
||||
|
||||
llmr::Map map(settings);
|
||||
|
||||
llmr::util::timer timer;
|
||||
|
||||
// Setup OpenGL
|
||||
CGLContextObj gl_context;
|
||||
@@ -57,6 +59,8 @@ TEST(Headless, initialize) {
|
||||
return;
|
||||
}
|
||||
|
||||
timer.report("gl setup");
|
||||
|
||||
|
||||
int width = 1024;
|
||||
int height = 768;
|
||||
@@ -84,7 +88,6 @@ TEST(Headless, initialize) {
|
||||
GLenum status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
|
||||
|
||||
|
||||
|
||||
if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
|
||||
fprintf(stderr, "Couldn't create framebuffer: ");
|
||||
switch (status) {
|
||||
@@ -97,26 +100,48 @@ TEST(Headless, initialize) {
|
||||
return;
|
||||
}
|
||||
|
||||
timer.report("gl framebuffer");
|
||||
|
||||
map.setup();
|
||||
|
||||
timer.report("map setup");
|
||||
|
||||
map.resize(width, height);
|
||||
|
||||
timer.report("map resize");
|
||||
|
||||
map.loadSettings();
|
||||
|
||||
timer.report("map settings");
|
||||
|
||||
map.update();
|
||||
|
||||
timer.report("map update");
|
||||
|
||||
// Run the loop. It will terminate when we don't have any further listeners.
|
||||
map.run();
|
||||
|
||||
timer.report("map loop");
|
||||
|
||||
map.render();
|
||||
|
||||
timer.report("map render");
|
||||
|
||||
uint32_t *pixels = new uint32_t[width * height];
|
||||
|
||||
glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
|
||||
|
||||
timer.report("gl readpixels");
|
||||
|
||||
std::string result = llmr::util::compress_png(width, height, pixels, true);
|
||||
|
||||
timer.report("compress png");
|
||||
|
||||
llmr::util::write_file("out.png", result);
|
||||
|
||||
timer.report("save file");
|
||||
|
||||
|
||||
delete[] pixels;
|
||||
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
|
||||
@@ -125,4 +150,6 @@ TEST(Headless, initialize) {
|
||||
glDeleteRenderbuffersEXT(1, &fbo_depth_stencil);
|
||||
|
||||
CGLDestroyContext(gl_context);
|
||||
|
||||
timer.report("destruct");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user