diff options
-rw-r--r-- | tools/perf/Documentation/perf-bench.txt | 4 | ||||
-rw-r--r-- | tools/perf/bench/bench.h | 1 | ||||
-rw-r--r-- | tools/perf/bench/futex-requeue.c | 10 | ||||
-rw-r--r-- | tools/perf/bench/futex-wake.c | 12 | ||||
-rw-r--r-- | tools/perf/bench/mem-memcpy.c | 5 | ||||
-rw-r--r-- | tools/perf/bench/mem-memset.c | 5 | ||||
-rw-r--r-- | tools/perf/bench/sched-messaging.c | 47 | ||||
-rw-r--r-- | tools/perf/builtin-bench.c | 7 | ||||
-rw-r--r-- | tools/perf/builtin-trace.c | 12 | ||||
-rw-r--r-- | tools/perf/ui/browser.c | 2 | ||||
-rw-r--r-- | tools/perf/ui/browsers/hists.c | 25 | ||||
-rw-r--r-- | tools/perf/util/evlist.c | 5 |
12 files changed, 67 insertions, 68 deletions
diff --git a/tools/perf/Documentation/perf-bench.txt b/tools/perf/Documentation/perf-bench.txt index 4464ad770d51..f6480cbf309b 100644 --- a/tools/perf/Documentation/perf-bench.txt +++ b/tools/perf/Documentation/perf-bench.txt | |||
@@ -16,6 +16,10 @@ This 'perf bench' command is a general framework for benchmark suites. | |||
16 | 16 | ||
17 | COMMON OPTIONS | 17 | COMMON OPTIONS |
18 | -------------- | 18 | -------------- |
19 | -r:: | ||
20 | --repeat=:: | ||
21 | Specify amount of times to repeat the run (default 10). | ||
22 | |||
19 | -f:: | 23 | -f:: |
20 | --format=:: | 24 | --format=:: |
21 | Specify format style. | 25 | Specify format style. |
diff --git a/tools/perf/bench/bench.h b/tools/perf/bench/bench.h index eba46709b279..3c4dd44d45cb 100644 --- a/tools/perf/bench/bench.h +++ b/tools/perf/bench/bench.h | |||
@@ -43,5 +43,6 @@ extern int bench_futex_requeue(int argc, const char **argv, const char *prefix); | |||
43 | #define BENCH_FORMAT_UNKNOWN -1 | 43 | #define BENCH_FORMAT_UNKNOWN -1 |
44 | 44 | ||
45 | extern int bench_format; | 45 | extern int bench_format; |
46 | extern unsigned int bench_repeat; | ||
46 | 47 | ||
47 | #endif | 48 | #endif |
diff --git a/tools/perf/bench/futex-requeue.c b/tools/perf/bench/futex-requeue.c index a16255876f1d..732403bfd31a 100644 --- a/tools/perf/bench/futex-requeue.c +++ b/tools/perf/bench/futex-requeue.c | |||
@@ -29,13 +29,6 @@ static u_int32_t futex1 = 0, futex2 = 0; | |||
29 | */ | 29 | */ |
30 | static unsigned int nrequeue = 1; | 30 | static unsigned int nrequeue = 1; |
31 | 31 | ||
32 | /* | ||
33 | * There can be significant variance from run to run, | ||
34 | * the more repeats, the more exact the overall avg and | ||
35 | * the better idea of the futex latency. | ||
36 | */ | ||
37 | static unsigned int repeat = 10; | ||
38 | |||
39 | static pthread_t *worker; | 32 | static pthread_t *worker; |
40 | static bool done = 0, silent = 0; | 33 | static bool done = 0, silent = 0; |
41 | static pthread_mutex_t thread_lock; | 34 | static pthread_mutex_t thread_lock; |
@@ -46,7 +39,6 @@ static unsigned int ncpus, threads_starting, nthreads = 0; | |||
46 | static const struct option options[] = { | 39 | static const struct option options[] = { |
47 | OPT_UINTEGER('t', "threads", &nthreads, "Specify amount of threads"), | 40 | OPT_UINTEGER('t', "threads", &nthreads, "Specify amount of threads"), |
48 | OPT_UINTEGER('q', "nrequeue", &nrequeue, "Specify amount of threads to requeue at once"), | 41 | OPT_UINTEGER('q', "nrequeue", &nrequeue, "Specify amount of threads to requeue at once"), |
49 | OPT_UINTEGER('r', "repeat", &repeat, "Specify amount of times to repeat the run"), | ||
50 | OPT_BOOLEAN( 's', "silent", &silent, "Silent mode: do not display data/details"), | 42 | OPT_BOOLEAN( 's', "silent", &silent, "Silent mode: do not display data/details"), |
51 | OPT_END() | 43 | OPT_END() |
52 | }; | 44 | }; |
@@ -146,7 +138,7 @@ int bench_futex_requeue(int argc, const char **argv, | |||
146 | pthread_cond_init(&thread_parent, NULL); | 138 | pthread_cond_init(&thread_parent, NULL); |
147 | pthread_cond_init(&thread_worker, NULL); | 139 | pthread_cond_init(&thread_worker, NULL); |
148 | 140 | ||
149 | for (j = 0; j < repeat && !done; j++) { | 141 | for (j = 0; j < bench_repeat && !done; j++) { |
150 | unsigned int nrequeued = 0; | 142 | unsigned int nrequeued = 0; |
151 | struct timeval start, end, runtime; | 143 | struct timeval start, end, runtime; |
152 | 144 | ||
diff --git a/tools/perf/bench/futex-wake.c b/tools/perf/bench/futex-wake.c index d096169b161e..50022cbce87e 100644 --- a/tools/perf/bench/futex-wake.c +++ b/tools/perf/bench/futex-wake.c | |||
@@ -30,15 +30,8 @@ static u_int32_t futex1 = 0; | |||
30 | */ | 30 | */ |
31 | static unsigned int nwakes = 1; | 31 | static unsigned int nwakes = 1; |
32 | 32 | ||
33 | /* | ||
34 | * There can be significant variance from run to run, | ||
35 | * the more repeats, the more exact the overall avg and | ||
36 | * the better idea of the futex latency. | ||
37 | */ | ||
38 | static unsigned int repeat = 10; | ||
39 | |||
40 | pthread_t *worker; | 33 | pthread_t *worker; |
41 | static bool done = 0, silent = 0; | 34 | static bool done = false, silent = false; |
42 | static pthread_mutex_t thread_lock; | 35 | static pthread_mutex_t thread_lock; |
43 | static pthread_cond_t thread_parent, thread_worker; | 36 | static pthread_cond_t thread_parent, thread_worker; |
44 | static struct stats waketime_stats, wakeup_stats; | 37 | static struct stats waketime_stats, wakeup_stats; |
@@ -47,7 +40,6 @@ static unsigned int ncpus, threads_starting, nthreads = 0; | |||
47 | static const struct option options[] = { | 40 | static const struct option options[] = { |
48 | OPT_UINTEGER('t', "threads", &nthreads, "Specify amount of threads"), | 41 | OPT_UINTEGER('t', "threads", &nthreads, "Specify amount of threads"), |
49 | OPT_UINTEGER('w', "nwakes", &nwakes, "Specify amount of threads to wake at once"), | 42 | OPT_UINTEGER('w', "nwakes", &nwakes, "Specify amount of threads to wake at once"), |
50 | OPT_UINTEGER('r', "repeat", &repeat, "Specify amount of times to repeat the run"), | ||
51 | OPT_BOOLEAN( 's', "silent", &silent, "Silent mode: do not display data/details"), | 43 | OPT_BOOLEAN( 's', "silent", &silent, "Silent mode: do not display data/details"), |
52 | OPT_END() | 44 | OPT_END() |
53 | }; | 45 | }; |
@@ -149,7 +141,7 @@ int bench_futex_wake(int argc, const char **argv, | |||
149 | pthread_cond_init(&thread_parent, NULL); | 141 | pthread_cond_init(&thread_parent, NULL); |
150 | pthread_cond_init(&thread_worker, NULL); | 142 | pthread_cond_init(&thread_worker, NULL); |
151 | 143 | ||
152 | for (j = 0; j < repeat && !done; j++) { | 144 | for (j = 0; j < bench_repeat && !done; j++) { |
153 | unsigned int nwoken = 0; | 145 | unsigned int nwoken = 0; |
154 | struct timeval start, end, runtime; | 146 | struct timeval start, end, runtime; |
155 | 147 | ||
diff --git a/tools/perf/bench/mem-memcpy.c b/tools/perf/bench/mem-memcpy.c index 5ce71d3b72cf..e622c3e96efc 100644 --- a/tools/perf/bench/mem-memcpy.c +++ b/tools/perf/bench/mem-memcpy.c | |||
@@ -189,6 +189,11 @@ int bench_mem_memcpy(int argc, const char **argv, | |||
189 | argc = parse_options(argc, argv, options, | 189 | argc = parse_options(argc, argv, options, |
190 | bench_mem_memcpy_usage, 0); | 190 | bench_mem_memcpy_usage, 0); |
191 | 191 | ||
192 | if (no_prefault && only_prefault) { | ||
193 | fprintf(stderr, "Invalid options: -o and -n are mutually exclusive\n"); | ||
194 | return 1; | ||
195 | } | ||
196 | |||
192 | if (use_cycle) | 197 | if (use_cycle) |
193 | init_cycle(); | 198 | init_cycle(); |
194 | 199 | ||
diff --git a/tools/perf/bench/mem-memset.c b/tools/perf/bench/mem-memset.c index 9af79d2b18e5..2a65468619f0 100644 --- a/tools/perf/bench/mem-memset.c +++ b/tools/perf/bench/mem-memset.c | |||
@@ -181,6 +181,11 @@ int bench_mem_memset(int argc, const char **argv, | |||
181 | argc = parse_options(argc, argv, options, | 181 | argc = parse_options(argc, argv, options, |
182 | bench_mem_memset_usage, 0); | 182 | bench_mem_memset_usage, 0); |
183 | 183 | ||
184 | if (no_prefault && only_prefault) { | ||
185 | fprintf(stderr, "Invalid options: -o and -n are mutually exclusive\n"); | ||
186 | return 1; | ||
187 | } | ||
188 | |||
184 | if (use_cycle) | 189 | if (use_cycle) |
185 | init_cycle(); | 190 | init_cycle(); |
186 | 191 | ||
diff --git a/tools/perf/bench/sched-messaging.c b/tools/perf/bench/sched-messaging.c index cc1190a0849b..52a56599a543 100644 --- a/tools/perf/bench/sched-messaging.c +++ b/tools/perf/bench/sched-messaging.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <sys/time.h> | 28 | #include <sys/time.h> |
29 | #include <sys/poll.h> | 29 | #include <sys/poll.h> |
30 | #include <limits.h> | 30 | #include <limits.h> |
31 | #include <err.h> | ||
31 | 32 | ||
32 | #define DATASIZE 100 | 33 | #define DATASIZE 100 |
33 | 34 | ||
@@ -50,12 +51,6 @@ struct receiver_context { | |||
50 | int wakefd; | 51 | int wakefd; |
51 | }; | 52 | }; |
52 | 53 | ||
53 | static void barf(const char *msg) | ||
54 | { | ||
55 | fprintf(stderr, "%s (error: %s)\n", msg, strerror(errno)); | ||
56 | exit(1); | ||
57 | } | ||
58 | |||
59 | static void fdpair(int fds[2]) | 54 | static void fdpair(int fds[2]) |
60 | { | 55 | { |
61 | if (use_pipes) { | 56 | if (use_pipes) { |
@@ -66,7 +61,7 @@ static void fdpair(int fds[2]) | |||
66 | return; | 61 | return; |
67 | } | 62 | } |
68 | 63 | ||
69 | barf(use_pipes ? "pipe()" : "socketpair()"); | 64 | err(EXIT_FAILURE, use_pipes ? "pipe()" : "socketpair()"); |
70 | } | 65 | } |
71 | 66 | ||
72 | /* Block until we're ready to go */ | 67 | /* Block until we're ready to go */ |
@@ -77,11 +72,11 @@ static void ready(int ready_out, int wakefd) | |||
77 | 72 | ||
78 | /* Tell them we're ready. */ | 73 | /* Tell them we're ready. */ |
79 | if (write(ready_out, &dummy, 1) != 1) | 74 | if (write(ready_out, &dummy, 1) != 1) |
80 | barf("CLIENT: ready write"); | 75 | err(EXIT_FAILURE, "CLIENT: ready write"); |
81 | 76 | ||
82 | /* Wait for "GO" signal */ | 77 | /* Wait for "GO" signal */ |
83 | if (poll(&pollfd, 1, -1) != 1) | 78 | if (poll(&pollfd, 1, -1) != 1) |
84 | barf("poll"); | 79 | err(EXIT_FAILURE, "poll"); |
85 | } | 80 | } |
86 | 81 | ||
87 | /* Sender sprays loops messages down each file descriptor */ | 82 | /* Sender sprays loops messages down each file descriptor */ |
@@ -101,7 +96,7 @@ again: | |||
101 | ret = write(ctx->out_fds[j], data + done, | 96 | ret = write(ctx->out_fds[j], data + done, |
102 | sizeof(data)-done); | 97 | sizeof(data)-done); |
103 | if (ret < 0) | 98 | if (ret < 0) |
104 | barf("SENDER: write"); | 99 | err(EXIT_FAILURE, "SENDER: write"); |
105 | done += ret; | 100 | done += ret; |
106 | if (done < DATASIZE) | 101 | if (done < DATASIZE) |
107 | goto again; | 102 | goto again; |
@@ -131,7 +126,7 @@ static void *receiver(struct receiver_context* ctx) | |||
131 | again: | 126 | again: |
132 | ret = read(ctx->in_fds[0], data + done, DATASIZE - done); | 127 | ret = read(ctx->in_fds[0], data + done, DATASIZE - done); |
133 | if (ret < 0) | 128 | if (ret < 0) |
134 | barf("SERVER: read"); | 129 | err(EXIT_FAILURE, "SERVER: read"); |
135 | done += ret; | 130 | done += ret; |
136 | if (done < DATASIZE) | 131 | if (done < DATASIZE) |
137 | goto again; | 132 | goto again; |
@@ -144,14 +139,14 @@ static pthread_t create_worker(void *ctx, void *(*func)(void *)) | |||
144 | { | 139 | { |
145 | pthread_attr_t attr; | 140 | pthread_attr_t attr; |
146 | pthread_t childid; | 141 | pthread_t childid; |
147 | int err; | 142 | int ret; |
148 | 143 | ||
149 | if (!thread_mode) { | 144 | if (!thread_mode) { |
150 | /* process mode */ | 145 | /* process mode */ |
151 | /* Fork the receiver. */ | 146 | /* Fork the receiver. */ |
152 | switch (fork()) { | 147 | switch (fork()) { |
153 | case -1: | 148 | case -1: |
154 | barf("fork()"); | 149 | err(EXIT_FAILURE, "fork()"); |
155 | break; | 150 | break; |
156 | case 0: | 151 | case 0: |
157 | (*func) (ctx); | 152 | (*func) (ctx); |
@@ -165,19 +160,17 @@ static pthread_t create_worker(void *ctx, void *(*func)(void *)) | |||
165 | } | 160 | } |
166 | 161 | ||
167 | if (pthread_attr_init(&attr) != 0) | 162 | if (pthread_attr_init(&attr) != 0) |
168 | barf("pthread_attr_init:"); | 163 | err(EXIT_FAILURE, "pthread_attr_init:"); |
169 | 164 | ||
170 | #ifndef __ia64__ | 165 | #ifndef __ia64__ |
171 | if (pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN) != 0) | 166 | if (pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN) != 0) |
172 | barf("pthread_attr_setstacksize"); | 167 | err(EXIT_FAILURE, "pthread_attr_setstacksize"); |
173 | #endif | 168 | #endif |
174 | 169 | ||
175 | err = pthread_create(&childid, &attr, func, ctx); | 170 | ret = pthread_create(&childid, &attr, func, ctx); |
176 | if (err != 0) { | 171 | if (ret != 0) |
177 | fprintf(stderr, "pthread_create failed: %s (%d)\n", | 172 | err(EXIT_FAILURE, "pthread_create failed"); |
178 | strerror(err), err); | 173 | |
179 | exit(-1); | ||
180 | } | ||
181 | return childid; | 174 | return childid; |
182 | } | 175 | } |
183 | 176 | ||
@@ -207,14 +200,14 @@ static unsigned int group(pthread_t *pth, | |||
207 | + num_fds * sizeof(int)); | 200 | + num_fds * sizeof(int)); |
208 | 201 | ||
209 | if (!snd_ctx) | 202 | if (!snd_ctx) |
210 | barf("malloc()"); | 203 | err(EXIT_FAILURE, "malloc()"); |
211 | 204 | ||
212 | for (i = 0; i < num_fds; i++) { | 205 | for (i = 0; i < num_fds; i++) { |
213 | int fds[2]; | 206 | int fds[2]; |
214 | struct receiver_context *ctx = malloc(sizeof(*ctx)); | 207 | struct receiver_context *ctx = malloc(sizeof(*ctx)); |
215 | 208 | ||
216 | if (!ctx) | 209 | if (!ctx) |
217 | barf("malloc()"); | 210 | err(EXIT_FAILURE, "malloc()"); |
218 | 211 | ||
219 | 212 | ||
220 | /* Create the pipe between client and server */ | 213 | /* Create the pipe between client and server */ |
@@ -281,7 +274,7 @@ int bench_sched_messaging(int argc, const char **argv, | |||
281 | 274 | ||
282 | pth_tab = malloc(num_fds * 2 * num_groups * sizeof(pthread_t)); | 275 | pth_tab = malloc(num_fds * 2 * num_groups * sizeof(pthread_t)); |
283 | if (!pth_tab) | 276 | if (!pth_tab) |
284 | barf("main:malloc()"); | 277 | err(EXIT_FAILURE, "main:malloc()"); |
285 | 278 | ||
286 | fdpair(readyfds); | 279 | fdpair(readyfds); |
287 | fdpair(wakefds); | 280 | fdpair(wakefds); |
@@ -294,13 +287,13 @@ int bench_sched_messaging(int argc, const char **argv, | |||
294 | /* Wait for everyone to be ready */ | 287 | /* Wait for everyone to be ready */ |
295 | for (i = 0; i < total_children; i++) | 288 | for (i = 0; i < total_children; i++) |
296 | if (read(readyfds[0], &dummy, 1) != 1) | 289 | if (read(readyfds[0], &dummy, 1) != 1) |
297 | barf("Reading for readyfds"); | 290 | err(EXIT_FAILURE, "Reading for readyfds"); |
298 | 291 | ||
299 | gettimeofday(&start, NULL); | 292 | gettimeofday(&start, NULL); |
300 | 293 | ||
301 | /* Kick them off */ | 294 | /* Kick them off */ |
302 | if (write(wakefds[1], &dummy, 1) != 1) | 295 | if (write(wakefds[1], &dummy, 1) != 1) |
303 | barf("Writing to start them"); | 296 | err(EXIT_FAILURE, "Writing to start them"); |
304 | 297 | ||
305 | /* Reap them all */ | 298 | /* Reap them all */ |
306 | for (i = 0; i < total_children; i++) | 299 | for (i = 0; i < total_children; i++) |
@@ -332,5 +325,7 @@ int bench_sched_messaging(int argc, const char **argv, | |||
332 | break; | 325 | break; |
333 | } | 326 | } |
334 | 327 | ||
328 | free(pth_tab); | ||
329 | |||
335 | return 0; | 330 | return 0; |
336 | } | 331 | } |
diff --git a/tools/perf/builtin-bench.c b/tools/perf/builtin-bench.c index 1e6e77710545..b9a56fa83330 100644 --- a/tools/perf/builtin-bench.c +++ b/tools/perf/builtin-bench.c | |||
@@ -104,9 +104,11 @@ static const char *bench_format_str; | |||
104 | 104 | ||
105 | /* Output/formatting style, exported to benchmark modules: */ | 105 | /* Output/formatting style, exported to benchmark modules: */ |
106 | int bench_format = BENCH_FORMAT_DEFAULT; | 106 | int bench_format = BENCH_FORMAT_DEFAULT; |
107 | unsigned int bench_repeat = 10; /* default number of times to repeat the run */ | ||
107 | 108 | ||
108 | static const struct option bench_options[] = { | 109 | static const struct option bench_options[] = { |
109 | OPT_STRING('f', "format", &bench_format_str, "default", "Specify format style"), | 110 | OPT_STRING('f', "format", &bench_format_str, "default", "Specify format style"), |
111 | OPT_UINTEGER('r', "repeat", &bench_repeat, "Specify amount of times to repeat the run"), | ||
110 | OPT_END() | 112 | OPT_END() |
111 | }; | 113 | }; |
112 | 114 | ||
@@ -226,6 +228,11 @@ int cmd_bench(int argc, const char **argv, const char *prefix __maybe_unused) | |||
226 | goto end; | 228 | goto end; |
227 | } | 229 | } |
228 | 230 | ||
231 | if (bench_repeat == 0) { | ||
232 | printf("Invalid repeat option: Must specify a positive value\n"); | ||
233 | goto end; | ||
234 | } | ||
235 | |||
229 | if (argc < 1) { | 236 | if (argc < 1) { |
230 | print_usage(); | 237 | print_usage(); |
231 | goto end; | 238 | goto end; |
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index f954c26de231..5549cee61680 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c | |||
@@ -1108,6 +1108,7 @@ struct syscall { | |||
1108 | struct event_format *tp_format; | 1108 | struct event_format *tp_format; |
1109 | const char *name; | 1109 | const char *name; |
1110 | bool filtered; | 1110 | bool filtered; |
1111 | bool is_exit; | ||
1111 | struct syscall_fmt *fmt; | 1112 | struct syscall_fmt *fmt; |
1112 | size_t (**arg_scnprintf)(char *bf, size_t size, struct syscall_arg *arg); | 1113 | size_t (**arg_scnprintf)(char *bf, size_t size, struct syscall_arg *arg); |
1113 | void **arg_parm; | 1114 | void **arg_parm; |
@@ -1276,11 +1277,11 @@ static const char *thread__fd_path(struct thread *thread, int fd, | |||
1276 | if (fd < 0) | 1277 | if (fd < 0) |
1277 | return NULL; | 1278 | return NULL; |
1278 | 1279 | ||
1279 | if ((fd > ttrace->paths.max || ttrace->paths.table[fd] == NULL)) | 1280 | if ((fd > ttrace->paths.max || ttrace->paths.table[fd] == NULL)) { |
1280 | if (!trace->live) | 1281 | if (!trace->live) |
1281 | return NULL; | 1282 | return NULL; |
1282 | ++trace->stats.proc_getname; | 1283 | ++trace->stats.proc_getname; |
1283 | if (thread__read_fd_path(thread, fd)) { | 1284 | if (thread__read_fd_path(thread, fd)) |
1284 | return NULL; | 1285 | return NULL; |
1285 | } | 1286 | } |
1286 | 1287 | ||
@@ -1473,6 +1474,8 @@ static int trace__read_syscall_info(struct trace *trace, int id) | |||
1473 | if (sc->tp_format == NULL) | 1474 | if (sc->tp_format == NULL) |
1474 | return -1; | 1475 | return -1; |
1475 | 1476 | ||
1477 | sc->is_exit = !strcmp(name, "exit_group") || !strcmp(name, "exit"); | ||
1478 | |||
1476 | return syscall__set_arg_fmts(sc); | 1479 | return syscall__set_arg_fmts(sc); |
1477 | } | 1480 | } |
1478 | 1481 | ||
@@ -1629,7 +1632,6 @@ static int trace__sys_enter(struct trace *trace, struct perf_evsel *evsel, | |||
1629 | return -1; | 1632 | return -1; |
1630 | 1633 | ||
1631 | args = perf_evsel__sc_tp_ptr(evsel, args, sample); | 1634 | args = perf_evsel__sc_tp_ptr(evsel, args, sample); |
1632 | ttrace = thread->priv; | ||
1633 | 1635 | ||
1634 | if (ttrace->entry_str == NULL) { | 1636 | if (ttrace->entry_str == NULL) { |
1635 | ttrace->entry_str = malloc(1024); | 1637 | ttrace->entry_str = malloc(1024); |
@@ -1644,7 +1646,7 @@ static int trace__sys_enter(struct trace *trace, struct perf_evsel *evsel, | |||
1644 | printed += syscall__scnprintf_args(sc, msg + printed, 1024 - printed, | 1646 | printed += syscall__scnprintf_args(sc, msg + printed, 1024 - printed, |
1645 | args, trace, thread); | 1647 | args, trace, thread); |
1646 | 1648 | ||
1647 | if (!strcmp(sc->name, "exit_group") || !strcmp(sc->name, "exit")) { | 1649 | if (sc->is_exit) { |
1648 | if (!trace->duration_filter && !trace->summary_only) { | 1650 | if (!trace->duration_filter && !trace->summary_only) { |
1649 | trace__fprintf_entry_head(trace, thread, 1, sample->time, trace->output); | 1651 | trace__fprintf_entry_head(trace, thread, 1, sample->time, trace->output); |
1650 | fprintf(trace->output, "%-70s\n", ttrace->entry_str); | 1652 | fprintf(trace->output, "%-70s\n", ttrace->entry_str); |
@@ -1687,8 +1689,6 @@ static int trace__sys_exit(struct trace *trace, struct perf_evsel *evsel, | |||
1687 | ++trace->stats.vfs_getname; | 1689 | ++trace->stats.vfs_getname; |
1688 | } | 1690 | } |
1689 | 1691 | ||
1690 | ttrace = thread->priv; | ||
1691 | |||
1692 | ttrace->exit_time = sample->time; | 1692 | ttrace->exit_time = sample->time; |
1693 | 1693 | ||
1694 | if (ttrace->entry_time) { | 1694 | if (ttrace->entry_time) { |
diff --git a/tools/perf/ui/browser.c b/tools/perf/ui/browser.c index 3ccf6e14f89b..9d2294efc00c 100644 --- a/tools/perf/ui/browser.c +++ b/tools/perf/ui/browser.c | |||
@@ -279,7 +279,7 @@ static void ui_browser__scrollbar_set(struct ui_browser *browser) | |||
279 | { | 279 | { |
280 | int height = browser->height, h = 0, pct = 0, | 280 | int height = browser->height, h = 0, pct = 0, |
281 | col = browser->width, | 281 | col = browser->width, |
282 | row = browser->y - 1; | 282 | row = 0; |
283 | 283 | ||
284 | if (browser->nr_entries > 1) { | 284 | if (browser->nr_entries > 1) { |
285 | pct = ((browser->index * (browser->height - 1)) / | 285 | pct = ((browser->index * (browser->height - 1)) / |
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c index 04a229aa5c0f..2185091c5227 100644 --- a/tools/perf/ui/browsers/hists.c +++ b/tools/perf/ui/browsers/hists.c | |||
@@ -33,8 +33,7 @@ struct hist_browser { | |||
33 | 33 | ||
34 | extern void hist_browser__init_hpp(void); | 34 | extern void hist_browser__init_hpp(void); |
35 | 35 | ||
36 | static int hists__browser_title(struct hists *hists, char *bf, size_t size, | 36 | static int hists__browser_title(struct hists *hists, char *bf, size_t size); |
37 | const char *ev_name); | ||
38 | static void hist_browser__update_nr_entries(struct hist_browser *hb); | 37 | static void hist_browser__update_nr_entries(struct hist_browser *hb); |
39 | 38 | ||
40 | static struct rb_node *hists__filter_entries(struct rb_node *nd, | 39 | static struct rb_node *hists__filter_entries(struct rb_node *nd, |
@@ -346,7 +345,7 @@ static void ui_browser__warn_lost_events(struct ui_browser *browser) | |||
346 | "Or reduce the sampling frequency."); | 345 | "Or reduce the sampling frequency."); |
347 | } | 346 | } |
348 | 347 | ||
349 | static int hist_browser__run(struct hist_browser *browser, const char *ev_name, | 348 | static int hist_browser__run(struct hist_browser *browser, |
350 | struct hist_browser_timer *hbt) | 349 | struct hist_browser_timer *hbt) |
351 | { | 350 | { |
352 | int key; | 351 | int key; |
@@ -357,7 +356,7 @@ static int hist_browser__run(struct hist_browser *browser, const char *ev_name, | |||
357 | browser->b.nr_entries = hist_browser__nr_entries(browser); | 356 | browser->b.nr_entries = hist_browser__nr_entries(browser); |
358 | 357 | ||
359 | hist_browser__refresh_dimensions(browser); | 358 | hist_browser__refresh_dimensions(browser); |
360 | hists__browser_title(browser->hists, title, sizeof(title), ev_name); | 359 | hists__browser_title(browser->hists, title, sizeof(title)); |
361 | 360 | ||
362 | if (ui_browser__show(&browser->b, title, | 361 | if (ui_browser__show(&browser->b, title, |
363 | "Press '?' for help on key bindings") < 0) | 362 | "Press '?' for help on key bindings") < 0) |
@@ -384,7 +383,7 @@ static int hist_browser__run(struct hist_browser *browser, const char *ev_name, | |||
384 | ui_browser__warn_lost_events(&browser->b); | 383 | ui_browser__warn_lost_events(&browser->b); |
385 | } | 384 | } |
386 | 385 | ||
387 | hists__browser_title(browser->hists, title, sizeof(title), ev_name); | 386 | hists__browser_title(browser->hists, title, sizeof(title)); |
388 | ui_browser__show_title(&browser->b, title); | 387 | ui_browser__show_title(&browser->b, title); |
389 | continue; | 388 | continue; |
390 | } | 389 | } |
@@ -1213,8 +1212,7 @@ static struct thread *hist_browser__selected_thread(struct hist_browser *browser | |||
1213 | return browser->he_selection->thread; | 1212 | return browser->he_selection->thread; |
1214 | } | 1213 | } |
1215 | 1214 | ||
1216 | static int hists__browser_title(struct hists *hists, char *bf, size_t size, | 1215 | static int hists__browser_title(struct hists *hists, char *bf, size_t size) |
1217 | const char *ev_name) | ||
1218 | { | 1216 | { |
1219 | char unit; | 1217 | char unit; |
1220 | int printed; | 1218 | int printed; |
@@ -1223,6 +1221,7 @@ static int hists__browser_title(struct hists *hists, char *bf, size_t size, | |||
1223 | unsigned long nr_samples = hists->stats.nr_events[PERF_RECORD_SAMPLE]; | 1221 | unsigned long nr_samples = hists->stats.nr_events[PERF_RECORD_SAMPLE]; |
1224 | u64 nr_events = hists->stats.total_period; | 1222 | u64 nr_events = hists->stats.total_period; |
1225 | struct perf_evsel *evsel = hists_to_evsel(hists); | 1223 | struct perf_evsel *evsel = hists_to_evsel(hists); |
1224 | const char *ev_name = perf_evsel__name(evsel); | ||
1226 | char buf[512]; | 1225 | char buf[512]; |
1227 | size_t buflen = sizeof(buf); | 1226 | size_t buflen = sizeof(buf); |
1228 | 1227 | ||
@@ -1390,7 +1389,7 @@ static void hist_browser__update_nr_entries(struct hist_browser *hb) | |||
1390 | } | 1389 | } |
1391 | 1390 | ||
1392 | static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events, | 1391 | static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events, |
1393 | const char *helpline, const char *ev_name, | 1392 | const char *helpline, |
1394 | bool left_exits, | 1393 | bool left_exits, |
1395 | struct hist_browser_timer *hbt, | 1394 | struct hist_browser_timer *hbt, |
1396 | float min_pcnt, | 1395 | float min_pcnt, |
@@ -1465,7 +1464,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events, | |||
1465 | 1464 | ||
1466 | nr_options = 0; | 1465 | nr_options = 0; |
1467 | 1466 | ||
1468 | key = hist_browser__run(browser, ev_name, hbt); | 1467 | key = hist_browser__run(browser, hbt); |
1469 | 1468 | ||
1470 | if (browser->he_selection != NULL) { | 1469 | if (browser->he_selection != NULL) { |
1471 | thread = hist_browser__selected_thread(browser); | 1470 | thread = hist_browser__selected_thread(browser); |
@@ -1843,7 +1842,7 @@ static int perf_evsel_menu__run(struct perf_evsel_menu *menu, | |||
1843 | { | 1842 | { |
1844 | struct perf_evlist *evlist = menu->b.priv; | 1843 | struct perf_evlist *evlist = menu->b.priv; |
1845 | struct perf_evsel *pos; | 1844 | struct perf_evsel *pos; |
1846 | const char *ev_name, *title = "Available samples"; | 1845 | const char *title = "Available samples"; |
1847 | int delay_secs = hbt ? hbt->refresh : 0; | 1846 | int delay_secs = hbt ? hbt->refresh : 0; |
1848 | int key; | 1847 | int key; |
1849 | 1848 | ||
@@ -1876,9 +1875,8 @@ browse_hists: | |||
1876 | */ | 1875 | */ |
1877 | if (hbt) | 1876 | if (hbt) |
1878 | hbt->timer(hbt->arg); | 1877 | hbt->timer(hbt->arg); |
1879 | ev_name = perf_evsel__name(pos); | ||
1880 | key = perf_evsel__hists_browse(pos, nr_events, help, | 1878 | key = perf_evsel__hists_browse(pos, nr_events, help, |
1881 | ev_name, true, hbt, | 1879 | true, hbt, |
1882 | menu->min_pcnt, | 1880 | menu->min_pcnt, |
1883 | menu->env); | 1881 | menu->env); |
1884 | ui_browser__show_title(&menu->b, title); | 1882 | ui_browser__show_title(&menu->b, title); |
@@ -1982,10 +1980,9 @@ int perf_evlist__tui_browse_hists(struct perf_evlist *evlist, const char *help, | |||
1982 | single_entry: | 1980 | single_entry: |
1983 | if (nr_entries == 1) { | 1981 | if (nr_entries == 1) { |
1984 | struct perf_evsel *first = perf_evlist__first(evlist); | 1982 | struct perf_evsel *first = perf_evlist__first(evlist); |
1985 | const char *ev_name = perf_evsel__name(first); | ||
1986 | 1983 | ||
1987 | return perf_evsel__hists_browse(first, nr_entries, help, | 1984 | return perf_evsel__hists_browse(first, nr_entries, help, |
1988 | ev_name, false, hbt, min_pcnt, | 1985 | false, hbt, min_pcnt, |
1989 | env); | 1986 | env); |
1990 | } | 1987 | } |
1991 | 1988 | ||
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index 59ef2802fcf6..c51223ac25f4 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c | |||
@@ -1214,10 +1214,11 @@ int perf_evlist__strerror_open(struct perf_evlist *evlist __maybe_unused, | |||
1214 | "For your workloads it needs to be <= 1\nHint:\t"); | 1214 | "For your workloads it needs to be <= 1\nHint:\t"); |
1215 | } | 1215 | } |
1216 | printed += scnprintf(buf + printed, size - printed, | 1216 | printed += scnprintf(buf + printed, size - printed, |
1217 | "For system wide tracing it needs to be set to -1"); | 1217 | "For system wide tracing it needs to be set to -1.\n"); |
1218 | 1218 | ||
1219 | printed += scnprintf(buf + printed, size - printed, | 1219 | printed += scnprintf(buf + printed, size - printed, |
1220 | ".\nHint:\tThe current value is %d.", value); | 1220 | "Hint:\tTry: 'sudo sh -c \"echo -1 > /proc/sys/kernel/perf_event_paranoid\"'\n" |
1221 | "Hint:\tThe current value is %d.", value); | ||
1221 | break; | 1222 | break; |
1222 | default: | 1223 | default: |
1223 | scnprintf(buf, size, "%s", emsg); | 1224 | scnprintf(buf, size, "%s", emsg); |