From: José Fonseca Date: Fri, 20 Apr 2012 22:03:24 +0000 (+0100) Subject: Move benchmark flag into common retrace code. X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=2133d27c0f719205881e2f050c38f9b3d6bcf046;p=apitrace Move benchmark flag into common retrace code. --- diff --git a/retrace/glretrace.py b/retrace/glretrace.py index a73ca1a..e6a0b58 100644 --- a/retrace/glretrace.py +++ b/retrace/glretrace.py @@ -250,7 +250,7 @@ class GlRetracer(Retracer): print ' glretrace::insideGlBeginEnd = false;' if function.name.startswith('gl') and not function.name.startswith('glX'): - print r' if (!glretrace::context && !glretrace::benchmark && !retrace::profiling) {' + print r' if (!glretrace::context && !retrace::benchmark && !retrace::profiling) {' print r' retrace::warning(call) << "no current context\n";' print r' }' @@ -286,7 +286,7 @@ class GlRetracer(Retracer): print ' glretrace::insideGlBeginEnd = true;' elif function.name.startswith('gl'): # glGetError is not allowed inside glBegin/glEnd - print ' if (!glretrace::benchmark && !retrace::profiling && !glretrace::insideGlBeginEnd) {' + print ' if (!retrace::benchmark && !retrace::profiling && !glretrace::insideGlBeginEnd) {' print ' glretrace::checkGlError(call);' if function.name in ('glProgramStringARB', 'glProgramStringNV'): print r' GLint error_position = -1;' diff --git a/retrace/glretrace_main.cpp b/retrace/glretrace_main.cpp index 313a563..011a354 100644 --- a/retrace/glretrace_main.cpp +++ b/retrace/glretrace_main.cpp @@ -50,7 +50,6 @@ unsigned frame = 0; long long startTime = 0; bool wait = false; -bool benchmark = false; static const char *compare_prefix = NULL; static const char *snapshot_prefix = NULL; static trace::CallSet snapshot_frequency; @@ -307,7 +306,7 @@ int main(int argc, char **argv) if (!strcmp(arg, "--")) { break; } else if (!strcmp(arg, "-b")) { - benchmark = true; + retrace::benchmark = true; retrace::verbosity = -1; glws::debug = false; } else if (!strcmp(arg, "-p")) { diff --git a/retrace/retrace.cpp b/retrace/retrace.cpp index 1630995..bd3dd99 100644 --- a/retrace/retrace.cpp +++ b/retrace/retrace.cpp @@ -39,6 +39,7 @@ trace::Parser parser; int verbosity = 0; +bool benchmark = false; bool profiling = false; diff --git a/retrace/retrace.hpp b/retrace/retrace.hpp index 4ee1a61..f0bc453 100644 --- a/retrace/retrace.hpp +++ b/retrace/retrace.hpp @@ -184,6 +184,11 @@ toPointer(trace::Value &value, bool bind = false); */ extern int verbosity; +/** + * Avoid expensive checks when benchmarking. + */ +extern bool benchmark; + /** * Add profiling data to the dump when retracing. */