MainLoop,Options: Add --run-forever command-line option.
diff --git a/src/main-loop.cpp b/src/main-loop.cpp
index 8256510..33d1272 100644
--- a/src/main-loop.cpp
+++ b/src/main-loop.cpp
@@ -74,7 +74,7 @@
             else
                 break;
 
-            bench_iter_++;
+            next_benchmark();
         }
 
         /* If we have found a valid scene, set it up */
@@ -106,7 +106,7 @@
         log_scene_result();
         (*bench_iter_)->teardown_scene();
         scene_ = 0;
-        bench_iter_++;
+        next_benchmark();
         benchmarks_run_++;
     }
 
@@ -138,6 +138,14 @@
     Log::info(format.c_str(), scene_->average_fps());
 }
 
+void
+MainLoop::next_benchmark()
+{
+    bench_iter_++;
+    if (bench_iter_ == benchmarks_.end() && Options::run_forever)
+        bench_iter_ = benchmarks_.begin();
+}
+
 /**********************
  * MainLoopDecoration *
  **********************/
diff --git a/src/main-loop.h b/src/main-loop.h
index d904bdb..fbdfa57 100644
--- a/src/main-loop.h
+++ b/src/main-loop.h
@@ -84,6 +84,7 @@
     virtual void log_scene_result();
 
 protected:
+    void next_benchmark();
     Canvas &canvas_;
     Scene *scene_;
     const std::vector<Benchmark *> &benchmarks_;
diff --git a/src/options.cpp b/src/options.cpp
index 3b9be6e..fe89c0a 100644
--- a/src/options.cpp
+++ b/src/options.cpp
@@ -40,6 +40,7 @@
 bool Options::show_debug = false;
 bool Options::show_help = false;
 bool Options::reuse_context = false;
+bool Options::run_forever = false;
 
 static struct option long_options[] = {
     {"benchmark", 1, 0, 0},
@@ -47,6 +48,7 @@
     {"validate", 0, 0, 0},
     {"no-swap-buffers", 0, 0, 0},
     {"reuse-context", 0, 0, 0},
+    {"run-forever", 0, 0, 0},
     {"size", 1, 0, 0},
     {"list-scenes", 0, 0, 0},
     {"show-all-options", 0, 0, 0},
@@ -101,6 +103,8 @@
            "                         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"
+           "      --run-forever      Run indefinitely, looping from the last benchmark\n"
+           "                         back to the first\n"
            "  -d, --debug            Display debug messages\n"
            "  -h, --help             Display help\n");
 }
@@ -139,6 +143,8 @@
             Options::list_scenes = true;
         else if (!strcmp(optname, "show-all-options"))
             Options::show_all_options = true;
+        else if (!strcmp(optname, "run-forever"))
+            Options::run_forever = true;
         else if (c == 'd' || !strcmp(optname, "debug"))
             Options::show_debug = true;
         else if (c == 'h' || !strcmp(optname, "help"))
diff --git a/src/options.h b/src/options.h
index afaf931..1907d5d 100644
--- a/src/options.h
+++ b/src/options.h
@@ -41,6 +41,7 @@
     static bool show_debug;
     static bool show_help;
     static bool reuse_context;
+    static bool run_forever;
 };
 
 #endif /* OPTIONS_H_ */