diff options
author | Ingo Molnar <mingo@kernel.org> | 2015-01-30 13:26:32 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2015-01-30 13:26:32 -0500 |
commit | 1ed39bac21c3c2934b18de34df9478ad7b8edf1f (patch) | |
tree | 7098b1f13486d538e522191c577c632d3c6cb37e /tools | |
parent | b3890e4704594fa23abe1395d1fafc97d3214be8 (diff) | |
parent | c52686f9f888d23ca72f1309e86af8e91d075697 (diff) |
Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:
User visible changes:
- Show precise number of samples in at the end of a 'record' session, if
processing build ids, since we will then traverse the whole perf.data file
and see all the PERF_RECORD_SAMPLE records, otherwise stop showing the
previous off-base heuristicly counted number of "samples" (Namhyung Kim).
- Support to read compressed module from build-id cache (Namhyung Kim)
Infrastructure changes:
- Cache eh/debug frame offset for dwarf unwind (Namhyung Kim)
- Set header version correctly in all cases (Namhyung Kim)
- Set attr.task bit for a tracking event, to be consistent (Namhyung Kim)
perf tools: Use perf_data_file__fd() consistently
perf symbols: Convert lseek + read to pread
- Don't rely on malloc working for sz 0, fixing another problem when
using uClibc (Vineet Gupta)
- Provide stub for missing pthread_attr_setaffinity_np for libcs where this
is not available, such as uClibc (Vineet Gupta)
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/bench/futex.h | 13 | ||||
-rw-r--r-- | tools/perf/builtin-inject.c | 5 | ||||
-rw-r--r-- | tools/perf/builtin-record.c | 70 | ||||
-rw-r--r-- | tools/perf/config/Makefile | 6 | ||||
-rw-r--r-- | tools/perf/config/feature-checks/Makefile | 4 | ||||
-rw-r--r-- | tools/perf/config/feature-checks/test-all.c | 5 | ||||
-rw-r--r-- | tools/perf/config/feature-checks/test-pthread-attr-setaffinity-np.c | 14 | ||||
-rw-r--r-- | tools/perf/util/dso.c | 6 | ||||
-rw-r--r-- | tools/perf/util/dso.h | 1 | ||||
-rw-r--r-- | tools/perf/util/evsel.c | 4 | ||||
-rw-r--r-- | tools/perf/util/header.c | 2 | ||||
-rw-r--r-- | tools/perf/util/session.c | 6 | ||||
-rw-r--r-- | tools/perf/util/session.h | 3 | ||||
-rw-r--r-- | tools/perf/util/symbol-elf.c | 13 | ||||
-rw-r--r-- | tools/perf/util/unwind-libunwind.c | 31 |
15 files changed, 131 insertions, 52 deletions
diff --git a/tools/perf/bench/futex.h b/tools/perf/bench/futex.h index 71f2844cf97f..7ed22ff1e1ac 100644 --- a/tools/perf/bench/futex.h +++ b/tools/perf/bench/futex.h | |||
@@ -68,4 +68,17 @@ futex_cmp_requeue(u_int32_t *uaddr, u_int32_t val, u_int32_t *uaddr2, int nr_wak | |||
68 | val, opflags); | 68 | val, opflags); |
69 | } | 69 | } |
70 | 70 | ||
71 | #ifndef HAVE_PTHREAD_ATTR_SETAFFINITY_NP | ||
72 | #include <pthread.h> | ||
73 | static inline int pthread_attr_setaffinity_np(pthread_attr_t *attr, | ||
74 | size_t cpusetsize, | ||
75 | cpu_set_t *cpuset) | ||
76 | { | ||
77 | attr = attr; | ||
78 | cpusetsize = cpusetsize; | ||
79 | cpuset = cpuset; | ||
80 | return 0; | ||
81 | } | ||
82 | #endif | ||
83 | |||
71 | #endif /* _FUTEX_H */ | 84 | #endif /* _FUTEX_H */ |
diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c index 84df2deed988..a13641e066f5 100644 --- a/tools/perf/builtin-inject.c +++ b/tools/perf/builtin-inject.c | |||
@@ -343,6 +343,7 @@ static int __cmd_inject(struct perf_inject *inject) | |||
343 | int ret = -EINVAL; | 343 | int ret = -EINVAL; |
344 | struct perf_session *session = inject->session; | 344 | struct perf_session *session = inject->session; |
345 | struct perf_data_file *file_out = &inject->output; | 345 | struct perf_data_file *file_out = &inject->output; |
346 | int fd = perf_data_file__fd(file_out); | ||
346 | 347 | ||
347 | signal(SIGINT, sig_handler); | 348 | signal(SIGINT, sig_handler); |
348 | 349 | ||
@@ -376,7 +377,7 @@ static int __cmd_inject(struct perf_inject *inject) | |||
376 | } | 377 | } |
377 | 378 | ||
378 | if (!file_out->is_pipe) | 379 | if (!file_out->is_pipe) |
379 | lseek(file_out->fd, session->header.data_offset, SEEK_SET); | 380 | lseek(fd, session->header.data_offset, SEEK_SET); |
380 | 381 | ||
381 | ret = perf_session__process_events(session, &inject->tool); | 382 | ret = perf_session__process_events(session, &inject->tool); |
382 | 383 | ||
@@ -385,7 +386,7 @@ static int __cmd_inject(struct perf_inject *inject) | |||
385 | perf_header__set_feat(&session->header, | 386 | perf_header__set_feat(&session->header, |
386 | HEADER_BUILD_ID); | 387 | HEADER_BUILD_ID); |
387 | session->header.data_size = inject->bytes_written; | 388 | session->header.data_size = inject->bytes_written; |
388 | perf_session__write_header(session, session->evlist, file_out->fd, true); | 389 | perf_session__write_header(session, session->evlist, fd, true); |
389 | } | 390 | } |
390 | 391 | ||
391 | return ret; | 392 | return ret; |
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 8648c6d3003d..404ab3434052 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -190,16 +190,30 @@ out: | |||
190 | return rc; | 190 | return rc; |
191 | } | 191 | } |
192 | 192 | ||
193 | static int process_sample_event(struct perf_tool *tool, | ||
194 | union perf_event *event, | ||
195 | struct perf_sample *sample, | ||
196 | struct perf_evsel *evsel, | ||
197 | struct machine *machine) | ||
198 | { | ||
199 | struct record *rec = container_of(tool, struct record, tool); | ||
200 | |||
201 | rec->samples++; | ||
202 | |||
203 | return build_id__mark_dso_hit(tool, event, sample, evsel, machine); | ||
204 | } | ||
205 | |||
193 | static int process_buildids(struct record *rec) | 206 | static int process_buildids(struct record *rec) |
194 | { | 207 | { |
195 | struct perf_data_file *file = &rec->file; | 208 | struct perf_data_file *file = &rec->file; |
196 | struct perf_session *session = rec->session; | 209 | struct perf_session *session = rec->session; |
197 | u64 start = session->header.data_offset; | ||
198 | 210 | ||
199 | u64 size = lseek(file->fd, 0, SEEK_CUR); | 211 | u64 size = lseek(perf_data_file__fd(file), 0, SEEK_CUR); |
200 | if (size == 0) | 212 | if (size == 0) |
201 | return 0; | 213 | return 0; |
202 | 214 | ||
215 | file->size = size; | ||
216 | |||
203 | /* | 217 | /* |
204 | * During this process, it'll load kernel map and replace the | 218 | * During this process, it'll load kernel map and replace the |
205 | * dso->long_name to a real pathname it found. In this case | 219 | * dso->long_name to a real pathname it found. In this case |
@@ -211,9 +225,7 @@ static int process_buildids(struct record *rec) | |||
211 | */ | 225 | */ |
212 | symbol_conf.ignore_vmlinux_buildid = true; | 226 | symbol_conf.ignore_vmlinux_buildid = true; |
213 | 227 | ||
214 | return __perf_session__process_events(session, start, | 228 | return perf_session__process_events(session, &rec->tool); |
215 | size - start, | ||
216 | size, &build_id__mark_dso_hit_ops); | ||
217 | } | 229 | } |
218 | 230 | ||
219 | static void perf_event__synthesize_guest_os(struct machine *machine, void *data) | 231 | static void perf_event__synthesize_guest_os(struct machine *machine, void *data) |
@@ -322,6 +334,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) | |||
322 | struct perf_data_file *file = &rec->file; | 334 | struct perf_data_file *file = &rec->file; |
323 | struct perf_session *session; | 335 | struct perf_session *session; |
324 | bool disabled = false, draining = false; | 336 | bool disabled = false, draining = false; |
337 | int fd; | ||
325 | 338 | ||
326 | rec->progname = argv[0]; | 339 | rec->progname = argv[0]; |
327 | 340 | ||
@@ -336,6 +349,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) | |||
336 | return -1; | 349 | return -1; |
337 | } | 350 | } |
338 | 351 | ||
352 | fd = perf_data_file__fd(file); | ||
339 | rec->session = session; | 353 | rec->session = session; |
340 | 354 | ||
341 | record__init_features(rec); | 355 | record__init_features(rec); |
@@ -360,12 +374,11 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) | |||
360 | perf_header__clear_feat(&session->header, HEADER_GROUP_DESC); | 374 | perf_header__clear_feat(&session->header, HEADER_GROUP_DESC); |
361 | 375 | ||
362 | if (file->is_pipe) { | 376 | if (file->is_pipe) { |
363 | err = perf_header__write_pipe(file->fd); | 377 | err = perf_header__write_pipe(fd); |
364 | if (err < 0) | 378 | if (err < 0) |
365 | goto out_child; | 379 | goto out_child; |
366 | } else { | 380 | } else { |
367 | err = perf_session__write_header(session, rec->evlist, | 381 | err = perf_session__write_header(session, rec->evlist, fd, false); |
368 | file->fd, false); | ||
369 | if (err < 0) | 382 | if (err < 0) |
370 | goto out_child; | 383 | goto out_child; |
371 | } | 384 | } |
@@ -397,7 +410,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) | |||
397 | * return this more properly and also | 410 | * return this more properly and also |
398 | * propagate errors that now are calling die() | 411 | * propagate errors that now are calling die() |
399 | */ | 412 | */ |
400 | err = perf_event__synthesize_tracing_data(tool, file->fd, rec->evlist, | 413 | err = perf_event__synthesize_tracing_data(tool, fd, rec->evlist, |
401 | process_synthesized_event); | 414 | process_synthesized_event); |
402 | if (err <= 0) { | 415 | if (err <= 0) { |
403 | pr_err("Couldn't record tracing data.\n"); | 416 | pr_err("Couldn't record tracing data.\n"); |
@@ -504,19 +517,9 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) | |||
504 | goto out_child; | 517 | goto out_child; |
505 | } | 518 | } |
506 | 519 | ||
507 | if (!quiet) { | 520 | if (!quiet) |
508 | fprintf(stderr, "[ perf record: Woken up %ld times to write data ]\n", waking); | 521 | fprintf(stderr, "[ perf record: Woken up %ld times to write data ]\n", waking); |
509 | 522 | ||
510 | /* | ||
511 | * Approximate RIP event size: 24 bytes. | ||
512 | */ | ||
513 | fprintf(stderr, | ||
514 | "[ perf record: Captured and wrote %.3f MB %s (~%" PRIu64 " samples) ]\n", | ||
515 | (double)rec->bytes_written / 1024.0 / 1024.0, | ||
516 | file->path, | ||
517 | rec->bytes_written / 24); | ||
518 | } | ||
519 | |||
520 | out_child: | 523 | out_child: |
521 | if (forks) { | 524 | if (forks) { |
522 | int exit_status; | 525 | int exit_status; |
@@ -535,13 +538,29 @@ out_child: | |||
535 | } else | 538 | } else |
536 | status = err; | 539 | status = err; |
537 | 540 | ||
541 | /* this will be recalculated during process_buildids() */ | ||
542 | rec->samples = 0; | ||
543 | |||
538 | if (!err && !file->is_pipe) { | 544 | if (!err && !file->is_pipe) { |
539 | rec->session->header.data_size += rec->bytes_written; | 545 | rec->session->header.data_size += rec->bytes_written; |
540 | 546 | ||
541 | if (!rec->no_buildid) | 547 | if (!rec->no_buildid) |
542 | process_buildids(rec); | 548 | process_buildids(rec); |
543 | perf_session__write_header(rec->session, rec->evlist, | 549 | perf_session__write_header(rec->session, rec->evlist, fd, true); |
544 | file->fd, true); | 550 | } |
551 | |||
552 | if (!err && !quiet) { | ||
553 | char samples[128]; | ||
554 | |||
555 | if (rec->samples) | ||
556 | scnprintf(samples, sizeof(samples), | ||
557 | " (%" PRIu64 " samples)", rec->samples); | ||
558 | else | ||
559 | samples[0] = '\0'; | ||
560 | |||
561 | fprintf(stderr, "[ perf record: Captured and wrote %.3f MB %s%s ]\n", | ||
562 | perf_data_file__size(file) / 1024.0 / 1024.0, | ||
563 | file->path, samples); | ||
545 | } | 564 | } |
546 | 565 | ||
547 | out_delete_session: | 566 | out_delete_session: |
@@ -720,6 +739,13 @@ static struct record record = { | |||
720 | .default_per_cpu = true, | 739 | .default_per_cpu = true, |
721 | }, | 740 | }, |
722 | }, | 741 | }, |
742 | .tool = { | ||
743 | .sample = process_sample_event, | ||
744 | .fork = perf_event__process_fork, | ||
745 | .comm = perf_event__process_comm, | ||
746 | .mmap = perf_event__process_mmap, | ||
747 | .mmap2 = perf_event__process_mmap2, | ||
748 | }, | ||
723 | }; | 749 | }; |
724 | 750 | ||
725 | #define CALLCHAIN_HELP "setup and enables call-graph (stack chain/backtrace) recording: " | 751 | #define CALLCHAIN_HELP "setup and enables call-graph (stack chain/backtrace) recording: " |
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile index 648e31ff4021..cc224080b525 100644 --- a/tools/perf/config/Makefile +++ b/tools/perf/config/Makefile | |||
@@ -198,6 +198,7 @@ CORE_FEATURE_TESTS = \ | |||
198 | libpython-version \ | 198 | libpython-version \ |
199 | libslang \ | 199 | libslang \ |
200 | libunwind \ | 200 | libunwind \ |
201 | pthread-attr-setaffinity-np \ | ||
201 | stackprotector-all \ | 202 | stackprotector-all \ |
202 | timerfd \ | 203 | timerfd \ |
203 | libdw-dwarf-unwind \ | 204 | libdw-dwarf-unwind \ |
@@ -226,6 +227,7 @@ VF_FEATURE_TESTS = \ | |||
226 | libelf-getphdrnum \ | 227 | libelf-getphdrnum \ |
227 | libelf-mmap \ | 228 | libelf-mmap \ |
228 | libpython-version \ | 229 | libpython-version \ |
230 | pthread-attr-setaffinity-np \ | ||
229 | stackprotector-all \ | 231 | stackprotector-all \ |
230 | timerfd \ | 232 | timerfd \ |
231 | libunwind-debug-frame \ | 233 | libunwind-debug-frame \ |
@@ -301,6 +303,10 @@ ifeq ($(feature-sync-compare-and-swap), 1) | |||
301 | CFLAGS += -DHAVE_SYNC_COMPARE_AND_SWAP_SUPPORT | 303 | CFLAGS += -DHAVE_SYNC_COMPARE_AND_SWAP_SUPPORT |
302 | endif | 304 | endif |
303 | 305 | ||
306 | ifeq ($(feature-pthread-attr-setaffinity-np), 1) | ||
307 | CFLAGS += -DHAVE_PTHREAD_ATTR_SETAFFINITY_NP | ||
308 | endif | ||
309 | |||
304 | ifndef NO_BIONIC | 310 | ifndef NO_BIONIC |
305 | $(call feature_check,bionic) | 311 | $(call feature_check,bionic) |
306 | ifeq ($(feature-bionic), 1) | 312 | ifeq ($(feature-bionic), 1) |
diff --git a/tools/perf/config/feature-checks/Makefile b/tools/perf/config/feature-checks/Makefile index 53f19b5dbc37..42ac05aaf8ac 100644 --- a/tools/perf/config/feature-checks/Makefile +++ b/tools/perf/config/feature-checks/Makefile | |||
@@ -25,6 +25,7 @@ FILES= \ | |||
25 | test-libslang.bin \ | 25 | test-libslang.bin \ |
26 | test-libunwind.bin \ | 26 | test-libunwind.bin \ |
27 | test-libunwind-debug-frame.bin \ | 27 | test-libunwind-debug-frame.bin \ |
28 | test-pthread-attr-setaffinity-np.bin \ | ||
28 | test-stackprotector-all.bin \ | 29 | test-stackprotector-all.bin \ |
29 | test-timerfd.bin \ | 30 | test-timerfd.bin \ |
30 | test-libdw-dwarf-unwind.bin \ | 31 | test-libdw-dwarf-unwind.bin \ |
@@ -47,6 +48,9 @@ test-all.bin: | |||
47 | test-hello.bin: | 48 | test-hello.bin: |
48 | $(BUILD) | 49 | $(BUILD) |
49 | 50 | ||
51 | test-pthread-attr-setaffinity-np.bin: | ||
52 | $(BUILD) -Werror -lpthread | ||
53 | |||
50 | test-stackprotector-all.bin: | 54 | test-stackprotector-all.bin: |
51 | $(BUILD) -Werror -fstack-protector-all | 55 | $(BUILD) -Werror -fstack-protector-all |
52 | 56 | ||
diff --git a/tools/perf/config/feature-checks/test-all.c b/tools/perf/config/feature-checks/test-all.c index 652e0098eba6..6d4d09323922 100644 --- a/tools/perf/config/feature-checks/test-all.c +++ b/tools/perf/config/feature-checks/test-all.c | |||
@@ -97,6 +97,10 @@ | |||
97 | # include "test-zlib.c" | 97 | # include "test-zlib.c" |
98 | #undef main | 98 | #undef main |
99 | 99 | ||
100 | #define main main_test_pthread_attr_setaffinity_np | ||
101 | # include "test-pthread_attr_setaffinity_np.c" | ||
102 | #undef main | ||
103 | |||
100 | int main(int argc, char *argv[]) | 104 | int main(int argc, char *argv[]) |
101 | { | 105 | { |
102 | main_test_libpython(); | 106 | main_test_libpython(); |
@@ -121,6 +125,7 @@ int main(int argc, char *argv[]) | |||
121 | main_test_libdw_dwarf_unwind(); | 125 | main_test_libdw_dwarf_unwind(); |
122 | main_test_sync_compare_and_swap(argc, argv); | 126 | main_test_sync_compare_and_swap(argc, argv); |
123 | main_test_zlib(); | 127 | main_test_zlib(); |
128 | main_test_pthread_attr_setaffinity_np(); | ||
124 | 129 | ||
125 | return 0; | 130 | return 0; |
126 | } | 131 | } |
diff --git a/tools/perf/config/feature-checks/test-pthread-attr-setaffinity-np.c b/tools/perf/config/feature-checks/test-pthread-attr-setaffinity-np.c new file mode 100644 index 000000000000..0a0d3ecb4e8a --- /dev/null +++ b/tools/perf/config/feature-checks/test-pthread-attr-setaffinity-np.c | |||
@@ -0,0 +1,14 @@ | |||
1 | #include <stdint.h> | ||
2 | #include <pthread.h> | ||
3 | |||
4 | int main(void) | ||
5 | { | ||
6 | int ret = 0; | ||
7 | pthread_attr_t thread_attr; | ||
8 | |||
9 | pthread_attr_init(&thread_attr); | ||
10 | /* don't care abt exact args, just the API itself in libpthread */ | ||
11 | ret = pthread_attr_setaffinity_np(&thread_attr, 0, NULL); | ||
12 | |||
13 | return ret; | ||
14 | } | ||
diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c index 45be944d450a..c2f7d3b90966 100644 --- a/tools/perf/util/dso.c +++ b/tools/perf/util/dso.c | |||
@@ -532,12 +532,8 @@ dso_cache__read(struct dso *dso, u64 offset, u8 *data, ssize_t size) | |||
532 | break; | 532 | break; |
533 | 533 | ||
534 | cache_offset = offset & DSO__DATA_CACHE_MASK; | 534 | cache_offset = offset & DSO__DATA_CACHE_MASK; |
535 | ret = -EINVAL; | ||
536 | 535 | ||
537 | if (-1 == lseek(dso->data.fd, cache_offset, SEEK_SET)) | 536 | ret = pread(dso->data.fd, cache->data, DSO__DATA_CACHE_SIZE, cache_offset); |
538 | break; | ||
539 | |||
540 | ret = read(dso->data.fd, cache->data, DSO__DATA_CACHE_SIZE); | ||
541 | if (ret <= 0) | 537 | if (ret <= 0) |
542 | break; | 538 | break; |
543 | 539 | ||
diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h index 3782c82c6e44..ced92841ff97 100644 --- a/tools/perf/util/dso.h +++ b/tools/perf/util/dso.h | |||
@@ -139,6 +139,7 @@ struct dso { | |||
139 | u32 status_seen; | 139 | u32 status_seen; |
140 | size_t file_size; | 140 | size_t file_size; |
141 | struct list_head open_entry; | 141 | struct list_head open_entry; |
142 | u64 frame_offset; | ||
142 | } data; | 143 | } data; |
143 | 144 | ||
144 | union { /* Tool specific area */ | 145 | union { /* Tool specific area */ |
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 1e90c8557ede..ea51a90e20a0 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c | |||
@@ -709,6 +709,7 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts) | |||
709 | if (opts->sample_weight) | 709 | if (opts->sample_weight) |
710 | perf_evsel__set_sample_bit(evsel, WEIGHT); | 710 | perf_evsel__set_sample_bit(evsel, WEIGHT); |
711 | 711 | ||
712 | attr->task = track; | ||
712 | attr->mmap = track; | 713 | attr->mmap = track; |
713 | attr->mmap2 = track && !perf_missing_features.mmap2; | 714 | attr->mmap2 = track && !perf_missing_features.mmap2; |
714 | attr->comm = track; | 715 | attr->comm = track; |
@@ -797,6 +798,9 @@ int perf_evsel__enable(struct perf_evsel *evsel, int ncpus, int nthreads) | |||
797 | 798 | ||
798 | int perf_evsel__alloc_id(struct perf_evsel *evsel, int ncpus, int nthreads) | 799 | int perf_evsel__alloc_id(struct perf_evsel *evsel, int ncpus, int nthreads) |
799 | { | 800 | { |
801 | if (ncpus == 0 || nthreads == 0) | ||
802 | return 0; | ||
803 | |||
800 | if (evsel->system_wide) | 804 | if (evsel->system_wide) |
801 | nthreads = 1; | 805 | nthreads = 1; |
802 | 806 | ||
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index b20e40c74468..1f407f7352a7 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c | |||
@@ -2237,6 +2237,7 @@ static int check_magic_endian(u64 magic, uint64_t hdr_sz, | |||
2237 | * - unique number to identify actual perf.data files | 2237 | * - unique number to identify actual perf.data files |
2238 | * - encode endianness of file | 2238 | * - encode endianness of file |
2239 | */ | 2239 | */ |
2240 | ph->version = PERF_HEADER_VERSION_2; | ||
2240 | 2241 | ||
2241 | /* check magic number with one endianness */ | 2242 | /* check magic number with one endianness */ |
2242 | if (magic == __perf_magic2) | 2243 | if (magic == __perf_magic2) |
@@ -2247,7 +2248,6 @@ static int check_magic_endian(u64 magic, uint64_t hdr_sz, | |||
2247 | return -1; | 2248 | return -1; |
2248 | 2249 | ||
2249 | ph->needs_swap = true; | 2250 | ph->needs_swap = true; |
2250 | ph->version = PERF_HEADER_VERSION_2; | ||
2251 | 2251 | ||
2252 | return 0; | 2252 | return 0; |
2253 | } | 2253 | } |
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index b0ce3d6e6231..0baf75f12b7c 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c | |||
@@ -1251,9 +1251,9 @@ fetch_mmaped_event(struct perf_session *session, | |||
1251 | #define NUM_MMAPS 128 | 1251 | #define NUM_MMAPS 128 |
1252 | #endif | 1252 | #endif |
1253 | 1253 | ||
1254 | int __perf_session__process_events(struct perf_session *session, | 1254 | static int __perf_session__process_events(struct perf_session *session, |
1255 | u64 data_offset, u64 data_size, | 1255 | u64 data_offset, u64 data_size, |
1256 | u64 file_size, struct perf_tool *tool) | 1256 | u64 file_size, struct perf_tool *tool) |
1257 | { | 1257 | { |
1258 | int fd = perf_data_file__fd(session->file); | 1258 | int fd = perf_data_file__fd(session->file); |
1259 | u64 head, page_offset, file_offset, file_pos, size; | 1259 | u64 head, page_offset, file_offset, file_pos, size; |
diff --git a/tools/perf/util/session.h b/tools/perf/util/session.h index dc26ebf60fe4..6d663dc76404 100644 --- a/tools/perf/util/session.h +++ b/tools/perf/util/session.h | |||
@@ -49,9 +49,6 @@ int perf_session__peek_event(struct perf_session *session, off_t file_offset, | |||
49 | union perf_event **event_ptr, | 49 | union perf_event **event_ptr, |
50 | struct perf_sample *sample); | 50 | struct perf_sample *sample); |
51 | 51 | ||
52 | int __perf_session__process_events(struct perf_session *session, | ||
53 | u64 data_offset, u64 data_size, u64 size, | ||
54 | struct perf_tool *tool); | ||
55 | int perf_session__process_events(struct perf_session *session, | 52 | int perf_session__process_events(struct perf_session *session, |
56 | struct perf_tool *tool); | 53 | struct perf_tool *tool); |
57 | 54 | ||
diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index 06fcd1bf98b6..b24f9d8727a8 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c | |||
@@ -574,13 +574,16 @@ static int decompress_kmodule(struct dso *dso, const char *name, | |||
574 | const char *ext = strrchr(name, '.'); | 574 | const char *ext = strrchr(name, '.'); |
575 | char tmpbuf[] = "/tmp/perf-kmod-XXXXXX"; | 575 | char tmpbuf[] = "/tmp/perf-kmod-XXXXXX"; |
576 | 576 | ||
577 | if ((type != DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE_COMP && | 577 | if (type != DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE_COMP && |
578 | type != DSO_BINARY_TYPE__GUEST_KMODULE_COMP) || | 578 | type != DSO_BINARY_TYPE__GUEST_KMODULE_COMP && |
579 | type != dso->symtab_type) | 579 | type != DSO_BINARY_TYPE__BUILD_ID_CACHE) |
580 | return -1; | 580 | return -1; |
581 | 581 | ||
582 | if (!ext || !is_supported_compression(ext + 1)) | 582 | if (!ext || !is_supported_compression(ext + 1)) { |
583 | return -1; | 583 | ext = strrchr(dso->name, '.'); |
584 | if (!ext || !is_supported_compression(ext + 1)) | ||
585 | return -1; | ||
586 | } | ||
584 | 587 | ||
585 | fd = mkstemp(tmpbuf); | 588 | fd = mkstemp(tmpbuf); |
586 | if (fd < 0) | 589 | if (fd < 0) |
diff --git a/tools/perf/util/unwind-libunwind.c b/tools/perf/util/unwind-libunwind.c index 6edf535f65c2..e3c40a520a25 100644 --- a/tools/perf/util/unwind-libunwind.c +++ b/tools/perf/util/unwind-libunwind.c | |||
@@ -266,14 +266,17 @@ static int read_unwind_spec_eh_frame(struct dso *dso, struct machine *machine, | |||
266 | u64 *fde_count) | 266 | u64 *fde_count) |
267 | { | 267 | { |
268 | int ret = -EINVAL, fd; | 268 | int ret = -EINVAL, fd; |
269 | u64 offset; | 269 | u64 offset = dso->data.frame_offset; |
270 | 270 | ||
271 | fd = dso__data_fd(dso, machine); | 271 | if (offset == 0) { |
272 | if (fd < 0) | 272 | fd = dso__data_fd(dso, machine); |
273 | return -EINVAL; | 273 | if (fd < 0) |
274 | return -EINVAL; | ||
274 | 275 | ||
275 | /* Check the .eh_frame section for unwinding info */ | 276 | /* Check the .eh_frame section for unwinding info */ |
276 | offset = elf_section_offset(fd, ".eh_frame_hdr"); | 277 | offset = elf_section_offset(fd, ".eh_frame_hdr"); |
278 | dso->data.frame_offset = offset; | ||
279 | } | ||
277 | 280 | ||
278 | if (offset) | 281 | if (offset) |
279 | ret = unwind_spec_ehframe(dso, machine, offset, | 282 | ret = unwind_spec_ehframe(dso, machine, offset, |
@@ -287,14 +290,20 @@ static int read_unwind_spec_eh_frame(struct dso *dso, struct machine *machine, | |||
287 | static int read_unwind_spec_debug_frame(struct dso *dso, | 290 | static int read_unwind_spec_debug_frame(struct dso *dso, |
288 | struct machine *machine, u64 *offset) | 291 | struct machine *machine, u64 *offset) |
289 | { | 292 | { |
290 | int fd = dso__data_fd(dso, machine); | 293 | int fd; |
294 | u64 ofs = dso->data.frame_offset; | ||
291 | 295 | ||
292 | if (fd < 0) | 296 | if (ofs == 0) { |
293 | return -EINVAL; | 297 | fd = dso__data_fd(dso, machine); |
298 | if (fd < 0) | ||
299 | return -EINVAL; | ||
294 | 300 | ||
295 | /* Check the .debug_frame section for unwinding info */ | 301 | /* Check the .debug_frame section for unwinding info */ |
296 | *offset = elf_section_offset(fd, ".debug_frame"); | 302 | ofs = elf_section_offset(fd, ".debug_frame"); |
303 | dso->data.frame_offset = ofs; | ||
304 | } | ||
297 | 305 | ||
306 | *offset = ofs; | ||
298 | if (*offset) | 307 | if (*offset) |
299 | return 0; | 308 | return 0; |
300 | 309 | ||