mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-11-01 17:08:10 +00:00
61d9fc4449
'perf script' supports '-S' or '--symbol' options to only list the records for these symbols. A symbol is typically a name or hex address. If it's hex address, it is the start address of one symbol. While it would be useful if we can filter trace records by any hex address (not only the start address of symbol). So now we support filtering trace records by more conditions, such as: - symbol name - start address of symbol - any hexadecimal address - address range The comparison order is defined as: 1. symbol name comparison 2. symbol start address comparison. 3. any hexadecimal address comparison. 4. address range comparison. The idea is if we can get a valid address from -S list, we add the address to addr_list for address comparison otherwise we still leave it to sym_list for symbol comparison. Some examples: root@kbl-ppc:~# ./perf script -S ffffffff9a477308 perf 8562 [000] 347303.578858: 1 cycles: ffffffff9a477308 native_write_msr+0x8 ([kernel.kallsyms]) perf 8562 [000] 347303.578860: 1 cycles: ffffffff9a477308 native_write_msr+0x8 ([kernel.kallsyms]) perf 8562 [000] 347303.578861: 11 cycles: ffffffff9a477308 native_write_msr+0x8 ([kernel.kallsyms]) perf 8562 [001] 347303.578903: 1 cycles: ffffffff9a477308 native_write_msr+0x8 ([kernel.kallsyms]) perf 8562 [001] 347303.578905: 1 cycles: ffffffff9a477308 native_write_msr+0x8 ([kernel.kallsyms]) perf 8562 [001] 347303.578906: 15 cycles: ffffffff9a477308 native_write_msr+0x8 ([kernel.kallsyms]) perf 8562 [002] 347303.578952: 1 cycles: ffffffff9a477308 native_write_msr+0x8 ([kernel.kallsyms]) perf 8562 [002] 347303.578953: 1 cycles: ffffffff9a477308 native_write_msr+0x8 ([kernel.kallsyms]) Filter the traced records by hex address ffffffff9a477308. root@kbl-ppc:~# ./perf script -S ffffffff9a4dd4ce,ffffffff9a4d2de9,ffffffff9a6bf9f4 perf 8562 [001] 347303.578911: 311706 cycles: ffffffff9a6bf9f4 __kmalloc_node+0x204 ([kernel.kallsyms]) perf 8562 [002] 347303.578960: 354477 cycles: ffffffff9a4d2de9 sched_setaffinity+0x49 ([kernel.kallsyms]) perf 8562 [003] 347303.579015: 450958 cycles: ffffffff9a4dd4ce dequeue_task_fair+0x1ae ([kernel.kallsyms]) Filter the traced records by hex address ffffffff9a4dd4ce, ffffffff9a4d2de9, ffffffff9a6bf9f4. root@kbl-ppc:~# ./perf script -S ffffffff9a477309 --addr-range 16 perf 8562 [000] 347303.578863: 291 cycles: ffffffff9a47730a native_write_msr+0xa ([kernel.kallsyms]) perf 8562 [001] 347303.578907: 411 cycles: ffffffff9a47730a native_write_msr+0xa ([kernel.kallsyms]) perf 8562 [002] 347303.578956: 462 cycles: ffffffff9a47730f native_write_msr+0xf ([kernel.kallsyms]) perf 8562 [003] 347303.579010: 497 cycles: ffffffff9a47730f native_write_msr+0xf ([kernel.kallsyms]) perf 8562 [004] 347303.579059: 429 cycles: ffffffff9a47730f native_write_msr+0xf ([kernel.kallsyms]) perf 8562 [005] 347303.579109: 408 cycles: ffffffff9a47730a native_write_msr+0xa ([kernel.kallsyms]) perf 8562 [006] 347303.579159: 460 cycles: ffffffff9a47730f native_write_msr+0xf ([kernel.kallsyms]) perf 8562 [007] 347303.579213: 436 cycles: ffffffff9a47730f native_write_msr+0xf ([kernel.kallsyms]) Filter the traced records from address range [ffffffff9a477309, ffffffff9a477309 + 15]. root@kbl-ppc:~# ./perf script -S "ffffffff9b163046,rcu_nmi_exit" perf 8562 [004] 347303.579060: 12013 cycles: ffffffff9b163046 exc_nmi+0x166 ([kernel.kallsyms]) perf 8562 [007] 347303.579214: 12138 cycles: ffffffff9b165944 rcu_nmi_exit+0x34 ([kernel.kallsyms]) Filter by address + symbol Signed-off-by: Jin Yao <yao.jin@linux.intel.com> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Jin Yao <yao.jin@intel.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lore.kernel.org/lkml/20210207080935.31784-2-yao.jin@linux.intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
84 lines
1.6 KiB
C
84 lines
1.6 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef __PERF_SYMBOL_CONF
|
|
#define __PERF_SYMBOL_CONF 1
|
|
|
|
#include <stdbool.h>
|
|
|
|
struct strlist;
|
|
struct intlist;
|
|
|
|
struct symbol_conf {
|
|
bool nanosecs;
|
|
unsigned short priv_size;
|
|
bool try_vmlinux_path,
|
|
init_annotation,
|
|
force,
|
|
ignore_vmlinux,
|
|
ignore_vmlinux_buildid,
|
|
show_kernel_path,
|
|
use_modules,
|
|
allow_aliases,
|
|
sort_by_name,
|
|
show_nr_samples,
|
|
show_total_period,
|
|
use_callchain,
|
|
cumulate_callchain,
|
|
show_branchflag_count,
|
|
exclude_other,
|
|
show_cpu_utilization,
|
|
initialized,
|
|
kptr_restrict,
|
|
event_group,
|
|
demangle,
|
|
demangle_kernel,
|
|
filter_relative,
|
|
show_hist_headers,
|
|
branch_callstack,
|
|
has_filter,
|
|
show_ref_callgraph,
|
|
hide_unresolved,
|
|
raw_trace,
|
|
report_hierarchy,
|
|
report_block,
|
|
report_individual_block,
|
|
inline_name,
|
|
disable_add2line_warn,
|
|
buildid_mmap2;
|
|
const char *vmlinux_name,
|
|
*kallsyms_name,
|
|
*source_prefix,
|
|
*field_sep,
|
|
*graph_function;
|
|
const char *default_guest_vmlinux_name,
|
|
*default_guest_kallsyms,
|
|
*default_guest_modules;
|
|
const char *guestmount;
|
|
const char *dso_list_str,
|
|
*comm_list_str,
|
|
*pid_list_str,
|
|
*tid_list_str,
|
|
*sym_list_str,
|
|
*col_width_list_str,
|
|
*bt_stop_list_str;
|
|
unsigned long time_quantum;
|
|
struct strlist *dso_list,
|
|
*comm_list,
|
|
*sym_list,
|
|
*dso_from_list,
|
|
*dso_to_list,
|
|
*sym_from_list,
|
|
*sym_to_list,
|
|
*bt_stop_list;
|
|
struct intlist *pid_list,
|
|
*tid_list,
|
|
*addr_list;
|
|
const char *symfs;
|
|
int res_sample;
|
|
int pad_output_len_dso;
|
|
int group_sort_idx;
|
|
int addr_range;
|
|
};
|
|
|
|
extern struct symbol_conf symbol_conf;
|
|
|
|
#endif // __PERF_SYMBOL_CONF
|