summaryrefslogtreecommitdiffstats
path: root/Documentation/perf_counter/util/parse-options.c
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2009-06-03 11:24:33 +0200
committerIngo Molnar <mingo@elte.hu>2009-06-03 14:14:31 +0200
commite61078a0c88773d3465b0b9d665c5ed6b952b1cf (patch)
tree3a6bc9823f9ca6e8da2f21e0e9eb2063530bde63 /Documentation/perf_counter/util/parse-options.c
parent226f62fdd53d5b2c74e242aa11f6ad43d0285d3f (diff)
downloadop-kernel-dev-e61078a0c88773d3465b0b9d665c5ed6b952b1cf.zip
op-kernel-dev-e61078a0c88773d3465b0b9d665c5ed6b952b1cf.tar.gz
perf record: Use long arg for counter period
I wrote this to test the extended period emulation, we might as well merge it. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: Marcelo Tosatti <mtosatti@redhat.com> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: John Kacur <jkacur@redhat.com> LKML-Reference: <new-submission> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'Documentation/perf_counter/util/parse-options.c')
-rw-r--r--Documentation/perf_counter/util/parse-options.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/Documentation/perf_counter/util/parse-options.c b/Documentation/perf_counter/util/parse-options.c
index 28b34c1..b80abd9 100644
--- a/Documentation/perf_counter/util/parse-options.c
+++ b/Documentation/perf_counter/util/parse-options.c
@@ -113,6 +113,22 @@ static int get_value(struct parse_opt_ctx_t *p,
return opterror(opt, "expects a numerical value", flags);
return 0;
+ case OPTION_LONG:
+ if (unset) {
+ *(long *)opt->value = 0;
+ return 0;
+ }
+ if (opt->flags & PARSE_OPT_OPTARG && !p->opt) {
+ *(long *)opt->value = opt->defval;
+ return 0;
+ }
+ if (get_arg(p, opt, flags, &arg))
+ return -1;
+ *(long *)opt->value = strtol(arg, (char **)&s, 10);
+ if (*s)
+ return opterror(opt, "expects a numerical value", flags);
+ return 0;
+
default:
die("should not happen, someone must be hit on the forehead");
}
OpenPOWER on IntegriCloud