diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2024-07-18 14:16:35 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2024-07-18 14:16:35 -0700 |
commit | 68b59730459e5d1fe4e0bbeb04ceb9df0f002270 (patch) | |
tree | 4ae49053c2da0491138d459b40d5075054e5d3cb /tools/lib | |
parent | f669aac34c5f76b58e6cad1fef0643e5ae16d413 (diff) | |
parent | 7a2fb5619cc1fb53cb8784154d5ef2bd99997436 (diff) | |
download | linux-68b59730459e5d1fe4e0bbeb04ceb9df0f002270.tar.gz linux-68b59730459e5d1fe4e0bbeb04ceb9df0f002270.tar.bz2 linux-68b59730459e5d1fe4e0bbeb04ceb9df0f002270.zip |
Merge tag 'perf-tools-for-v6.11-2024-07-16' of git://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools
Pull perf tools updates from Namhyung Kim:
"Build:
- Build each directory as a library so that depedency check for the
python extension module can be automatic
- Use pkg-config to check libtraceevent and libtracefs
perf sched:
- Add --task-name and --fuzzy-name options for `perf sched map`
It focuses on selected tasks only by removing unrelated tasks in
the output. It matches the task comm with the given string and the
--fuzzy-name option allows the partial matching:
$ sudo perf sched record -a sleep 1
$ sudo perf sched map --task-name kworker --fuzzy-name
. . . . - *A0 . . 481065.315131 secs A0 => kworker/5:2-i91:438521
. . . . - *- . . 481065.315160 secs
*B0 . . . - . . . 481065.316435 secs B0 => kworker/0:0-i91:437860
*- . . . . . . . 481065.316441 secs
. . . . . *A0 . . 481065.318703 secs
. . . . . *- . . 481065.318717 secs
. . *C0 . . . . . 481065.320544 secs C0 => kworker/u16:30-:430186
. . *- . . . . . 481065.320555 secs
. . *D0 . . . . . 481065.328524 secs D0 => kworker/2:0-kdm:429654
*B0 . D0 . - . . . 481065.328527 secs
*- . D0 . - . . . 481065.328535 secs
. . *- . . . . . 481065.328535 secs
- Fix -r/--repeat option of perf sched replay
The documentation said -1 will work as infinity but it didn't
accept the value. Update the code and document to use 0 instead
- Fix perf sched timehist to account the delay time for preempted
tasks
Perf event filtering:
- perf top gained filtering support on regular events using BPF like
perf record. Previously it was able to use it for tracepoints only
- The BPF filter now supports filtering by UID/GID. This should be
preferred than -u <UID> option as it's racy to scan /proc to check
tasks for the user and fails to open an event for the task if it's
already gone
$ sudo perf top -e cycles --filter "uid == $(id -u)"
perf report:
- Skip dummy events in the group output by default. The --skip-empty
option controls display of empty events without samples. But perf
report can force display all events in a group
In this case, auto-added a dummy event (for a system-wide record)
ends up in the output. Now it can skip those empty events even in
the group display mode
To preserve the old behavior, run this:
$ perf report --group --no-skip-empty
perf stat:
- Choose the most disaggregate option when multiple aggregation
options are given. It used to pick the last option in the command
line but it can be confusing and not consistent. Now it'll choose
the smallest unit
For example, it'd aggregate the result per-core when the user gave
both --per-socket and --per-core options at the same time
Internals:
- Fix `perf bench` when some CPUs are offline
- Fix handling of JIT symbol mappings to accept "/tmp/perf-${PID}.map
patterns only so that it can not be confused by other /tmp/perf-*
files
- Many improvements and fixes for `perf test`
Others:
- Support some new instructions for Intel-PT
- Fix syscall ID mapping in perf trace
- Document AMD IBS PMU usages
- Change `perf lock info` to show map and thread info by default
Vendor JSON events:
- Update Intel events and metrics
- Add i.MX9[35] DDR metrics"
* tag 'perf-tools-for-v6.11-2024-07-16' of git://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools: (125 commits)
perf trace: Fix iteration of syscall ids in syscalltbl->entries
perf dso: Fix address sanitizer build
perf mem: Warn if memory events are not supported on all CPUs
perf arm-spe: Support multiple Arm SPE PMUs
perf build x86: Fix SC2034 error in syscalltbl.sh
perf record: Fix memset out-of-range error
perf sched map: Add --fuzzy-name option for fuzzy matching in task names
perf sched map: Add support for multiple task names using CSV
perf sched map: Add task-name option to filter the output map
perf build: Conditionally add feature check flags for libtrace{event,fs}
perf install: Don't propagate subdir to Documentation submake
perf vendor events arm64:: Add i.MX95 DDR Performance Monitor metrics
perf vendor events arm64:: Add i.MX93 DDR Performance Monitor metrics
perf dsos: When adding a dso into sorted dsos maintain the sort order
perf comm str: Avoid sort during insert
perf report: Calling available function for stats printing
perf intel-pt: Fix exclude_guest setting
perf intel-pt: Fix aux_watermark calculation for 64-bit size
perf sched replay: Fix -r/--repeat command line option for infinity
perf: pmus: Remove unneeded semicolon
...
Diffstat (limited to 'tools/lib')
-rw-r--r-- | tools/lib/api/io.h | 69 | ||||
-rw-r--r-- | tools/lib/perf/include/perf/event.h | 6 |
2 files changed, 44 insertions, 31 deletions
diff --git a/tools/lib/api/io.h b/tools/lib/api/io.h index 84adf8102018..d3eb04d1bc89 100644 --- a/tools/lib/api/io.h +++ b/tools/lib/api/io.h @@ -43,48 +43,55 @@ static inline void io__init(struct io *io, int fd, io->eof = false; } -/* Reads one character from the "io" file with similar semantics to fgetc. */ -static inline int io__get_char(struct io *io) +/* Read from fd filling the buffer. Called when io->data == io->end. */ +static inline int io__fill_buffer(struct io *io) { - char *ptr = io->data; + ssize_t n; if (io->eof) return -1; - if (ptr == io->end) { - ssize_t n; - - if (io->timeout_ms != 0) { - struct pollfd pfds[] = { - { - .fd = io->fd, - .events = POLLIN, - }, - }; - - n = poll(pfds, 1, io->timeout_ms); - if (n == 0) - errno = ETIMEDOUT; - if (n > 0 && !(pfds[0].revents & POLLIN)) { - errno = EIO; - n = -1; - } - if (n <= 0) { - io->eof = true; - return -1; - } + if (io->timeout_ms != 0) { + struct pollfd pfds[] = { + { + .fd = io->fd, + .events = POLLIN, + }, + }; + + n = poll(pfds, 1, io->timeout_ms); + if (n == 0) + errno = ETIMEDOUT; + if (n > 0 && !(pfds[0].revents & POLLIN)) { + errno = EIO; + n = -1; } - n = read(io->fd, io->buf, io->buf_len); - if (n <= 0) { io->eof = true; return -1; } - ptr = &io->buf[0]; - io->end = &io->buf[n]; } - io->data = ptr + 1; - return *ptr; + n = read(io->fd, io->buf, io->buf_len); + + if (n <= 0) { + io->eof = true; + return -1; + } + io->data = &io->buf[0]; + io->end = &io->buf[n]; + return 0; +} + +/* Reads one character from the "io" file with similar semantics to fgetc. */ +static inline int io__get_char(struct io *io) +{ + if (io->data == io->end) { + int ret = io__fill_buffer(io); + + if (ret) + return ret; + } + return *io->data++; } /* Read a hexadecimal value with no 0x prefix into the out argument hex. If the diff --git a/tools/lib/perf/include/perf/event.h b/tools/lib/perf/include/perf/event.h index ae64090184d3..37bb7771d914 100644 --- a/tools/lib/perf/include/perf/event.h +++ b/tools/lib/perf/include/perf/event.h @@ -77,6 +77,12 @@ struct perf_record_lost_samples { __u64 lost; }; +#define MAX_ID_HDR_ENTRIES 6 +struct perf_record_lost_samples_and_ids { + struct perf_record_lost_samples lost; + __u64 sample_ids[MAX_ID_HDR_ENTRIES]; +}; + /* * PERF_FORMAT_ENABLED | PERF_FORMAT_RUNNING | PERF_FORMAT_ID | PERF_FORMAT_LOST */ |