diff mbox

[Branch,~glmark2-dev/glmark2/trunk] Rev 139: Scene, Options: Don't display all the scene options used for benchmarks, unless the user asks for it.

Message ID 20110920095412.24163.81528.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

alexandros.frantzis@linaro.org Sept. 20, 2011, 9:54 a.m. UTC
------------------------------------------------------------
revno: 139
committer: Alexandros Frantzis <alexandros.frantzis@linaro.org>
branch nick: trunk
timestamp: Tue 2011-09-20 12:45:24 +0300
message:
  Scene,Options: Don't display all the scene options used for benchmarks, unless the user asks for it.
  
  The displayed list of used scene options for each run benchmark can get quite
  long and confusing. With this change, only explicitly set options are shown by
  default. The user can use the "--show-all-options" command line option to
  display all the scene option values used for each run benchmark.
modified:
  src/options.cpp
  src/options.h
  src/scene.cpp
  src/scene.h


--
lp:glmark2
https://code.launchpad.net/~glmark2-dev/glmark2/trunk

You are subscribed to branch lp:glmark2.
To unsubscribe from this branch go to https://code.launchpad.net/~glmark2-dev/glmark2/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'src/options.cpp'
--- src/options.cpp	2011-08-09 11:13:43 +0000
+++ src/options.cpp	2011-09-20 09:45:24 +0000
@@ -36,6 +36,7 @@ 
 bool Options::swap_buffers = true;
 std::pair<int,int> Options::size(800, 600);
 bool Options::list_scenes = false;
+bool Options::show_all_options = false;
 bool Options::show_debug = false;
 bool Options::show_help = false;
 
@@ -45,6 +46,7 @@ 
     {"no-swap-buffers", 0, 0, 0},
     {"size", 1, 0, 0},
     {"list-scenes", 0, 0, 0},
+    {"show-all-options", 0, 0, 0},
     {"debug", 0, 0, 0},
     {"help", 0, 0, 0},
     {0, 0, 0, 0}
@@ -93,6 +95,8 @@ 
            "  -s, --size WxH         Size of the display (default: 800x600)\n"
            "  -l, --list-scenes      Display information about the available scenes\n"
            "                         and their options\n"
+           "      --show-all-options Show all scene option values used for benchmarks\n"
+           "                         (only explicitly set options are shown by default)\n"
            "  -d, --debug            Display debug messages\n"
            "  -h, --help             Display help\n");
 }
@@ -125,6 +129,8 @@ 
             parse_size(optarg, Options::size);
         else if (c == 'l' || !strcmp(optname, "list-scenes"))
             Options::list_scenes = true;
+        else if (!strcmp(optname, "show-all-options"))
+            Options::show_all_options = true;
         else if (c == 'd' || !strcmp(optname, "debug"))
             Options::show_debug = true;
         else if (c == 'h' || !strcmp(optname, "help"))

=== modified file 'src/options.h'
--- src/options.h	2011-08-09 11:13:43 +0000
+++ src/options.h	2011-09-20 09:45:24 +0000
@@ -36,6 +36,7 @@ 
     static bool swap_buffers;
     static std::pair<int,int> size;
     static bool list_scenes;
+    static bool show_all_options;
     static bool show_debug;
     static bool show_help;
 };

=== modified file 'src/scene.cpp'
--- src/scene.cpp	2011-09-15 09:04:17 +0000
+++ src/scene.cpp	2011-09-20 09:45:24 +0000
@@ -24,6 +24,7 @@ 
 #include "scene.h"
 #include "log.h"
 #include "shader-source.h"
+#include "options.h"
 #include <sstream>
 #include <cmath>
 #include <sys/time.h>
@@ -119,6 +120,7 @@ 
         return false;
 
     iter->second.value = val;
+    iter->second.set = true;
 
     return true;
 }
@@ -133,6 +135,7 @@ 
         Option &opt = iter->second;
 
         opt.value = opt.default_value;
+        opt.set = false;
     }
 }
 
@@ -160,8 +163,14 @@ 
              iter != mOptions.end();
              iter++)
         {
-            ss << iter->first << "=" << iter->second.value << ":";
+            if (Options::show_all_options || iter->second.set)
+            {
+                ss << iter->first << "=" << iter->second.value << ":";
+            }
         }
+
+        if (ss.str().empty())
+            ss << "<default>:";
     }
     else
         ss << title;

=== modified file 'src/scene.h'
--- src/scene.h	2011-09-16 11:49:57 +0000
+++ src/scene.h	2011-09-20 09:45:24 +0000
@@ -46,12 +46,13 @@ 
 
     struct Option {
         Option(const std::string &nam, const std::string &val, const std::string &desc) :
-            name(nam), value(val), default_value(val), description(desc) {}
+            name(nam), value(val), default_value(val), description(desc), set(false) {}
         Option() {}
         std::string name;
         std::string value;
         std::string default_value;
         std::string description;
+        bool set;
     };
 
     enum ValidationResult {