Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 147627
b: refs/heads/master
c: e61078a
h: refs/heads/master
i:
  147625: 50e6f3e
  147623: 776327b
v: v3
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Jun 3, 2009
1 parent 3c41b9b commit 7471b15
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 226f62fdd53d5b2c74e242aa11f6ad43d0285d3f
refs/heads/master: e61078a0c88773d3465b0b9d665c5ed6b952b1cf
6 changes: 3 additions & 3 deletions trunk/Documentation/perf_counter/builtin-record.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
#define ALIGN(x, a) __ALIGN_MASK(x, (typeof(x))(a)-1)
#define __ALIGN_MASK(x, mask) (((x)+(mask))&~(mask))

static int default_interval = 100000;
static int event_count[MAX_COUNTERS];
static long default_interval = 100000;
static long event_count[MAX_COUNTERS];

static int fd[MAX_NR_CPUS][MAX_COUNTERS];
static int nr_cpus = 0;
Expand Down Expand Up @@ -494,7 +494,7 @@ static const struct option options[] = {
"append to the output file to do incremental profiling"),
OPT_BOOLEAN('f', "force", &force,
"overwrite existing data file"),
OPT_INTEGER('c', "count", &default_interval,
OPT_LONG('c', "count", &default_interval,
"event period to sample"),
OPT_STRING('o', "output", &output_name, "file",
"output file name"),
Expand Down
16 changes: 16 additions & 0 deletions trunk/Documentation/perf_counter/util/parse-options.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down
2 changes: 2 additions & 0 deletions trunk/Documentation/perf_counter/util/parse-options.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ enum parse_opt_type {
/* options with arguments (usually) */
OPTION_STRING,
OPTION_INTEGER,
OPTION_LONG,
OPTION_CALLBACK,
};

Expand Down Expand Up @@ -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_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_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_DATE(s, l, v, h) \
{ OPTION_CALLBACK, (s), (l), (v), "time",(h), 0, \
Expand Down

0 comments on commit 7471b15

Please sign in to comment.