diff options
Diffstat (limited to 'tools/perf/util')
-rw-r--r-- | tools/perf/util/debug.c | 2 | ||||
-rw-r--r-- | tools/perf/util/debug.h | 3 | ||||
-rw-r--r-- | tools/perf/util/parse-options.c | 6 | ||||
-rw-r--r-- | tools/perf/util/parse-options.h | 4 | ||||
-rw-r--r-- | tools/perf/util/trace-event-parse.c | 2 | ||||
-rw-r--r-- | tools/perf/util/trace-event.h | 3 |
6 files changed, 15 insertions, 5 deletions
diff --git a/tools/perf/util/debug.c b/tools/perf/util/debug.c index 033d66db863a..dd824cf3b628 100644 --- a/tools/perf/util/debug.c +++ b/tools/perf/util/debug.c | |||
@@ -13,7 +13,7 @@ | |||
13 | #include "util.h" | 13 | #include "util.h" |
14 | 14 | ||
15 | int verbose = 0; | 15 | int verbose = 0; |
16 | int dump_trace = 0; | 16 | bool dump_trace = false; |
17 | 17 | ||
18 | int eprintf(int level, const char *fmt, ...) | 18 | int eprintf(int level, const char *fmt, ...) |
19 | { | 19 | { |
diff --git a/tools/perf/util/debug.h b/tools/perf/util/debug.h index 5cb0a1b1401a..047ac3324ebe 100644 --- a/tools/perf/util/debug.h +++ b/tools/perf/util/debug.h | |||
@@ -2,10 +2,11 @@ | |||
2 | #ifndef __PERF_DEBUG_H | 2 | #ifndef __PERF_DEBUG_H |
3 | #define __PERF_DEBUG_H | 3 | #define __PERF_DEBUG_H |
4 | 4 | ||
5 | #include <stdbool.h> | ||
5 | #include "event.h" | 6 | #include "event.h" |
6 | 7 | ||
7 | extern int verbose; | 8 | extern int verbose; |
8 | extern int dump_trace; | 9 | extern bool dump_trace; |
9 | 10 | ||
10 | int dump_printf(const char *fmt, ...) __attribute__((format(printf, 1, 2))); | 11 | int dump_printf(const char *fmt, ...) __attribute__((format(printf, 1, 2))); |
11 | void trace_event(event_t *event); | 12 | void trace_event(event_t *event); |
diff --git a/tools/perf/util/parse-options.c b/tools/perf/util/parse-options.c index 79dfa0c34b3c..ed887642460c 100644 --- a/tools/perf/util/parse-options.c +++ b/tools/perf/util/parse-options.c | |||
@@ -49,6 +49,7 @@ static int get_value(struct parse_opt_ctx_t *p, | |||
49 | break; | 49 | break; |
50 | /* FALLTHROUGH */ | 50 | /* FALLTHROUGH */ |
51 | case OPTION_BOOLEAN: | 51 | case OPTION_BOOLEAN: |
52 | case OPTION_INCR: | ||
52 | case OPTION_BIT: | 53 | case OPTION_BIT: |
53 | case OPTION_SET_INT: | 54 | case OPTION_SET_INT: |
54 | case OPTION_SET_PTR: | 55 | case OPTION_SET_PTR: |
@@ -73,6 +74,10 @@ static int get_value(struct parse_opt_ctx_t *p, | |||
73 | return 0; | 74 | return 0; |
74 | 75 | ||
75 | case OPTION_BOOLEAN: | 76 | case OPTION_BOOLEAN: |
77 | *(bool *)opt->value = unset ? false : true; | ||
78 | return 0; | ||
79 | |||
80 | case OPTION_INCR: | ||
76 | *(int *)opt->value = unset ? 0 : *(int *)opt->value + 1; | 81 | *(int *)opt->value = unset ? 0 : *(int *)opt->value + 1; |
77 | return 0; | 82 | return 0; |
78 | 83 | ||
@@ -478,6 +483,7 @@ int usage_with_options_internal(const char * const *usagestr, | |||
478 | case OPTION_GROUP: | 483 | case OPTION_GROUP: |
479 | case OPTION_BIT: | 484 | case OPTION_BIT: |
480 | case OPTION_BOOLEAN: | 485 | case OPTION_BOOLEAN: |
486 | case OPTION_INCR: | ||
481 | case OPTION_SET_INT: | 487 | case OPTION_SET_INT: |
482 | case OPTION_SET_PTR: | 488 | case OPTION_SET_PTR: |
483 | case OPTION_LONG: | 489 | case OPTION_LONG: |
diff --git a/tools/perf/util/parse-options.h b/tools/perf/util/parse-options.h index 948805af43c2..b2da725f102a 100644 --- a/tools/perf/util/parse-options.h +++ b/tools/perf/util/parse-options.h | |||
@@ -8,7 +8,8 @@ enum parse_opt_type { | |||
8 | OPTION_GROUP, | 8 | OPTION_GROUP, |
9 | /* options with no arguments */ | 9 | /* options with no arguments */ |
10 | OPTION_BIT, | 10 | OPTION_BIT, |
11 | OPTION_BOOLEAN, /* _INCR would have been a better name */ | 11 | OPTION_BOOLEAN, |
12 | OPTION_INCR, | ||
12 | OPTION_SET_INT, | 13 | OPTION_SET_INT, |
13 | OPTION_SET_PTR, | 14 | OPTION_SET_PTR, |
14 | /* options with arguments (usually) */ | 15 | /* options with arguments (usually) */ |
@@ -95,6 +96,7 @@ struct option { | |||
95 | #define OPT_GROUP(h) { .type = OPTION_GROUP, .help = (h) } | 96 | #define OPT_GROUP(h) { .type = OPTION_GROUP, .help = (h) } |
96 | #define OPT_BIT(s, l, v, h, b) { .type = OPTION_BIT, .short_name = (s), .long_name = (l), .value = (v), .help = (h), .defval = (b) } | 97 | #define OPT_BIT(s, l, v, h, b) { .type = OPTION_BIT, .short_name = (s), .long_name = (l), .value = (v), .help = (h), .defval = (b) } |
97 | #define OPT_BOOLEAN(s, l, v, h) { .type = OPTION_BOOLEAN, .short_name = (s), .long_name = (l), .value = (v), .help = (h) } | 98 | #define OPT_BOOLEAN(s, l, v, h) { .type = OPTION_BOOLEAN, .short_name = (s), .long_name = (l), .value = (v), .help = (h) } |
99 | #define OPT_INCR(s, l, v, h) { .type = OPTION_INCR, .short_name = (s), .long_name = (l), .value = (v), .help = (h) } | ||
98 | #define OPT_SET_INT(s, l, v, h, i) { .type = OPTION_SET_INT, .short_name = (s), .long_name = (l), .value = (v), .help = (h), .defval = (i) } | 100 | #define OPT_SET_INT(s, l, v, h, i) { .type = OPTION_SET_INT, .short_name = (s), .long_name = (l), .value = (v), .help = (h), .defval = (i) } |
99 | #define OPT_SET_PTR(s, l, v, h, p) { .type = OPTION_SET_PTR, .short_name = (s), .long_name = (l), .value = (v), .help = (h), .defval = (p) } | 101 | #define OPT_SET_PTR(s, l, v, h, p) { .type = OPTION_SET_PTR, .short_name = (s), .long_name = (l), .value = (v), .help = (h), .defval = (p) } |
100 | #define OPT_INTEGER(s, l, v, h) { .type = OPTION_INTEGER, .short_name = (s), .long_name = (l), .value = (v), .help = (h) } | 102 | #define OPT_INTEGER(s, l, v, h) { .type = OPTION_INTEGER, .short_name = (s), .long_name = (l), .value = (v), .help = (h) } |
diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c index 3b81250ffedb..17d6d66ed766 100644 --- a/tools/perf/util/trace-event-parse.c +++ b/tools/perf/util/trace-event-parse.c | |||
@@ -42,7 +42,7 @@ int header_page_overwrite_size; | |||
42 | int header_page_data_offset; | 42 | int header_page_data_offset; |
43 | int header_page_data_size; | 43 | int header_page_data_size; |
44 | 44 | ||
45 | int latency_format; | 45 | bool latency_format; |
46 | 46 | ||
47 | static char *input_buf; | 47 | static char *input_buf; |
48 | static unsigned long long input_buf_ptr; | 48 | static unsigned long long input_buf_ptr; |
diff --git a/tools/perf/util/trace-event.h b/tools/perf/util/trace-event.h index c3269b937db4..81f2fd20a0ea 100644 --- a/tools/perf/util/trace-event.h +++ b/tools/perf/util/trace-event.h | |||
@@ -1,6 +1,7 @@ | |||
1 | #ifndef __PERF_TRACE_EVENTS_H | 1 | #ifndef __PERF_TRACE_EVENTS_H |
2 | #define __PERF_TRACE_EVENTS_H | 2 | #define __PERF_TRACE_EVENTS_H |
3 | 3 | ||
4 | #include <stdbool.h> | ||
4 | #include "parse-events.h" | 5 | #include "parse-events.h" |
5 | 6 | ||
6 | #define __unused __attribute__((unused)) | 7 | #define __unused __attribute__((unused)) |
@@ -241,7 +242,7 @@ extern int header_page_size_size; | |||
241 | extern int header_page_data_offset; | 242 | extern int header_page_data_offset; |
242 | extern int header_page_data_size; | 243 | extern int header_page_data_size; |
243 | 244 | ||
244 | extern int latency_format; | 245 | extern bool latency_format; |
245 | 246 | ||
246 | int parse_header_page(char *buf, unsigned long size); | 247 | int parse_header_page(char *buf, unsigned long size); |
247 | int trace_parse_common_type(void *data); | 248 | int trace_parse_common_type(void *data); |