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>
This commit is contained in:
Родитель
226f62fdd5
Коммит
e61078a0c8
|
@ -20,8 +20,8 @@
|
||||||
#define ALIGN(x, a) __ALIGN_MASK(x, (typeof(x))(a)-1)
|
#define ALIGN(x, a) __ALIGN_MASK(x, (typeof(x))(a)-1)
|
||||||
#define __ALIGN_MASK(x, mask) (((x)+(mask))&~(mask))
|
#define __ALIGN_MASK(x, mask) (((x)+(mask))&~(mask))
|
||||||
|
|
||||||
static int default_interval = 100000;
|
static long default_interval = 100000;
|
||||||
static int event_count[MAX_COUNTERS];
|
static long event_count[MAX_COUNTERS];
|
||||||
|
|
||||||
static int fd[MAX_NR_CPUS][MAX_COUNTERS];
|
static int fd[MAX_NR_CPUS][MAX_COUNTERS];
|
||||||
static int nr_cpus = 0;
|
static int nr_cpus = 0;
|
||||||
|
@ -494,7 +494,7 @@ static const struct option options[] = {
|
||||||
"append to the output file to do incremental profiling"),
|
"append to the output file to do incremental profiling"),
|
||||||
OPT_BOOLEAN('f', "force", &force,
|
OPT_BOOLEAN('f', "force", &force,
|
||||||
"overwrite existing data file"),
|
"overwrite existing data file"),
|
||||||
OPT_INTEGER('c', "count", &default_interval,
|
OPT_LONG('c', "count", &default_interval,
|
||||||
"event period to sample"),
|
"event period to sample"),
|
||||||
OPT_STRING('o', "output", &output_name, "file",
|
OPT_STRING('o', "output", &output_name, "file",
|
||||||
"output file name"),
|
"output file name"),
|
||||||
|
|
|
@ -113,6 +113,22 @@ static int get_value(struct parse_opt_ctx_t *p,
|
||||||
return opterror(opt, "expects a numerical value", flags);
|
return opterror(opt, "expects a numerical value", flags);
|
||||||
return 0;
|
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:
|
default:
|
||||||
die("should not happen, someone must be hit on the forehead");
|
die("should not happen, someone must be hit on the forehead");
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ enum parse_opt_type {
|
||||||
/* options with arguments (usually) */
|
/* options with arguments (usually) */
|
||||||
OPTION_STRING,
|
OPTION_STRING,
|
||||||
OPTION_INTEGER,
|
OPTION_INTEGER,
|
||||||
|
OPTION_LONG,
|
||||||
OPTION_CALLBACK,
|
OPTION_CALLBACK,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -97,6 +98,7 @@ struct option {
|
||||||
#define OPT_SET_INT(s, l, v, h, i) { OPTION_SET_INT, (s), (l), (v), NULL, (h), 0, NULL, (i) }
|
#define OPT_SET_INT(s, l, v, h, i) { OPTION_SET_INT, (s), (l), (v), NULL, (h), 0, NULL, (i) }
|
||||||
#define OPT_SET_PTR(s, l, v, h, p) { OPTION_SET_PTR, (s), (l), (v), NULL, (h), 0, NULL, (p) }
|
#define OPT_SET_PTR(s, l, v, h, p) { OPTION_SET_PTR, (s), (l), (v), NULL, (h), 0, NULL, (p) }
|
||||||
#define OPT_INTEGER(s, l, v, h) { OPTION_INTEGER, (s), (l), (v), NULL, (h) }
|
#define OPT_INTEGER(s, l, v, h) { OPTION_INTEGER, (s), (l), (v), NULL, (h) }
|
||||||
|
#define OPT_LONG(s, l, v, h) { OPTION_LONG, (s), (l), (v), NULL, (h) }
|
||||||
#define OPT_STRING(s, l, v, a, h) { OPTION_STRING, (s), (l), (v), (a), (h) }
|
#define OPT_STRING(s, l, v, a, h) { OPTION_STRING, (s), (l), (v), (a), (h) }
|
||||||
#define OPT_DATE(s, l, v, h) \
|
#define OPT_DATE(s, l, v, h) \
|
||||||
{ OPTION_CALLBACK, (s), (l), (v), "time",(h), 0, \
|
{ OPTION_CALLBACK, (s), (l), (v), "time",(h), 0, \
|
||||||
|
|
Загрузка…
Ссылка в новой задаче