diff options
| author | Bryce Harrington <b.harrington@samsung.com> | 2013-12-10 16:32:40 -0800 |
|---|---|---|
| committer | Bryce Harrington <b.harrington@samsung.com> | 2013-12-10 16:32:40 -0800 |
| commit | ff76fef936eb0d5e2912819be21a7a415b761127 (patch) | |
| tree | ad431f3a1c6966b8dfaf1ad35b1851293b8371ed /src | |
| parent | ef0f3ebc348b523fd823154a4ab34fc323530494 (diff) | |
Add --version
Diffstat (limited to 'src')
| -rw-r--r-- | src/caskbench.cpp | 22 | ||||
| -rw-r--r-- | src/caskbench.h | 2 |
2 files changed, 20 insertions, 4 deletions
diff --git a/src/caskbench.cpp b/src/caskbench.cpp index 4f6b1bf..3809839 100644 --- a/src/caskbench.cpp +++ b/src/caskbench.cpp @@ -23,9 +23,10 @@ typedef struct _caskbench_options { int dry_run; int iterations; int list_surfaces; - int size; char* output_file; char* surface_type; + int size; + int version; } caskbench_options_t; typedef struct _caskbench_perf_test { @@ -145,6 +146,14 @@ _status_to_string(int result) } static void +print_version() +{ + printf("%s version %s\n", + PACKAGE_NAME, + PACKAGE_VERSION); +} + +static void print_surfaces_available() { printf("image\n"); @@ -174,11 +183,14 @@ process_options(caskbench_options_t *opt, int argc, char *argv[]) {"output-file", 'o', POPT_ARG_STRING, &opt->output_file, 0, "Filename to write JSON output to", NULL}, + {"surface-type", 't', POPT_ARG_STRING, &opt->surface_type, 0, + "Type of graphics surface to use (see --list-surfaces for available surfaces)", + NULL}, {"test-size", 's', POPT_ARG_INT, &opt->size, 0, "Controls the complexity of the tests, such as number of drawn elements", NULL}, - {"surface-type", 't', POPT_ARG_STRING, &opt->surface_type, 0, - "Type of graphics surface to use (see --list-surfaces for available surfaces)", + {"version", 'V', POPT_ARG_NONE, &opt->version, 0, + "Display the program version", NULL}, POPT_AUTOHELP {NULL} @@ -252,6 +264,10 @@ main (int argc, char *argv[]) process_options(&opt, argc, argv); + if (opt.version) { + print_version(); + exit(0); + } if (opt.list_surfaces) { print_surfaces_available(); exit(0); diff --git a/src/caskbench.h b/src/caskbench.h index 86cabd2..88c5eea 100644 --- a/src/caskbench.h +++ b/src/caskbench.h @@ -1,4 +1,4 @@ -#ifndef __CASKBENCH_H__ // -*- mode: c++ -*- +#ifndef __CASKBENCH_H__ // -*- mode: c++ -*- #define __CASKBENCH_H__ #ifndef M_PI |