aboutsummaryrefslogtreecommitdiff
path: root/tests/box2d
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-04-25 19:48:54 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-04-25 21:32:43 -0700
commitd239ec265a345fdfdc2f12d9ffa149bfd15ca4e9 (patch)
tree14f270c362936f071359b00418a21d3090803167 /tests/box2d
parent46630aa446c6e984c5e3c745bf36cb7fa555c309 (diff)
standardize benchmark inputs
Diffstat (limited to 'tests/box2d')
-rw-r--r--tests/box2d/Benchmark.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/tests/box2d/Benchmark.cpp b/tests/box2d/Benchmark.cpp
index 8ebf0457..b8ebdf1c 100644
--- a/tests/box2d/Benchmark.cpp
+++ b/tests/box2d/Benchmark.cpp
@@ -10,8 +10,8 @@
// Turn this on to include the y-position of the top box in the output.
#define DEBUG 0
-#define WARMUP 64
-#define FRAMES 333
+int WARMUP;
+int FRAMES;
typedef struct {
float mean;
@@ -52,7 +52,16 @@ result_t measure(clock_t times[FRAMES]) {
return r;
}
-int main() {
+int main(int argc, char **argv) {
+ int arg = argc > 1 ? argv[1][0] - '0' : 1;
+ switch(arg) {
+ case 0: WARMUP = 32; FRAMES = 161; break;
+ case 1: WARMUP = 64; FRAMES = 333; break;
+ case 2: WARMUP = 5*64; FRAMES = 7*333; break;
+ case 3: WARMUP = 10*64; FRAMES = 17*333; break;
+ default: printf("error: %d\\n", arg); return -1;
+ }
+
// Define the gravity vector.
b2Vec2 gravity(0.0f, -10.0f);