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/perf/util | |
| 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/perf/util')
| -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 |
8 files changed, 38 insertions, 28 deletions
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 | ||
