add benchmark mode that shows the real frame time rather than the vsync time

This commit is contained in:
Konstantin Käfer
2015-08-10 17:14:00 +03:00
parent ca8ffcc456
commit 21ec505648
7 changed files with 96 additions and 20 deletions

View File

@@ -32,17 +32,19 @@ void quit_handler(int) {
int main(int argc, char *argv[]) {
bool fullscreen = false;
bool benchmark = false;
std::string style;
const struct option long_options[] = {
{"fullscreen", no_argument, 0, 'f'},
{"benchmark", no_argument, 0, 'b'},
{"style", required_argument, 0, 's'},
{0, 0, 0, 0}
};
while (true) {
int option_index = 0;
int opt = getopt_long(argc, argv, "fs:", long_options, &option_index);
int opt = getopt_long(argc, argv, "fbs:", long_options, &option_index);
if (opt == -1) break;
switch (opt)
{
@@ -52,6 +54,9 @@ int main(int argc, char *argv[]) {
case 'f':
fullscreen = true;
break;
case 'b':
benchmark = true;
break;
case 's':
style = std::string("asset://") + std::string(optarg);
default:
@@ -67,7 +72,11 @@ int main(int argc, char *argv[]) {
sigIntHandler.sa_flags = 0;
sigaction(SIGINT, &sigIntHandler, NULL);
view = std::make_unique<GLFWView>(fullscreen);
if (benchmark) {
mbgl::Log::Info(mbgl::Event::General, "BENCHMARK MODE: Some optimizations are disabled.");
}
view = std::make_unique<GLFWView>(fullscreen, benchmark);
mbgl::SQLiteCache cache("/tmp/mbgl-cache.db");
mbgl::DefaultFileSource fileSource(&cache);