From ecf2f74c15c5b89022f7167b44f67ecee4e0ae54 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Fonseca?= Date: Wed, 9 Feb 2011 14:51:07 +0000 Subject: [PATCH] Add a benchmark mode. --- glretrace.py | 11 ++++++++--- retrace.py | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/glretrace.py b/glretrace.py index f809b9e..cda2357 100644 --- a/glretrace.py +++ b/glretrace.py @@ -164,13 +164,14 @@ unsigned __frame = 0; long long __startTime = 0; bool __wait = false; +bool __benchmark = false; const char *__compare_prefix = NULL; const char *__snapshot_prefix = NULL; static void checkGlError(void) { - if (insideGlBeginEnd) { + if (__benchmark || insideGlBeginEnd) { return; } @@ -236,7 +237,7 @@ static void frame_complete(void) { if (!ref) { return; } - if (verbosity) + if (verbosity >= 0) std::cout << "Read " << filename << "\n"; } @@ -246,7 +247,7 @@ static void frame_complete(void) { if (__snapshot_prefix) { char filename[PATH_MAX]; snprintf(filename, sizeof filename, "%s%04u.png", __snapshot_prefix, __frame); - if (src.writePNG(filename) && verbosity) { + if (src.writePNG(filename) && verbosity >= 0) { std::cout << "Wrote " << filename << "\n"; } } @@ -324,6 +325,7 @@ static void usage(void) { "Usage: glretrace [OPTION] TRACE\n" "Replay TRACE.\n" "\n" + " -b benchmark (no glgeterror; no messages)\n" " -c PREFIX compare against snapshots\n" " -db use a double buffer visual\n" " -s PREFIX take snapshots\n" @@ -343,6 +345,9 @@ int main(int argc, char **argv) if (!strcmp(arg, "--")) { break; + } else if (!strcmp(arg, "-b")) { + __benchmark = true; + --verbosity; } else if (!strcmp(arg, "-c")) { __compare_prefix = argv[++i]; } else if (!strcmp(arg, "-db")) { diff --git a/retrace.py b/retrace.py index ea2377c..d54b25d 100644 --- a/retrace.py +++ b/retrace.py @@ -276,7 +276,7 @@ class Retracer: handle_names.add(handle.name) print - print 'unsigned verbosity = 0;' + print 'int verbosity = 0;' print self.retrace_functions(api.functions) -- 2.7.4