diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2011-09-09 21:46:42 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2011-09-09 21:46:42 +0100 |
commit | 483e9d62e4b04f72e541fe562e34c7afb420c93e (patch) | |
tree | c6759cd1891e1238b9055e9ed8d42dbe77c68602 /demo.c | |
parent | f690e0d165148d36bd7b5fca2497e81424086787 (diff) |
And example benchmarking mode for the tiger
Diffstat (limited to 'demo.c')
-rw-r--r-- | demo.c | 23 |
1 files changed, 22 insertions, 1 deletions
@@ -16,7 +16,8 @@ int device_get_size(int argc, char **argv, int *width, int *height) return 1; } } else if (strcmp (argv[n], "--size") == 0) { - if (sscanf (argv[++n], "%dx%d", &w, &h) == 2) { + if (n + 1 < argc && + sscanf (argv[++n], "%dx%d", &w, &h) == 2) { *width = w; *height = h; return 1; @@ -27,6 +28,26 @@ int device_get_size(int argc, char **argv, int *width, int *height) return 0; } +int device_get_benchmark(int argc, char **argv) +{ + int n, count; + + count = -1; + for (n = 1; n < argc; n++) { + if (strncmp (argv[n], "--benchmark=", 12) == 0) { + return atoi(argv[n]+12); + } else if (strcmp (argv[n], "--benchmark") == 0) { + if (n + 1 < argc) + return atoi(argv[++n]); + else + return 0; + } + } + + return count; +} + + struct device *device_open(int argc, char **argv) { struct device *device = 0; |