]> git.cworth.org Git - apitrace/blobdiff - glretrace_main.cpp
Merge branch 'master' into d3dretrace
[apitrace] / glretrace_main.cpp
index f9d77413eef276c8513aa294c19af90238745934..16d3ec0de8599fd3ce5cf0379f4439b35578eeb6 100644 (file)
@@ -26,6 +26,7 @@
 
 #include <string.h>
 
+#include "os_binary.hpp"
 #include "os_string.hpp"
 #include "os_time.hpp"
 #include "image.hpp"
@@ -40,7 +41,6 @@ namespace glretrace {
 
 bool double_buffer = true;
 bool insideGlBeginEnd = false;
-trace::Parser parser;
 glws::Profile defaultProfile = glws::PROFILE_COMPAT;
 glws::Visual *visual[glws::PROFILE_MAX];
 glws::Drawable *drawable = NULL;
@@ -256,7 +256,7 @@ static void display(void) {
     long long endTime = os::getTime();
     float timeInterval = (endTime - startTime) * (1.0 / os::timeFrequency);
 
-    if (retrace::verbosity >= -1) { 
+    if ((retrace::verbosity >= -1) || (retrace::profiling)) {
         std::cout << 
             "Rendered " << frame << " frames"
             " in " <<  timeInterval << " secs,"
@@ -277,6 +277,7 @@ static void usage(void) {
         "Replay TRACE.\n"
         "\n"
         "  -b           benchmark mode (no error checking or warning messages)\n"
+        "  -p           profiling mode (run whole trace, dump profiling info)\n"
         "  -c PREFIX    compare against snapshots\n"
         "  -C CALLSET   calls to compare (default is every frame)\n"
         "  -core        use core profile\n"
@@ -309,6 +310,10 @@ int main(int argc, char **argv)
             benchmark = true;
             retrace::verbosity = -1;
             glws::debug = false;
+        } else if (!strcmp(arg, "-p")) {
+            retrace::profiling = true;
+            retrace::verbosity = -1;
+            glws::debug = false;
         } else if (!strcmp(arg, "-c")) {
             compare_prefix = argv[++i];
             if (compare_frequency.empty()) {
@@ -337,6 +342,7 @@ int main(int argc, char **argv)
                 snapshot_frequency = trace::CallSet(trace::FREQUENCY_FRAME);
             }
             if (snapshot_prefix[0] == '-' && snapshot_prefix[1] == 0) {
+                os::setBinaryMode(stdout);
                 retrace::verbosity = -2;
             }
         } else if (!strcmp(arg, "-S")) {