aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/bench/sched-messaging.c6
-rw-r--r--tools/perf/builtin-record.c8
-rw-r--r--tools/perf/builtin-sched.c6
-rw-r--r--tools/perf/builtin-top.c5
-rw-r--r--tools/perf/util/include/linux/kernel.h2
-rw-r--r--tools/perf/util/parse-options.h8
6 files changed, 18 insertions, 17 deletions
diff --git a/tools/perf/bench/sched-messaging.c b/tools/perf/bench/sched-messaging.c
index da1b2e9f01ff..d1d1b30f99c1 100644
--- a/tools/perf/bench/sched-messaging.c
+++ b/tools/perf/bench/sched-messaging.c
@@ -256,10 +256,8 @@ static const struct option options[] = {
256 "Use pipe() instead of socketpair()"), 256 "Use pipe() instead of socketpair()"),
257 OPT_BOOLEAN('t', "thread", &thread_mode, 257 OPT_BOOLEAN('t', "thread", &thread_mode,
258 "Be multi thread instead of multi process"), 258 "Be multi thread instead of multi process"),
259 OPT_INTEGER('g', "group", &num_groups, 259 OPT_UINTEGER('g', "group", &num_groups, "Specify number of groups"),
260 "Specify number of groups"), 260 OPT_UINTEGER('l', "loop", &loops, "Specify number of loops"),
261 OPT_INTEGER('l', "loop", &loops,
262 "Specify number of loops"),
263 OPT_END() 261 OPT_END()
264}; 262};
265 263
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index b93573c7ac0b..cb46c7d0ea99 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -45,7 +45,7 @@ static int output;
45static int pipe_output = 0; 45static int pipe_output = 0;
46static const char *output_name = "perf.data"; 46static const char *output_name = "perf.data";
47static int group = 0; 47static int group = 0;
48static unsigned int realtime_prio = 0; 48static int realtime_prio = 0;
49static bool raw_samples = false; 49static bool raw_samples = false;
50static bool system_wide = false; 50static bool system_wide = false;
51static int profile_cpu = -1; 51static int profile_cpu = -1;
@@ -822,10 +822,8 @@ static const struct option options[] = {
822 "output file name"), 822 "output file name"),
823 OPT_BOOLEAN('i', "no-inherit", &no_inherit, 823 OPT_BOOLEAN('i', "no-inherit", &no_inherit,
824 "child tasks do not inherit counters"), 824 "child tasks do not inherit counters"),
825 OPT_INTEGER('F', "freq", &user_freq, 825 OPT_UINTEGER('F', "freq", &user_freq, "profile at this frequency"),
826 "profile at this frequency"), 826 OPT_UINTEGER('m', "mmap-pages", &mmap_pages, "number of mmap data pages"),
827 OPT_INTEGER('m', "mmap-pages", &mmap_pages,
828 "number of mmap data pages"),
829 OPT_BOOLEAN('g', "call-graph", &call_graph, 827 OPT_BOOLEAN('g', "call-graph", &call_graph,
830 "do call-graph (stack chain/backtrace) recording"), 828 "do call-graph (stack chain/backtrace) recording"),
831 OPT_INCR('v', "verbose", &verbose, 829 OPT_INCR('v', "verbose", &verbose,
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index be7bc9264710..c80acdf927a7 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -105,7 +105,7 @@ static u64 sum_runtime;
105static u64 sum_fluct; 105static u64 sum_fluct;
106static u64 run_avg; 106static u64 run_avg;
107 107
108static unsigned long replay_repeat = 10; 108static unsigned int replay_repeat = 10;
109static unsigned long nr_timestamps; 109static unsigned long nr_timestamps;
110static unsigned long nr_unordered_timestamps; 110static unsigned long nr_unordered_timestamps;
111static unsigned long nr_state_machine_bugs; 111static unsigned long nr_state_machine_bugs;
@@ -1816,8 +1816,8 @@ static const char * const replay_usage[] = {
1816}; 1816};
1817 1817
1818static const struct option replay_options[] = { 1818static const struct option replay_options[] = {
1819 OPT_INTEGER('r', "repeat", &replay_repeat, 1819 OPT_UINTEGER('r', "repeat", &replay_repeat,
1820 "repeat the workload replay N times (-1: infinite)"), 1820 "repeat the workload replay N times (-1: infinite)"),
1821 OPT_INCR('v', "verbose", &verbose, 1821 OPT_INCR('v', "verbose", &verbose,
1822 "be more verbose (show symbol address, etc)"), 1822 "be more verbose (show symbol address, etc)"),
1823 OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, 1823 OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index ed9b5b6905fa..9f0cfa0108a6 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -71,7 +71,7 @@ static int thread_num = 0;
71static bool inherit = false; 71static bool inherit = false;
72static int profile_cpu = -1; 72static int profile_cpu = -1;
73static int nr_cpus = 0; 73static int nr_cpus = 0;
74static unsigned int realtime_prio = 0; 74static int realtime_prio = 0;
75static bool group = false; 75static bool group = false;
76static unsigned int page_size; 76static unsigned int page_size;
77static unsigned int mmap_pages = 16; 77static unsigned int mmap_pages = 16;
@@ -1357,8 +1357,7 @@ static const struct option options[] = {
1357 "file", "vmlinux pathname"), 1357 "file", "vmlinux pathname"),
1358 OPT_BOOLEAN('K', "hide_kernel_symbols", &hide_kernel_symbols, 1358 OPT_BOOLEAN('K', "hide_kernel_symbols", &hide_kernel_symbols,
1359 "hide kernel symbols"), 1359 "hide kernel symbols"),
1360 OPT_INTEGER('m', "mmap-pages", &mmap_pages, 1360 OPT_UINTEGER('m', "mmap-pages", &mmap_pages, "number of mmap data pages"),
1361 "number of mmap data pages"),
1362 OPT_INTEGER('r', "realtime", &realtime_prio, 1361 OPT_INTEGER('r', "realtime", &realtime_prio,
1363 "collect data with this RT SCHED_FIFO priority"), 1362 "collect data with this RT SCHED_FIFO priority"),
1364 OPT_INTEGER('d', "delay", &delay_secs, 1363 OPT_INTEGER('d', "delay", &delay_secs,
diff --git a/tools/perf/util/include/linux/kernel.h b/tools/perf/util/include/linux/kernel.h
index 388ab1bfd114..1eb804fd3fbf 100644
--- a/tools/perf/util/include/linux/kernel.h
+++ b/tools/perf/util/include/linux/kernel.h
@@ -28,6 +28,8 @@
28 (type *)((char *)__mptr - offsetof(type, member)); }) 28 (type *)((char *)__mptr - offsetof(type, member)); })
29#endif 29#endif
30 30
31#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
32
31#ifndef max 33#ifndef max
32#define max(x, y) ({ \ 34#define max(x, y) ({ \
33 typeof(x) _max1 = (x); \ 35 typeof(x) _max1 = (x); \
diff --git a/tools/perf/util/parse-options.h b/tools/perf/util/parse-options.h
index c6aa4eed5edc..9ca348e1063b 100644
--- a/tools/perf/util/parse-options.h
+++ b/tools/perf/util/parse-options.h
@@ -1,6 +1,8 @@
1#ifndef __PERF_PARSE_OPTIONS_H 1#ifndef __PERF_PARSE_OPTIONS_H
2#define __PERF_PARSE_OPTIONS_H 2#define __PERF_PARSE_OPTIONS_H
3 3
4#include <linux/kernel.h>
5
4enum parse_opt_type { 6enum parse_opt_type {
5 /* special types */ 7 /* special types */
6 OPTION_END, 8 OPTION_END,
@@ -93,6 +95,8 @@ struct option {
93 intptr_t defval; 95 intptr_t defval;
94}; 96};
95 97
98#define check_vtype(v, type) ( BUILD_BUG_ON_ZERO(!__builtin_types_compatible_p(typeof(v), type)) + v )
99
96#define OPT_END() { .type = OPTION_END } 100#define OPT_END() { .type = OPTION_END }
97#define OPT_ARGUMENT(l, h) { .type = OPTION_ARGUMENT, .long_name = (l), .help = (h) } 101#define OPT_ARGUMENT(l, h) { .type = OPTION_ARGUMENT, .long_name = (l), .help = (h) }
98#define OPT_GROUP(h) { .type = OPTION_GROUP, .help = (h) } 102#define OPT_GROUP(h) { .type = OPTION_GROUP, .help = (h) }
@@ -101,8 +105,8 @@ struct option {
101#define OPT_INCR(s, l, v, h) { .type = OPTION_INCR, .short_name = (s), .long_name = (l), .value = (v), .help = (h) } 105#define OPT_INCR(s, l, v, h) { .type = OPTION_INCR, .short_name = (s), .long_name = (l), .value = (v), .help = (h) }
102#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) } 106#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) }
103#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) } 107#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) }
104#define OPT_INTEGER(s, l, v, h) { .type = OPTION_INTEGER, .short_name = (s), .long_name = (l), .value = (v), .help = (h) } 108#define OPT_INTEGER(s, l, v, h) { .type = OPTION_INTEGER, .short_name = (s), .long_name = (l), .value = check_vtype(v, int *), .help = (h) }
105#define OPT_UINTEGER(s, l, v, h) { .type = OPTION_UINTEGER, .short_name = (s), .long_name = (l), .value = (v), .help = (h) } 109#define OPT_UINTEGER(s, l, v, h) { .type = OPTION_UINTEGER, .short_name = (s), .long_name = (l), .value = check_vtype(v, unsigned int *), .help = (h) }
106#define OPT_LONG(s, l, v, h) { .type = OPTION_LONG, .short_name = (s), .long_name = (l), .value = (v), .help = (h) } 110#define OPT_LONG(s, l, v, h) { .type = OPTION_LONG, .short_name = (s), .long_name = (l), .value = (v), .help = (h) }
107#define OPT_U64(s, l, v, h) { .type = OPTION_U64, .short_name = (s), .long_name = (l), .value = (v), .help = (h) } 111#define OPT_U64(s, l, v, h) { .type = OPTION_U64, .short_name = (s), .long_name = (l), .value = (v), .help = (h) }
108#define OPT_STRING(s, l, v, a, h) { .type = OPTION_STRING, .short_name = (s), .long_name = (l), .value = (v), (a), .help = (h) } 112#define OPT_STRING(s, l, v, a, h) { .type = OPTION_STRING, .short_name = (s), .long_name = (l), .value = (v), (a), .help = (h) }