diff options
| author | Ingo Molnar <mingo@kernel.org> | 2020-01-10 18:49:34 +0100 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2020-01-10 18:49:34 +0100 |
| commit | 53f3feeb7bd2d78039b3dc9ab158bad2a5dbe012 (patch) | |
| tree | 408b49820aae9d28ff773546476f988f346e04e3 /tools/perf/lib/include/internal | |
| parent | 1f676247f36a4bdea134de5e8bc5041db9678c4e (diff) | |
| parent | 6c4798d3f08b81c2c52936b10e0fa872590c96ae (diff) | |
Merge tag 'perf-core-for-mingo-5.6-20200106' 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:
perf record:
Alexey Budankov:
- Adapt affinity for machines with #CPUs > 1K to overcome current 1024 CPUs
mask size limitation of cpu_set_t type.
perf report/top TUI:
Arnaldo Carvalho de Melo:
- Make ENTER consistently present the pop up menu with and without call
chains, to eliminate confusion. The menu continues available at all times
use 'm' and '+' can be used to toggle just one call chain level, 'e' for all
the call chains for a top level histogram entry and 'E' to expand all call
chains in all top level entries. Extra info about these options was added to
the pop up menu entries. Pressing 'k' serves as special hotkey to go straight
to the main vmlinux entries, to avoid having to press enter and then select
"Zoom into the kernel DSO".
perf sched timehist:
David Ahern:
- Add support for filtering on CPU.
perf tests:
Arnaldo Carvalho de Melo:
- Show expected versus obtained values in bp_signal test.
libperf:
Jiri Olsa:
- Move to tools/lib/perf.
- Add man pages.
libapi:
Andrey Zhizhikin:
- Fix gcc9 stringop-truncation compilation error.
tools lib:
Vitaly Chikunov:
- Fix builds when glibc contains strlcpy(), which is the case for ALT Linux.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/perf/lib/include/internal')
| -rw-r--r-- | tools/perf/lib/include/internal/cpumap.h | 19 | ||||
| -rw-r--r-- | tools/perf/lib/include/internal/evlist.h | 127 | ||||
| -rw-r--r-- | tools/perf/lib/include/internal/evsel.h | 63 | ||||
| -rw-r--r-- | tools/perf/lib/include/internal/lib.h | 12 | ||||
| -rw-r--r-- | tools/perf/lib/include/internal/mmap.h | 55 | ||||
| -rw-r--r-- | tools/perf/lib/include/internal/tests.h | 33 | ||||
| -rw-r--r-- | tools/perf/lib/include/internal/threadmap.h | 23 | ||||
| -rw-r--r-- | tools/perf/lib/include/internal/xyarray.h | 36 |
8 files changed, 0 insertions, 368 deletions
diff --git a/tools/perf/lib/include/internal/cpumap.h b/tools/perf/lib/include/internal/cpumap.h deleted file mode 100644 index 840d4032587b..000000000000 --- a/tools/perf/lib/include/internal/cpumap.h +++ /dev/null @@ -1,19 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __LIBPERF_INTERNAL_CPUMAP_H -#define __LIBPERF_INTERNAL_CPUMAP_H - -#include <linux/refcount.h> - -struct perf_cpu_map { - refcount_t refcnt; - int nr; - int map[]; -}; - -#ifndef MAX_NR_CPUS -#define MAX_NR_CPUS 2048 -#endif - -int perf_cpu_map__idx(struct perf_cpu_map *cpus, int cpu); - -#endif /* __LIBPERF_INTERNAL_CPUMAP_H */ diff --git a/tools/perf/lib/include/internal/evlist.h b/tools/perf/lib/include/internal/evlist.h deleted file mode 100644 index 74dc8c3f0b66..000000000000 --- a/tools/perf/lib/include/internal/evlist.h +++ /dev/null @@ -1,127 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __LIBPERF_INTERNAL_EVLIST_H -#define __LIBPERF_INTERNAL_EVLIST_H - -#include <linux/list.h> -#include <api/fd/array.h> -#include <internal/evsel.h> - -#define PERF_EVLIST__HLIST_BITS 8 -#define PERF_EVLIST__HLIST_SIZE (1 << PERF_EVLIST__HLIST_BITS) - -struct perf_cpu_map; -struct perf_thread_map; -struct perf_mmap_param; - -struct perf_evlist { - struct list_head entries; - int nr_entries; - bool has_user_cpus; - struct perf_cpu_map *cpus; - struct perf_cpu_map *all_cpus; - struct perf_thread_map *threads; - int nr_mmaps; - size_t mmap_len; - struct fdarray pollfd; - struct hlist_head heads[PERF_EVLIST__HLIST_SIZE]; - struct perf_mmap *mmap; - struct perf_mmap *mmap_ovw; - struct perf_mmap *mmap_first; - struct perf_mmap *mmap_ovw_first; -}; - -typedef void -(*perf_evlist_mmap__cb_idx_t)(struct perf_evlist*, struct perf_mmap_param*, int, bool); -typedef struct perf_mmap* -(*perf_evlist_mmap__cb_get_t)(struct perf_evlist*, bool, int); -typedef int -(*perf_evlist_mmap__cb_mmap_t)(struct perf_mmap*, struct perf_mmap_param*, int, int); - -struct perf_evlist_mmap_ops { - perf_evlist_mmap__cb_idx_t idx; - perf_evlist_mmap__cb_get_t get; - perf_evlist_mmap__cb_mmap_t mmap; -}; - -int perf_evlist__alloc_pollfd(struct perf_evlist *evlist); -int perf_evlist__add_pollfd(struct perf_evlist *evlist, int fd, - void *ptr, short revent); - -int perf_evlist__mmap_ops(struct perf_evlist *evlist, - struct perf_evlist_mmap_ops *ops, - struct perf_mmap_param *mp); - -void perf_evlist__init(struct perf_evlist *evlist); -void perf_evlist__exit(struct perf_evlist *evlist); - -/** - * __perf_evlist__for_each_entry - iterate thru all the evsels - * @list: list_head instance to iterate - * @evsel: struct perf_evsel iterator - */ -#define __perf_evlist__for_each_entry(list, evsel) \ - list_for_each_entry(evsel, list, node) - -/** - * evlist__for_each_entry - iterate thru all the evsels - * @evlist: perf_evlist instance to iterate - * @evsel: struct perf_evsel iterator - */ -#define perf_evlist__for_each_entry(evlist, evsel) \ - __perf_evlist__for_each_entry(&(evlist)->entries, evsel) - -/** - * __perf_evlist__for_each_entry_reverse - iterate thru all the evsels in reverse order - * @list: list_head instance to iterate - * @evsel: struct evsel iterator - */ -#define __perf_evlist__for_each_entry_reverse(list, evsel) \ - list_for_each_entry_reverse(evsel, list, node) - -/** - * perf_evlist__for_each_entry_reverse - iterate thru all the evsels in reverse order - * @evlist: evlist instance to iterate - * @evsel: struct evsel iterator - */ -#define perf_evlist__for_each_entry_reverse(evlist, evsel) \ - __perf_evlist__for_each_entry_reverse(&(evlist)->entries, evsel) - -/** - * __perf_evlist__for_each_entry_safe - safely iterate thru all the evsels - * @list: list_head instance to iterate - * @tmp: struct evsel temp iterator - * @evsel: struct evsel iterator - */ -#define __perf_evlist__for_each_entry_safe(list, tmp, evsel) \ - list_for_each_entry_safe(evsel, tmp, list, node) - -/** - * perf_evlist__for_each_entry_safe - safely iterate thru all the evsels - * @evlist: evlist instance to iterate - * @evsel: struct evsel iterator - * @tmp: struct evsel temp iterator - */ -#define perf_evlist__for_each_entry_safe(evlist, tmp, evsel) \ - __perf_evlist__for_each_entry_safe(&(evlist)->entries, tmp, evsel) - -static inline struct perf_evsel *perf_evlist__first(struct perf_evlist *evlist) -{ - return list_entry(evlist->entries.next, struct perf_evsel, node); -} - -static inline struct perf_evsel *perf_evlist__last(struct perf_evlist *evlist) -{ - return list_entry(evlist->entries.prev, struct perf_evsel, node); -} - -u64 perf_evlist__read_format(struct perf_evlist *evlist); - -void perf_evlist__id_add(struct perf_evlist *evlist, - struct perf_evsel *evsel, - int cpu, int thread, u64 id); - -int perf_evlist__id_add_fd(struct perf_evlist *evlist, - struct perf_evsel *evsel, - int cpu, int thread, int fd); - -#endif /* __LIBPERF_INTERNAL_EVLIST_H */ diff --git a/tools/perf/lib/include/internal/evsel.h b/tools/perf/lib/include/internal/evsel.h deleted file mode 100644 index 1ffd083b235e..000000000000 --- a/tools/perf/lib/include/internal/evsel.h +++ /dev/null @@ -1,63 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __LIBPERF_INTERNAL_EVSEL_H -#define __LIBPERF_INTERNAL_EVSEL_H - -#include <linux/types.h> -#include <linux/perf_event.h> -#include <stdbool.h> -#include <sys/types.h> - -struct perf_cpu_map; -struct perf_thread_map; -struct xyarray; - -/* - * Per fd, to map back from PERF_SAMPLE_ID to evsel, only used when there are - * more than one entry in the evlist. - */ -struct perf_sample_id { - struct hlist_node node; - u64 id; - struct perf_evsel *evsel; - /* - * 'idx' will be used for AUX area sampling. A sample will have AUX area - * data that will be queued for decoding, where there are separate - * queues for each CPU (per-cpu tracing) or task (per-thread tracing). - * The sample ID can be used to lookup 'idx' which is effectively the - * queue number. - */ - int idx; - int cpu; - pid_t tid; - - /* Holds total ID period value for PERF_SAMPLE_READ processing. */ - u64 period; -}; - -struct perf_evsel { - struct list_head node; - struct perf_event_attr attr; - struct perf_cpu_map *cpus; - struct perf_cpu_map *own_cpus; - struct perf_thread_map *threads; - struct xyarray *fd; - struct xyarray *sample_id; - u64 *id; - u32 ids; - - /* parse modifier helper */ - int nr_members; - bool system_wide; -}; - -void perf_evsel__init(struct perf_evsel *evsel, struct perf_event_attr *attr); -int perf_evsel__alloc_fd(struct perf_evsel *evsel, int ncpus, int nthreads); -void perf_evsel__close_fd(struct perf_evsel *evsel); -void perf_evsel__free_fd(struct perf_evsel *evsel); -int perf_evsel__read_size(struct perf_evsel *evsel); -int perf_evsel__apply_filter(struct perf_evsel *evsel, const char *filter); - -int perf_evsel__alloc_id(struct perf_evsel *evsel, int ncpus, int nthreads); -void perf_evsel__free_id(struct perf_evsel *evsel); - -#endif /* __LIBPERF_INTERNAL_EVSEL_H */ diff --git a/tools/perf/lib/include/internal/lib.h b/tools/perf/lib/include/internal/lib.h deleted file mode 100644 index 5175d491b2d4..000000000000 --- a/tools/perf/lib/include/internal/lib.h +++ /dev/null @@ -1,12 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __LIBPERF_INTERNAL_LIB_H -#define __LIBPERF_INTERNAL_LIB_H - -#include <sys/types.h> - -extern unsigned int page_size; - -ssize_t readn(int fd, void *buf, size_t n); -ssize_t writen(int fd, const void *buf, size_t n); - -#endif /* __LIBPERF_INTERNAL_CPUMAP_H */ diff --git a/tools/perf/lib/include/internal/mmap.h b/tools/perf/lib/include/internal/mmap.h deleted file mode 100644 index be7556e0a2b2..000000000000 --- a/tools/perf/lib/include/internal/mmap.h +++ /dev/null @@ -1,55 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __LIBPERF_INTERNAL_MMAP_H -#define __LIBPERF_INTERNAL_MMAP_H - -#include <linux/compiler.h> -#include <linux/refcount.h> -#include <linux/types.h> -#include <stdbool.h> - -/* perf sample has 16 bits size limit */ -#define PERF_SAMPLE_MAX_SIZE (1 << 16) - -struct perf_mmap; - -typedef void (*libperf_unmap_cb_t)(struct perf_mmap *map); - -/** - * struct perf_mmap - perf's ring buffer mmap details - * - * @refcnt - e.g. code using PERF_EVENT_IOC_SET_OUTPUT to share this - */ -struct perf_mmap { - void *base; - int mask; - int fd; - int cpu; - refcount_t refcnt; - u64 prev; - u64 start; - u64 end; - bool overwrite; - u64 flush; - libperf_unmap_cb_t unmap_cb; - char event_copy[PERF_SAMPLE_MAX_SIZE] __aligned(8); - struct perf_mmap *next; -}; - -struct perf_mmap_param { - int prot; - int mask; -}; - -size_t perf_mmap__mmap_len(struct perf_mmap *map); - -void perf_mmap__init(struct perf_mmap *map, struct perf_mmap *prev, - bool overwrite, libperf_unmap_cb_t unmap_cb); -int perf_mmap__mmap(struct perf_mmap *map, struct perf_mmap_param *mp, - int fd, int cpu); -void perf_mmap__munmap(struct perf_mmap *map); -void perf_mmap__get(struct perf_mmap *map); -void perf_mmap__put(struct perf_mmap *map); - -u64 perf_mmap__read_head(struct perf_mmap *map); - -#endif /* __LIBPERF_INTERNAL_MMAP_H */ diff --git a/tools/perf/lib/include/internal/tests.h b/tools/perf/lib/include/internal/tests.h deleted file mode 100644 index 2093e8868a67..000000000000 --- a/tools/perf/lib/include/internal/tests.h +++ /dev/null @@ -1,33 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __LIBPERF_INTERNAL_TESTS_H -#define __LIBPERF_INTERNAL_TESTS_H - -#include <stdio.h> - -int tests_failed; - -#define __T_START \ -do { \ - fprintf(stdout, "- running %s...", __FILE__); \ - fflush(NULL); \ - tests_failed = 0; \ -} while (0) - -#define __T_END \ -do { \ - if (tests_failed) \ - fprintf(stdout, " FAILED (%d)\n", tests_failed); \ - else \ - fprintf(stdout, "OK\n"); \ -} while (0) - -#define __T(text, cond) \ -do { \ - if (!(cond)) { \ - fprintf(stderr, "FAILED %s:%d %s\n", __FILE__, __LINE__, text); \ - tests_failed++; \ - return -1; \ - } \ -} while (0) - -#endif /* __LIBPERF_INTERNAL_TESTS_H */ diff --git a/tools/perf/lib/include/internal/threadmap.h b/tools/perf/lib/include/internal/threadmap.h deleted file mode 100644 index df748baf9eda..000000000000 --- a/tools/perf/lib/include/internal/threadmap.h +++ /dev/null @@ -1,23 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __LIBPERF_INTERNAL_THREADMAP_H -#define __LIBPERF_INTERNAL_THREADMAP_H - -#include <linux/refcount.h> -#include <sys/types.h> -#include <unistd.h> - -struct thread_map_data { - pid_t pid; - char *comm; -}; - -struct perf_thread_map { - refcount_t refcnt; - int nr; - int err_thread; - struct thread_map_data map[]; -}; - -struct perf_thread_map *perf_thread_map__realloc(struct perf_thread_map *map, int nr); - -#endif /* __LIBPERF_INTERNAL_THREADMAP_H */ diff --git a/tools/perf/lib/include/internal/xyarray.h b/tools/perf/lib/include/internal/xyarray.h deleted file mode 100644 index 51e35d6c8ec4..000000000000 --- a/tools/perf/lib/include/internal/xyarray.h +++ /dev/null @@ -1,36 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __LIBPERF_INTERNAL_XYARRAY_H -#define __LIBPERF_INTERNAL_XYARRAY_H - -#include <linux/compiler.h> -#include <sys/types.h> - -struct xyarray { - size_t row_size; - size_t entry_size; - size_t entries; - size_t max_x; - size_t max_y; - char contents[] __aligned(8); -}; - -struct xyarray *xyarray__new(int xlen, int ylen, size_t entry_size); -void xyarray__delete(struct xyarray *xy); -void xyarray__reset(struct xyarray *xy); - -static inline void *xyarray__entry(struct xyarray *xy, int x, int y) -{ - return &xy->contents[x * xy->row_size + y * xy->entry_size]; -} - -static inline int xyarray__max_y(struct xyarray *xy) -{ - return xy->max_y; -} - -static inline int xyarray__max_x(struct xyarray *xy) -{ - return xy->max_x; -} - -#endif /* __LIBPERF_INTERNAL_XYARRAY_H */ |
