summaryrefslogtreecommitdiff
path: root/demo.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-09-09 21:46:42 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2011-09-09 21:46:42 +0100
commit483e9d62e4b04f72e541fe562e34c7afb420c93e (patch)
treec6759cd1891e1238b9055e9ed8d42dbe77c68602 /demo.c
parentf690e0d165148d36bd7b5fca2497e81424086787 (diff)
And example benchmarking mode for the tiger
Diffstat (limited to 'demo.c')
-rw-r--r--demo.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/demo.c b/demo.c
index 5f6874d..11b363d 100644
--- a/demo.c
+++ b/demo.c
@@ -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;