aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2009-06-03 05:24:33 -0400
committerIngo Molnar <mingo@elte.hu>2009-06-03 08:14:31 -0400
commite61078a0c88773d3465b0b9d665c5ed6b952b1cf (patch)
tree3a6bc9823f9ca6e8da2f21e0e9eb2063530bde63
parent226f62fdd53d5b2c74e242aa11f6ad43d0285d3f (diff)
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>
-rw-r--r--Documentation/perf_counter/builtin-record.c6
-rw-r--r--Documentation/perf_counter/util/parse-options.c16
-rw-r--r--Documentation/perf_counter/util/parse-options.h2
3 files changed, 21 insertions, 3 deletions
diff --git a/Documentation/perf_counter/builtin-record.c b/Documentation/perf_counter/builtin-record.c
index ec3b73adbd9..cea5b8d3c63 100644
--- a/Documentation/perf_counter/builtin-record.c
+++ b/Documentation/perf_counter/builtin-record.c
@@ -20,8 +20,8 @@
20#define ALIGN(x, a) __ALIGN_MASK(x, (typeof(x))(a)-1) 20#define ALIGN(x, a) __ALIGN_MASK(x, (typeof(x))(a)-1)
21#define __ALIGN_MASK(x, mask) (((x)+(mask))&~(mask)) 21#define __ALIGN_MASK(x, mask) (((x)+(mask))&~(mask))
22 22
23static int default_interval = 100000; 23static long default_interval = 100000;
24static int event_count[MAX_COUNTERS]; 24static long event_count[MAX_COUNTERS];
25 25
26static int fd[MAX_NR_CPUS][MAX_COUNTERS]; 26static int fd[MAX_NR_CPUS][MAX_COUNTERS];
27static int nr_cpus = 0; 27static int nr_cpus = 0;
@@ -494,7 +494,7 @@ static const struct option options[] = {
494 "append to the output file to do incremental profiling"), 494 "append to the output file to do incremental profiling"),
495 OPT_BOOLEAN('f', "force", &force, 495 OPT_BOOLEAN('f', "force", &force,
496 "overwrite existing data file"), 496 "overwrite existing data file"),
497 OPT_INTEGER('c', "count", &default_interval, 497 OPT_LONG('c', "count", &default_interval,
498 "event period to sample"), 498 "event period to sample"),
499 OPT_STRING('o', "output", &output_name, "file", 499 OPT_STRING('o', "output", &output_name, "file",
500 "output file name"), 500 "output file name"),
diff --git a/Documentation/perf_counter/util/parse-options.c b/Documentation/perf_counter/util/parse-options.c
index 28b34c1c29c..b80abd9a99b 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,
113 return opterror(opt, "expects a numerical value", flags); 113 return opterror(opt, "expects a numerical value", flags);
114 return 0; 114 return 0;
115 115
116 case OPTION_LONG:
117 if (unset) {
118 *(long *)opt->value = 0;
119 return 0;
120 }
121 if (opt->flags & PARSE_OPT_OPTARG && !p->opt) {
122 *(long *)opt->value = opt->defval;
123 return 0;
124 }
125 if (get_arg(p, opt, flags, &arg))
126 return -1;
127 *(long *)opt->value = strtol(arg, (char **)&s, 10);
128 if (*s)
129 return opterror(opt, "expects a numerical value", flags);
130 return 0;
131
116 default: 132 default:
117 die("should not happen, someone must be hit on the forehead"); 133 die("should not happen, someone must be hit on the forehead");
118 } 134 }
diff --git a/Documentation/perf_counter/util/parse-options.h b/Documentation/perf_counter/util/parse-options.h
index a81c7faff68..a1039a6ce0e 100644
--- a/Documentation/perf_counter/util/parse-options.h
+++ b/Documentation/perf_counter/util/parse-options.h
@@ -14,6 +14,7 @@ enum parse_opt_type {
14 /* options with arguments (usually) */ 14 /* options with arguments (usually) */
15 OPTION_STRING, 15 OPTION_STRING,
16 OPTION_INTEGER, 16 OPTION_INTEGER,
17 OPTION_LONG,
17 OPTION_CALLBACK, 18 OPTION_CALLBACK,
18}; 19};
19 20
@@ -97,6 +98,7 @@ struct option {
97#define OPT_SET_INT(s, l, v, h, i) { OPTION_SET_INT, (s), (l), (v), NULL, (h), 0, NULL, (i) } 98#define OPT_SET_INT(s, l, v, h, i) { OPTION_SET_INT, (s), (l), (v), NULL, (h), 0, NULL, (i) }
98#define OPT_SET_PTR(s, l, v, h, p) { OPTION_SET_PTR, (s), (l), (v), NULL, (h), 0, NULL, (p) } 99#define OPT_SET_PTR(s, l, v, h, p) { OPTION_SET_PTR, (s), (l), (v), NULL, (h), 0, NULL, (p) }
99#define OPT_INTEGER(s, l, v, h) { OPTION_INTEGER, (s), (l), (v), NULL, (h) } 100#define OPT_INTEGER(s, l, v, h) { OPTION_INTEGER, (s), (l), (v), NULL, (h) }
101#define OPT_LONG(s, l, v, h) { OPTION_LONG, (s), (l), (v), NULL, (h) }
100#define OPT_STRING(s, l, v, a, h) { OPTION_STRING, (s), (l), (v), (a), (h) } 102#define OPT_STRING(s, l, v, a, h) { OPTION_STRING, (s), (l), (v), (a), (h) }
101#define OPT_DATE(s, l, v, h) \ 103#define OPT_DATE(s, l, v, h) \
102 { OPTION_CALLBACK, (s), (l), (v), "time",(h), 0, \ 104 { OPTION_CALLBACK, (s), (l), (v), "time",(h), 0, \