mirror of https://gitee.com/openkylin/linux.git
perf/core improvements and fixes:
- Introduce 'perf record --aio' to use asynchronous IO trace writing, disabled by default (Alexey Budankov) - Add fallback routines to be used in places where we don't have the CPU mode (kernel/userspace/hypervisor) and thus must first fallback lookups looking at all map trees when trying to resolve symbols (Adrian Hunter) - Fix error with config term "pt=0", where we should just force "pt=1" and warn the user about the former being nonsensical (Adrian Hunter) - Fix 'perf test' entry where we expect 'sleep' to come in a PERF_RECORD_COMM but instead we get 'coreutils' when sleep is provided by some versions of the 'coreutils' package (Adrian Hunter) - Introduce 'perf top --kallsyms file' to match 'perf report --kallsyms', useful when dealing with BPF, where symbol resolution happens via kallsyms, not via the default vmlinux ELF symtabs (Arnaldo Carvalho de Melo) - Support 'srccode' output field in 'perf script' (Andi Kleen) - Introduce basic 'perf annotation' support for the ARC architecture (Eugeniy Paltsev) - Compute and display average IPC and IPC coverage per symbol in 'perf annotate' and 'perf report' (Jin Yao) - Make 'perf top' use ordered_events and process histograms in a separate thread (Jiri Olsa) - Make 'perf trace' use ordered_events (Jiri Olsa) - Add support for ETMv3 and PTMv1.1 decoding in cs-etm (Mathieu Poirier) - Support for ARM A32/T32 instruction sets in CoreSight trace (cs-etm) (Robert Walker) - Fix 'perf stat' shadow stats for clock events. (Ravi Bangoria) - Remove needless rb_tree extra indirection from map__find() (Eric Saint-Etienne) - Fix CSV mode column output for non-cgroup events in 'perf stat' (Stephane Eranian) - Add sanity check to libtraceevent's is_timestamp_in_us() (Tzvetomir Stoyanov) - Use ERR_CAST instead of ERR_PTR(PTR_ERR()) (Wen Yang) - Fix Load_Miss_Real_Latency on SKL/SKX intel vendor event files (Andi Kleen) - strncpy() fixes triggered by new warnings on gcc 8.2.0 (Arnaldo Carvalho de Melo) - Handle tracefs syscall tracepoint older 'nr' field in 'perf trace', that got renamed to '__syscall_nr' to work in older kernels (Arnaldo Carvalho de Melo) - Give better hint about devel package for libssl (Arnaldo Carvalho de Melo) - Fix the 'perf trace' build in architectures lacking explicit mmap.h file (Arnaldo Carvalho de Melo) - Remove extra rb_tree traversal indirection from map__find() (Eric Saint-Etienne) - Disable breakpoint tests for 32-bit ARM (Florian Fainelli) - Fix typos all over the place, mostly in comments, but also in some debug messages and JSON files (Ingo Molnar) - Allow specifying proc-map-timeout in config file (Mark Drayton) - Fix mmap_flags table generation script (Sihyeon Jang) - Fix 'size' parameter to snprintf in the 'perf config' code (Sihyeon Jang) - More libtraceevent renames to make it a proper library (Tzvetomir Stoyanov) - Implement new API tep_get_ref() in libtraceevent (Tzvetomir Stoyanov) - Added support for pkg-config in libtraceevent (Tzvetomir Stoyanov) Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQR2GiIUctdOfX2qHhGyPKLppCJ+JwUCXBfqKQAKCRCyPKLppCJ+ JwB3AQCn2ij14Y2W4Cvy0ka18LZlxQkC0b+L30XZwUv9q34FSwD9HyErhRWTQhEU PgPdn6TKqh9aYy7LRFACiQ4x/s7Dug8= =xxUZ -----END PGP SIGNATURE----- Merge tag 'perf-core-for-mingo-4.21-20181217' 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: - Introduce 'perf record --aio' to use asynchronous IO trace writing, disabled by default (Alexey Budankov) - Add fallback routines to be used in places where we don't have the CPU mode (kernel/userspace/hypervisor) and thus must first fallback lookups looking at all map trees when trying to resolve symbols (Adrian Hunter) - Fix error with config term "pt=0", where we should just force "pt=1" and warn the user about the former being nonsensical (Adrian Hunter) - Fix 'perf test' entry where we expect 'sleep' to come in a PERF_RECORD_COMM but instead we get 'coreutils' when sleep is provided by some versions of the 'coreutils' package (Adrian Hunter) - Introduce 'perf top --kallsyms file' to match 'perf report --kallsyms', useful when dealing with BPF, where symbol resolution happens via kallsyms, not via the default vmlinux ELF symtabs (Arnaldo Carvalho de Melo) - Support 'srccode' output field in 'perf script' (Andi Kleen) - Introduce basic 'perf annotation' support for the ARC architecture (Eugeniy Paltsev) - Compute and display average IPC and IPC coverage per symbol in 'perf annotate' and 'perf report' (Jin Yao) - Make 'perf top' use ordered_events and process histograms in a separate thread (Jiri Olsa) - Make 'perf trace' use ordered_events (Jiri Olsa) - Add support for ETMv3 and PTMv1.1 decoding in cs-etm (Mathieu Poirier) - Support for ARM A32/T32 instruction sets in CoreSight trace (cs-etm) (Robert Walker) - Fix 'perf stat' shadow stats for clock events. (Ravi Bangoria) - Remove needless rb_tree extra indirection from map__find() (Eric Saint-Etienne) - Fix CSV mode column output for non-cgroup events in 'perf stat' (Stephane Eranian) - Add sanity check to libtraceevent's is_timestamp_in_us() (Tzvetomir Stoyanov) - Use ERR_CAST instead of ERR_PTR(PTR_ERR()) (Wen Yang) - Fix Load_Miss_Real_Latency on SKL/SKX intel vendor event files (Andi Kleen) - strncpy() fixes triggered by new warnings on gcc 8.2.0 (Arnaldo Carvalho de Melo) - Handle tracefs syscall tracepoint older 'nr' field in 'perf trace', that got renamed to '__syscall_nr' to work in older kernels (Arnaldo Carvalho de Melo) - Give better hint about devel package for libssl (Arnaldo Carvalho de Melo) - Fix the 'perf trace' build in architectures lacking explicit mmap.h file (Arnaldo Carvalho de Melo) - Remove extra rb_tree traversal indirection from map__find() (Eric Saint-Etienne) - Disable breakpoint tests for 32-bit ARM (Florian Fainelli) - Fix typos all over the place, mostly in comments, but also in some debug messages and JSON files (Ingo Molnar) - Allow specifying proc-map-timeout in config file (Mark Drayton) - Fix mmap_flags table generation script (Sihyeon Jang) - Fix 'size' parameter to snprintf in the 'perf config' code (Sihyeon Jang) - More libtraceevent renames to make it a proper library (Tzvetomir Stoyanov) - Implement new API tep_get_ref() in libtraceevent (Tzvetomir Stoyanov) - Added support for pkg-config in libtraceevent (Tzvetomir Stoyanov) Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
commit
ca46afdb27
|
@ -70,7 +70,8 @@ FEATURE_TESTS_BASIC := \
|
|||
sched_getcpu \
|
||||
sdt \
|
||||
setns \
|
||||
libopencsd
|
||||
libopencsd \
|
||||
libaio
|
||||
|
||||
# FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list
|
||||
# of all feature tests
|
||||
|
@ -116,7 +117,8 @@ FEATURE_DISPLAY ?= \
|
|||
zlib \
|
||||
lzma \
|
||||
get_cpuid \
|
||||
bpf
|
||||
bpf \
|
||||
libaio
|
||||
|
||||
# Set FEATURE_CHECK_(C|LD)FLAGS-all for all FEATURE_TESTS features.
|
||||
# If in the future we need per-feature checks/flags for features not
|
||||
|
|
|
@ -61,7 +61,8 @@ FILES= \
|
|||
test-libopencsd.bin \
|
||||
test-clang.bin \
|
||||
test-llvm.bin \
|
||||
test-llvm-version.bin
|
||||
test-llvm-version.bin \
|
||||
test-libaio.bin
|
||||
|
||||
FILES := $(addprefix $(OUTPUT),$(FILES))
|
||||
|
||||
|
@ -297,6 +298,9 @@ $(OUTPUT)test-clang.bin:
|
|||
|
||||
-include $(OUTPUT)*.d
|
||||
|
||||
$(OUTPUT)test-libaio.bin:
|
||||
$(BUILD) -lrt
|
||||
|
||||
###############################
|
||||
|
||||
clean:
|
||||
|
|
|
@ -174,6 +174,10 @@
|
|||
# include "test-libopencsd.c"
|
||||
#undef main
|
||||
|
||||
#define main main_test_libaio
|
||||
# include "test-libaio.c"
|
||||
#undef main
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
main_test_libpython();
|
||||
|
@ -214,6 +218,7 @@ int main(int argc, char *argv[])
|
|||
main_test_sdt();
|
||||
main_test_setns();
|
||||
main_test_libopencsd();
|
||||
main_test_libaio();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
#include <aio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
struct aiocb aiocb;
|
||||
|
||||
aiocb.aio_fildes = 0;
|
||||
aiocb.aio_offset = 0;
|
||||
aiocb.aio_buf = 0;
|
||||
aiocb.aio_nbytes = 0;
|
||||
aiocb.aio_reqprio = 0;
|
||||
aiocb.aio_sigevent.sigev_notify = 1 /*SIGEV_NONE*/;
|
||||
|
||||
return (int)aio_return(&aiocb);
|
||||
}
|
|
@ -1,6 +1,14 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
#include <opencsd/c_api/opencsd_c_api.h>
|
||||
|
||||
/*
|
||||
* Check OpenCSD library version is sufficient to provide required features
|
||||
*/
|
||||
#define OCSD_MIN_VER ((0 << 16) | (10 << 8) | (0))
|
||||
#if !defined(OCSD_VER_NUM) || (OCSD_VER_NUM < OCSD_MIN_VER)
|
||||
#error "OpenCSD >= 0.10.0 is required"
|
||||
#endif
|
||||
|
||||
int main(void)
|
||||
{
|
||||
(void)ocsd_get_version();
|
||||
|
|
|
@ -59,4 +59,17 @@ static inline int __must_check PTR_ERR_OR_ZERO(__force const void *ptr)
|
|||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* ERR_CAST - Explicitly cast an error-valued pointer to another pointer type
|
||||
* @ptr: The pointer to cast.
|
||||
*
|
||||
* Explicitly cast an error-valued pointer to another pointer type in such a
|
||||
* way as to make it clear that's what's going on.
|
||||
*/
|
||||
static inline void * __must_check ERR_CAST(__force const void *ptr)
|
||||
{
|
||||
/* cast away the const */
|
||||
return (void *) ptr;
|
||||
}
|
||||
#endif /* _LINUX_ERR_H */
|
||||
|
|
|
@ -71,7 +71,7 @@ typedef int parse_opt_cb(const struct option *, const char *arg, int unset);
|
|||
*
|
||||
* `argh`::
|
||||
* token to explain the kind of argument this option wants. Keep it
|
||||
* homogenous across the repository.
|
||||
* homogeneous across the repository.
|
||||
*
|
||||
* `help`::
|
||||
* the short help associated to what the option does.
|
||||
|
@ -80,7 +80,7 @@ typedef int parse_opt_cb(const struct option *, const char *arg, int unset);
|
|||
*
|
||||
* `flags`::
|
||||
* mask of parse_opt_option_flags.
|
||||
* PARSE_OPT_OPTARG: says that the argument is optionnal (not for BOOLEANs)
|
||||
* PARSE_OPT_OPTARG: says that the argument is optional (not for BOOLEANs)
|
||||
* PARSE_OPT_NOARG: says that this option takes no argument, for CALLBACKs
|
||||
* PARSE_OPT_NONEG: says that this option cannot be negated
|
||||
* PARSE_OPT_HIDDEN this option is skipped in the default usage, showed in
|
||||
|
|
|
@ -25,6 +25,7 @@ endef
|
|||
$(call allow-override,CC,$(CROSS_COMPILE)gcc)
|
||||
$(call allow-override,AR,$(CROSS_COMPILE)ar)
|
||||
$(call allow-override,NM,$(CROSS_COMPILE)nm)
|
||||
$(call allow-override,PKG_CONFIG,pkg-config)
|
||||
|
||||
EXT = -std=gnu99
|
||||
INSTALL = install
|
||||
|
@ -47,6 +48,8 @@ prefix ?= /usr/local
|
|||
libdir = $(prefix)/$(libdir_relative)
|
||||
man_dir = $(prefix)/share/man
|
||||
man_dir_SQ = '$(subst ','\'',$(man_dir))'
|
||||
pkgconfig_dir ?= $(word 1,$(shell $(PKG_CONFIG) \
|
||||
--variable pc_path pkg-config | tr ":" " "))
|
||||
|
||||
export man_dir man_dir_SQ INSTALL
|
||||
export DESTDIR DESTDIR_SQ
|
||||
|
@ -270,7 +273,19 @@ define do_generate_dynamic_list_file
|
|||
fi
|
||||
endef
|
||||
|
||||
install_lib: all_cmd install_plugins
|
||||
PKG_CONFIG_FILE = libtraceevent.pc
|
||||
define do_install_pkgconfig_file
|
||||
if [ -n "${pkgconfig_dir}" ]; then \
|
||||
cp -f ${PKG_CONFIG_FILE}.template ${PKG_CONFIG_FILE}; \
|
||||
sed -i "s|INSTALL_PREFIX|${1}|g" ${PKG_CONFIG_FILE}; \
|
||||
sed -i "s|LIB_VERSION|${EVENT_PARSE_VERSION}|g" ${PKG_CONFIG_FILE}; \
|
||||
$(call do_install,$(PKG_CONFIG_FILE),$(pkgconfig_dir),644); \
|
||||
else \
|
||||
(echo Failed to locate pkg-config directory) 1>&2; \
|
||||
fi
|
||||
endef
|
||||
|
||||
install_lib: all_cmd install_plugins install_headers install_pkgconfig
|
||||
$(call QUIET_INSTALL, $(LIB_TARGET)) \
|
||||
$(call do_install_mkdir,$(libdir_SQ)); \
|
||||
cp -fpR $(LIB_INSTALL) $(DESTDIR)$(libdir_SQ)
|
||||
|
@ -279,18 +294,24 @@ install_plugins: $(PLUGINS)
|
|||
$(call QUIET_INSTALL, trace_plugins) \
|
||||
$(call do_install_plugins, $(PLUGINS))
|
||||
|
||||
install_pkgconfig:
|
||||
$(call QUIET_INSTALL, $(PKG_CONFIG_FILE)) \
|
||||
$(call do_install_pkgconfig_file,$(prefix))
|
||||
|
||||
install_headers:
|
||||
$(call QUIET_INSTALL, headers) \
|
||||
$(call do_install,event-parse.h,$(prefix)/include/traceevent,644); \
|
||||
$(call do_install,event-utils.h,$(prefix)/include/traceevent,644); \
|
||||
$(call do_install,trace-seq.h,$(prefix)/include/traceevent,644); \
|
||||
$(call do_install,kbuffer.h,$(prefix)/include/traceevent,644)
|
||||
|
||||
install: install_lib
|
||||
|
||||
clean:
|
||||
$(call QUIET_CLEAN, libtraceevent) \
|
||||
$(RM) *.o *~ $(TARGETS) *.a *.so $(VERSION_FILES) .*.d .*.cmd \
|
||||
$(RM) TRACEEVENT-CFLAGS tags TAGS
|
||||
$(RM) *.o *~ $(TARGETS) *.a *.so $(VERSION_FILES) .*.d .*.cmd; \
|
||||
$(RM) TRACEEVENT-CFLAGS tags TAGS; \
|
||||
$(RM) $(PKG_CONFIG_FILE)
|
||||
|
||||
PHONY += force plugins
|
||||
force:
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
* This returns pointer to the first element of the events array
|
||||
* If @tep is NULL, NULL is returned.
|
||||
*/
|
||||
struct tep_event_format *tep_get_first_event(struct tep_handle *tep)
|
||||
struct tep_event *tep_get_first_event(struct tep_handle *tep)
|
||||
{
|
||||
if (tep && tep->events)
|
||||
return tep->events[0];
|
||||
|
@ -51,7 +51,7 @@ void tep_set_flag(struct tep_handle *tep, int flag)
|
|||
tep->flags |= flag;
|
||||
}
|
||||
|
||||
unsigned short __tep_data2host2(struct tep_handle *pevent, unsigned short data)
|
||||
unsigned short tep_data2host2(struct tep_handle *pevent, unsigned short data)
|
||||
{
|
||||
unsigned short swap;
|
||||
|
||||
|
@ -64,7 +64,7 @@ unsigned short __tep_data2host2(struct tep_handle *pevent, unsigned short data)
|
|||
return swap;
|
||||
}
|
||||
|
||||
unsigned int __tep_data2host4(struct tep_handle *pevent, unsigned int data)
|
||||
unsigned int tep_data2host4(struct tep_handle *pevent, unsigned int data)
|
||||
{
|
||||
unsigned int swap;
|
||||
|
||||
|
@ -80,7 +80,7 @@ unsigned int __tep_data2host4(struct tep_handle *pevent, unsigned int data)
|
|||
}
|
||||
|
||||
unsigned long long
|
||||
__tep_data2host8(struct tep_handle *pevent, unsigned long long data)
|
||||
tep_data2host8(struct tep_handle *pevent, unsigned long long data)
|
||||
{
|
||||
unsigned long long swap;
|
||||
|
||||
|
|
|
@ -50,9 +50,9 @@ struct tep_handle {
|
|||
unsigned int printk_count;
|
||||
|
||||
|
||||
struct tep_event_format **events;
|
||||
struct tep_event **events;
|
||||
int nr_events;
|
||||
struct tep_event_format **sort_events;
|
||||
struct tep_event **sort_events;
|
||||
enum tep_event_sort_type last_type;
|
||||
|
||||
int type_offset;
|
||||
|
@ -84,9 +84,16 @@ struct tep_handle {
|
|||
struct tep_function_handler *func_handlers;
|
||||
|
||||
/* cache */
|
||||
struct tep_event_format *last_event;
|
||||
struct tep_event *last_event;
|
||||
|
||||
char *trace_clock;
|
||||
};
|
||||
|
||||
void tep_free_event(struct tep_event *event);
|
||||
void tep_free_format_field(struct tep_format_field *field);
|
||||
|
||||
unsigned short tep_data2host2(struct tep_handle *pevent, unsigned short data);
|
||||
unsigned int tep_data2host4(struct tep_handle *pevent, unsigned int data);
|
||||
unsigned long long tep_data2host8(struct tep_handle *pevent, unsigned long long data);
|
||||
|
||||
#endif /* _PARSE_EVENTS_INT_H */
|
||||
|
|
|
@ -96,7 +96,7 @@ struct tep_function_handler {
|
|||
|
||||
static unsigned long long
|
||||
process_defined_func(struct trace_seq *s, void *data, int size,
|
||||
struct tep_event_format *event, struct tep_print_arg *arg);
|
||||
struct tep_event *event, struct tep_print_arg *arg);
|
||||
|
||||
static void free_func_handle(struct tep_function_handler *func);
|
||||
|
||||
|
@ -739,16 +739,16 @@ void tep_print_printk(struct tep_handle *pevent)
|
|||
}
|
||||
}
|
||||
|
||||
static struct tep_event_format *alloc_event(void)
|
||||
static struct tep_event *alloc_event(void)
|
||||
{
|
||||
return calloc(1, sizeof(struct tep_event_format));
|
||||
return calloc(1, sizeof(struct tep_event));
|
||||
}
|
||||
|
||||
static int add_event(struct tep_handle *pevent, struct tep_event_format *event)
|
||||
static int add_event(struct tep_handle *pevent, struct tep_event *event)
|
||||
{
|
||||
int i;
|
||||
struct tep_event_format **events = realloc(pevent->events, sizeof(event) *
|
||||
(pevent->nr_events + 1));
|
||||
struct tep_event **events = realloc(pevent->events, sizeof(event) *
|
||||
(pevent->nr_events + 1));
|
||||
if (!events)
|
||||
return -1;
|
||||
|
||||
|
@ -1145,7 +1145,7 @@ static enum tep_event_type read_token(char **tok)
|
|||
}
|
||||
|
||||
/**
|
||||
* tep_read_token - access to utilites to use the pevent parser
|
||||
* tep_read_token - access to utilities to use the pevent parser
|
||||
* @tok: The token to return
|
||||
*
|
||||
* This will parse tokens from the string given by
|
||||
|
@ -1355,7 +1355,7 @@ static unsigned int type_size(const char *name)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int event_read_fields(struct tep_event_format *event, struct tep_format_field **fields)
|
||||
static int event_read_fields(struct tep_event *event, struct tep_format_field **fields)
|
||||
{
|
||||
struct tep_format_field *field = NULL;
|
||||
enum tep_event_type type;
|
||||
|
@ -1642,7 +1642,7 @@ static int event_read_fields(struct tep_event_format *event, struct tep_format_f
|
|||
return -1;
|
||||
}
|
||||
|
||||
static int event_read_format(struct tep_event_format *event)
|
||||
static int event_read_format(struct tep_event *event)
|
||||
{
|
||||
char *token;
|
||||
int ret;
|
||||
|
@ -1675,11 +1675,11 @@ static int event_read_format(struct tep_event_format *event)
|
|||
}
|
||||
|
||||
static enum tep_event_type
|
||||
process_arg_token(struct tep_event_format *event, struct tep_print_arg *arg,
|
||||
process_arg_token(struct tep_event *event, struct tep_print_arg *arg,
|
||||
char **tok, enum tep_event_type type);
|
||||
|
||||
static enum tep_event_type
|
||||
process_arg(struct tep_event_format *event, struct tep_print_arg *arg, char **tok)
|
||||
process_arg(struct tep_event *event, struct tep_print_arg *arg, char **tok)
|
||||
{
|
||||
enum tep_event_type type;
|
||||
char *token;
|
||||
|
@ -1691,14 +1691,14 @@ process_arg(struct tep_event_format *event, struct tep_print_arg *arg, char **to
|
|||
}
|
||||
|
||||
static enum tep_event_type
|
||||
process_op(struct tep_event_format *event, struct tep_print_arg *arg, char **tok);
|
||||
process_op(struct tep_event *event, struct tep_print_arg *arg, char **tok);
|
||||
|
||||
/*
|
||||
* For __print_symbolic() and __print_flags, we need to completely
|
||||
* evaluate the first argument, which defines what to print next.
|
||||
*/
|
||||
static enum tep_event_type
|
||||
process_field_arg(struct tep_event_format *event, struct tep_print_arg *arg, char **tok)
|
||||
process_field_arg(struct tep_event *event, struct tep_print_arg *arg, char **tok)
|
||||
{
|
||||
enum tep_event_type type;
|
||||
|
||||
|
@ -1712,7 +1712,7 @@ process_field_arg(struct tep_event_format *event, struct tep_print_arg *arg, cha
|
|||
}
|
||||
|
||||
static enum tep_event_type
|
||||
process_cond(struct tep_event_format *event, struct tep_print_arg *top, char **tok)
|
||||
process_cond(struct tep_event *event, struct tep_print_arg *top, char **tok)
|
||||
{
|
||||
struct tep_print_arg *arg, *left, *right;
|
||||
enum tep_event_type type;
|
||||
|
@ -1768,7 +1768,7 @@ process_cond(struct tep_event_format *event, struct tep_print_arg *top, char **t
|
|||
}
|
||||
|
||||
static enum tep_event_type
|
||||
process_array(struct tep_event_format *event, struct tep_print_arg *top, char **tok)
|
||||
process_array(struct tep_event *event, struct tep_print_arg *top, char **tok)
|
||||
{
|
||||
struct tep_print_arg *arg;
|
||||
enum tep_event_type type;
|
||||
|
@ -1870,7 +1870,7 @@ static int set_op_prio(struct tep_print_arg *arg)
|
|||
|
||||
/* Note, *tok does not get freed, but will most likely be saved */
|
||||
static enum tep_event_type
|
||||
process_op(struct tep_event_format *event, struct tep_print_arg *arg, char **tok)
|
||||
process_op(struct tep_event *event, struct tep_print_arg *arg, char **tok)
|
||||
{
|
||||
struct tep_print_arg *left, *right = NULL;
|
||||
enum tep_event_type type;
|
||||
|
@ -2071,7 +2071,7 @@ process_op(struct tep_event_format *event, struct tep_print_arg *arg, char **tok
|
|||
}
|
||||
|
||||
static enum tep_event_type
|
||||
process_entry(struct tep_event_format *event __maybe_unused, struct tep_print_arg *arg,
|
||||
process_entry(struct tep_event *event __maybe_unused, struct tep_print_arg *arg,
|
||||
char **tok)
|
||||
{
|
||||
enum tep_event_type type;
|
||||
|
@ -2110,7 +2110,7 @@ process_entry(struct tep_event_format *event __maybe_unused, struct tep_print_ar
|
|||
return TEP_EVENT_ERROR;
|
||||
}
|
||||
|
||||
static int alloc_and_process_delim(struct tep_event_format *event, char *next_token,
|
||||
static int alloc_and_process_delim(struct tep_event *event, char *next_token,
|
||||
struct tep_print_arg **print_arg)
|
||||
{
|
||||
struct tep_print_arg *field;
|
||||
|
@ -2445,7 +2445,7 @@ static char *arg_eval (struct tep_print_arg *arg)
|
|||
}
|
||||
|
||||
static enum tep_event_type
|
||||
process_fields(struct tep_event_format *event, struct tep_print_flag_sym **list, char **tok)
|
||||
process_fields(struct tep_event *event, struct tep_print_flag_sym **list, char **tok)
|
||||
{
|
||||
enum tep_event_type type;
|
||||
struct tep_print_arg *arg = NULL;
|
||||
|
@ -2526,7 +2526,7 @@ process_fields(struct tep_event_format *event, struct tep_print_flag_sym **list,
|
|||
}
|
||||
|
||||
static enum tep_event_type
|
||||
process_flags(struct tep_event_format *event, struct tep_print_arg *arg, char **tok)
|
||||
process_flags(struct tep_event *event, struct tep_print_arg *arg, char **tok)
|
||||
{
|
||||
struct tep_print_arg *field;
|
||||
enum tep_event_type type;
|
||||
|
@ -2579,7 +2579,7 @@ process_flags(struct tep_event_format *event, struct tep_print_arg *arg, char **
|
|||
}
|
||||
|
||||
static enum tep_event_type
|
||||
process_symbols(struct tep_event_format *event, struct tep_print_arg *arg, char **tok)
|
||||
process_symbols(struct tep_event *event, struct tep_print_arg *arg, char **tok)
|
||||
{
|
||||
struct tep_print_arg *field;
|
||||
enum tep_event_type type;
|
||||
|
@ -2618,7 +2618,7 @@ process_symbols(struct tep_event_format *event, struct tep_print_arg *arg, char
|
|||
}
|
||||
|
||||
static enum tep_event_type
|
||||
process_hex_common(struct tep_event_format *event, struct tep_print_arg *arg,
|
||||
process_hex_common(struct tep_event *event, struct tep_print_arg *arg,
|
||||
char **tok, enum tep_print_arg_type type)
|
||||
{
|
||||
memset(arg, 0, sizeof(*arg));
|
||||
|
@ -2641,20 +2641,20 @@ process_hex_common(struct tep_event_format *event, struct tep_print_arg *arg,
|
|||
}
|
||||
|
||||
static enum tep_event_type
|
||||
process_hex(struct tep_event_format *event, struct tep_print_arg *arg, char **tok)
|
||||
process_hex(struct tep_event *event, struct tep_print_arg *arg, char **tok)
|
||||
{
|
||||
return process_hex_common(event, arg, tok, TEP_PRINT_HEX);
|
||||
}
|
||||
|
||||
static enum tep_event_type
|
||||
process_hex_str(struct tep_event_format *event, struct tep_print_arg *arg,
|
||||
process_hex_str(struct tep_event *event, struct tep_print_arg *arg,
|
||||
char **tok)
|
||||
{
|
||||
return process_hex_common(event, arg, tok, TEP_PRINT_HEX_STR);
|
||||
}
|
||||
|
||||
static enum tep_event_type
|
||||
process_int_array(struct tep_event_format *event, struct tep_print_arg *arg, char **tok)
|
||||
process_int_array(struct tep_event *event, struct tep_print_arg *arg, char **tok)
|
||||
{
|
||||
memset(arg, 0, sizeof(*arg));
|
||||
arg->type = TEP_PRINT_INT_ARRAY;
|
||||
|
@ -2682,7 +2682,7 @@ process_int_array(struct tep_event_format *event, struct tep_print_arg *arg, cha
|
|||
}
|
||||
|
||||
static enum tep_event_type
|
||||
process_dynamic_array(struct tep_event_format *event, struct tep_print_arg *arg, char **tok)
|
||||
process_dynamic_array(struct tep_event *event, struct tep_print_arg *arg, char **tok)
|
||||
{
|
||||
struct tep_format_field *field;
|
||||
enum tep_event_type type;
|
||||
|
@ -2746,7 +2746,7 @@ process_dynamic_array(struct tep_event_format *event, struct tep_print_arg *arg,
|
|||
}
|
||||
|
||||
static enum tep_event_type
|
||||
process_dynamic_array_len(struct tep_event_format *event, struct tep_print_arg *arg,
|
||||
process_dynamic_array_len(struct tep_event *event, struct tep_print_arg *arg,
|
||||
char **tok)
|
||||
{
|
||||
struct tep_format_field *field;
|
||||
|
@ -2782,7 +2782,7 @@ process_dynamic_array_len(struct tep_event_format *event, struct tep_print_arg *
|
|||
}
|
||||
|
||||
static enum tep_event_type
|
||||
process_paren(struct tep_event_format *event, struct tep_print_arg *arg, char **tok)
|
||||
process_paren(struct tep_event *event, struct tep_print_arg *arg, char **tok)
|
||||
{
|
||||
struct tep_print_arg *item_arg;
|
||||
enum tep_event_type type;
|
||||
|
@ -2845,7 +2845,7 @@ process_paren(struct tep_event_format *event, struct tep_print_arg *arg, char **
|
|||
|
||||
|
||||
static enum tep_event_type
|
||||
process_str(struct tep_event_format *event __maybe_unused, struct tep_print_arg *arg,
|
||||
process_str(struct tep_event *event __maybe_unused, struct tep_print_arg *arg,
|
||||
char **tok)
|
||||
{
|
||||
enum tep_event_type type;
|
||||
|
@ -2874,7 +2874,7 @@ process_str(struct tep_event_format *event __maybe_unused, struct tep_print_arg
|
|||
}
|
||||
|
||||
static enum tep_event_type
|
||||
process_bitmask(struct tep_event_format *event __maybe_unused, struct tep_print_arg *arg,
|
||||
process_bitmask(struct tep_event *event __maybe_unused, struct tep_print_arg *arg,
|
||||
char **tok)
|
||||
{
|
||||
enum tep_event_type type;
|
||||
|
@ -2935,7 +2935,7 @@ static void remove_func_handler(struct tep_handle *pevent, char *func_name)
|
|||
}
|
||||
|
||||
static enum tep_event_type
|
||||
process_func_handler(struct tep_event_format *event, struct tep_function_handler *func,
|
||||
process_func_handler(struct tep_event *event, struct tep_function_handler *func,
|
||||
struct tep_print_arg *arg, char **tok)
|
||||
{
|
||||
struct tep_print_arg **next_arg;
|
||||
|
@ -2993,7 +2993,7 @@ process_func_handler(struct tep_event_format *event, struct tep_function_handler
|
|||
}
|
||||
|
||||
static enum tep_event_type
|
||||
process_function(struct tep_event_format *event, struct tep_print_arg *arg,
|
||||
process_function(struct tep_event *event, struct tep_print_arg *arg,
|
||||
char *token, char **tok)
|
||||
{
|
||||
struct tep_function_handler *func;
|
||||
|
@ -3049,7 +3049,7 @@ process_function(struct tep_event_format *event, struct tep_print_arg *arg,
|
|||
}
|
||||
|
||||
static enum tep_event_type
|
||||
process_arg_token(struct tep_event_format *event, struct tep_print_arg *arg,
|
||||
process_arg_token(struct tep_event *event, struct tep_print_arg *arg,
|
||||
char **tok, enum tep_event_type type)
|
||||
{
|
||||
char *token;
|
||||
|
@ -3137,7 +3137,7 @@ process_arg_token(struct tep_event_format *event, struct tep_print_arg *arg,
|
|||
return type;
|
||||
}
|
||||
|
||||
static int event_read_print_args(struct tep_event_format *event, struct tep_print_arg **list)
|
||||
static int event_read_print_args(struct tep_event *event, struct tep_print_arg **list)
|
||||
{
|
||||
enum tep_event_type type = TEP_EVENT_ERROR;
|
||||
struct tep_print_arg *arg;
|
||||
|
@ -3195,7 +3195,7 @@ static int event_read_print_args(struct tep_event_format *event, struct tep_prin
|
|||
return args;
|
||||
}
|
||||
|
||||
static int event_read_print(struct tep_event_format *event)
|
||||
static int event_read_print(struct tep_event *event)
|
||||
{
|
||||
enum tep_event_type type;
|
||||
char *token;
|
||||
|
@ -3258,10 +3258,10 @@ static int event_read_print(struct tep_event_format *event)
|
|||
* @name: the name of the common field to return
|
||||
*
|
||||
* Returns a common field from the event by the given @name.
|
||||
* This only searchs the common fields and not all field.
|
||||
* This only searches the common fields and not all field.
|
||||
*/
|
||||
struct tep_format_field *
|
||||
tep_find_common_field(struct tep_event_format *event, const char *name)
|
||||
tep_find_common_field(struct tep_event *event, const char *name)
|
||||
{
|
||||
struct tep_format_field *format;
|
||||
|
||||
|
@ -3283,7 +3283,7 @@ tep_find_common_field(struct tep_event_format *event, const char *name)
|
|||
* This does not search common fields.
|
||||
*/
|
||||
struct tep_format_field *
|
||||
tep_find_field(struct tep_event_format *event, const char *name)
|
||||
tep_find_field(struct tep_event *event, const char *name)
|
||||
{
|
||||
struct tep_format_field *format;
|
||||
|
||||
|
@ -3302,11 +3302,11 @@ tep_find_field(struct tep_event_format *event, const char *name)
|
|||
* @name: the name of the field
|
||||
*
|
||||
* Returns a field by the given @name.
|
||||
* This searchs the common field names first, then
|
||||
* This searches the common field names first, then
|
||||
* the non-common ones if a common one was not found.
|
||||
*/
|
||||
struct tep_format_field *
|
||||
tep_find_any_field(struct tep_event_format *event, const char *name)
|
||||
tep_find_any_field(struct tep_event *event, const char *name)
|
||||
{
|
||||
struct tep_format_field *format;
|
||||
|
||||
|
@ -3328,15 +3328,18 @@ tep_find_any_field(struct tep_event_format *event, const char *name)
|
|||
unsigned long long tep_read_number(struct tep_handle *pevent,
|
||||
const void *ptr, int size)
|
||||
{
|
||||
unsigned long long val;
|
||||
|
||||
switch (size) {
|
||||
case 1:
|
||||
return *(unsigned char *)ptr;
|
||||
case 2:
|
||||
return tep_data2host2(pevent, ptr);
|
||||
return tep_data2host2(pevent, *(unsigned short *)ptr);
|
||||
case 4:
|
||||
return tep_data2host4(pevent, ptr);
|
||||
return tep_data2host4(pevent, *(unsigned int *)ptr);
|
||||
case 8:
|
||||
return tep_data2host8(pevent, ptr);
|
||||
memcpy(&val, (ptr), sizeof(unsigned long long));
|
||||
return tep_data2host8(pevent, val);
|
||||
default:
|
||||
/* BUG! */
|
||||
return 0;
|
||||
|
@ -3375,7 +3378,7 @@ int tep_read_number_field(struct tep_format_field *field, const void *data,
|
|||
static int get_common_info(struct tep_handle *pevent,
|
||||
const char *type, int *offset, int *size)
|
||||
{
|
||||
struct tep_event_format *event;
|
||||
struct tep_event *event;
|
||||
struct tep_format_field *field;
|
||||
|
||||
/*
|
||||
|
@ -3462,11 +3465,11 @@ static int events_id_cmp(const void *a, const void *b);
|
|||
*
|
||||
* Returns an event that has a given @id.
|
||||
*/
|
||||
struct tep_event_format *tep_find_event(struct tep_handle *pevent, int id)
|
||||
struct tep_event *tep_find_event(struct tep_handle *pevent, int id)
|
||||
{
|
||||
struct tep_event_format **eventptr;
|
||||
struct tep_event_format key;
|
||||
struct tep_event_format *pkey = &key;
|
||||
struct tep_event **eventptr;
|
||||
struct tep_event key;
|
||||
struct tep_event *pkey = &key;
|
||||
|
||||
/* Check cache first */
|
||||
if (pevent->last_event && pevent->last_event->id == id)
|
||||
|
@ -3494,11 +3497,11 @@ struct tep_event_format *tep_find_event(struct tep_handle *pevent, int id)
|
|||
* This returns an event with a given @name and under the system
|
||||
* @sys. If @sys is NULL the first event with @name is returned.
|
||||
*/
|
||||
struct tep_event_format *
|
||||
struct tep_event *
|
||||
tep_find_event_by_name(struct tep_handle *pevent,
|
||||
const char *sys, const char *name)
|
||||
{
|
||||
struct tep_event_format *event;
|
||||
struct tep_event *event = NULL;
|
||||
int i;
|
||||
|
||||
if (pevent->last_event &&
|
||||
|
@ -3523,7 +3526,7 @@ tep_find_event_by_name(struct tep_handle *pevent,
|
|||
}
|
||||
|
||||
static unsigned long long
|
||||
eval_num_arg(void *data, int size, struct tep_event_format *event, struct tep_print_arg *arg)
|
||||
eval_num_arg(void *data, int size, struct tep_event *event, struct tep_print_arg *arg)
|
||||
{
|
||||
struct tep_handle *pevent = event->pevent;
|
||||
unsigned long long val = 0;
|
||||
|
@ -3838,7 +3841,7 @@ static void print_bitmask_to_seq(struct tep_handle *pevent,
|
|||
/*
|
||||
* data points to a bit mask of size bytes.
|
||||
* In the kernel, this is an array of long words, thus
|
||||
* endianess is very important.
|
||||
* endianness is very important.
|
||||
*/
|
||||
if (pevent->file_bigendian)
|
||||
index = size - (len + 1);
|
||||
|
@ -3863,7 +3866,7 @@ static void print_bitmask_to_seq(struct tep_handle *pevent,
|
|||
}
|
||||
|
||||
static void print_str_arg(struct trace_seq *s, void *data, int size,
|
||||
struct tep_event_format *event, const char *format,
|
||||
struct tep_event *event, const char *format,
|
||||
int len_arg, struct tep_print_arg *arg)
|
||||
{
|
||||
struct tep_handle *pevent = event->pevent;
|
||||
|
@ -4062,7 +4065,7 @@ static void print_str_arg(struct trace_seq *s, void *data, int size,
|
|||
f = tep_find_any_field(event, arg->string.string);
|
||||
arg->string.offset = f->offset;
|
||||
}
|
||||
str_offset = tep_data2host4(pevent, data + arg->string.offset);
|
||||
str_offset = tep_data2host4(pevent, *(unsigned int *)(data + arg->string.offset));
|
||||
str_offset &= 0xffff;
|
||||
print_str_to_seq(s, format, len_arg, ((char *)data) + str_offset);
|
||||
break;
|
||||
|
@ -4080,7 +4083,7 @@ static void print_str_arg(struct trace_seq *s, void *data, int size,
|
|||
f = tep_find_any_field(event, arg->bitmask.bitmask);
|
||||
arg->bitmask.offset = f->offset;
|
||||
}
|
||||
bitmask_offset = tep_data2host4(pevent, data + arg->bitmask.offset);
|
||||
bitmask_offset = tep_data2host4(pevent, *(unsigned int *)(data + arg->bitmask.offset));
|
||||
bitmask_size = bitmask_offset >> 16;
|
||||
bitmask_offset &= 0xffff;
|
||||
print_bitmask_to_seq(pevent, s, format, len_arg,
|
||||
|
@ -4118,7 +4121,7 @@ static void print_str_arg(struct trace_seq *s, void *data, int size,
|
|||
|
||||
static unsigned long long
|
||||
process_defined_func(struct trace_seq *s, void *data, int size,
|
||||
struct tep_event_format *event, struct tep_print_arg *arg)
|
||||
struct tep_event *event, struct tep_print_arg *arg)
|
||||
{
|
||||
struct tep_function_handler *func_handle = arg->func.func;
|
||||
struct func_params *param;
|
||||
|
@ -4213,7 +4216,7 @@ static void free_args(struct tep_print_arg *args)
|
|||
}
|
||||
}
|
||||
|
||||
static struct tep_print_arg *make_bprint_args(char *fmt, void *data, int size, struct tep_event_format *event)
|
||||
static struct tep_print_arg *make_bprint_args(char *fmt, void *data, int size, struct tep_event *event)
|
||||
{
|
||||
struct tep_handle *pevent = event->pevent;
|
||||
struct tep_format_field *field, *ip_field;
|
||||
|
@ -4221,7 +4224,7 @@ static struct tep_print_arg *make_bprint_args(char *fmt, void *data, int size, s
|
|||
unsigned long long ip, val;
|
||||
char *ptr;
|
||||
void *bptr;
|
||||
int vsize;
|
||||
int vsize = 0;
|
||||
|
||||
field = pevent->bprint_buf_field;
|
||||
ip_field = pevent->bprint_ip_field;
|
||||
|
@ -4390,7 +4393,7 @@ static struct tep_print_arg *make_bprint_args(char *fmt, void *data, int size, s
|
|||
|
||||
static char *
|
||||
get_bprint_format(void *data, int size __maybe_unused,
|
||||
struct tep_event_format *event)
|
||||
struct tep_event *event)
|
||||
{
|
||||
struct tep_handle *pevent = event->pevent;
|
||||
unsigned long long addr;
|
||||
|
@ -4425,7 +4428,7 @@ get_bprint_format(void *data, int size __maybe_unused,
|
|||
}
|
||||
|
||||
static void print_mac_arg(struct trace_seq *s, int mac, void *data, int size,
|
||||
struct tep_event_format *event, struct tep_print_arg *arg)
|
||||
struct tep_event *event, struct tep_print_arg *arg)
|
||||
{
|
||||
unsigned char *buf;
|
||||
const char *fmt = "%.2x:%.2x:%.2x:%.2x:%.2x:%.2x";
|
||||
|
@ -4578,7 +4581,7 @@ static void print_ip6_addr(struct trace_seq *s, char i, unsigned char *buf)
|
|||
* %pISpc print an IP address based on sockaddr; p adds port.
|
||||
*/
|
||||
static int print_ipv4_arg(struct trace_seq *s, const char *ptr, char i,
|
||||
void *data, int size, struct tep_event_format *event,
|
||||
void *data, int size, struct tep_event *event,
|
||||
struct tep_print_arg *arg)
|
||||
{
|
||||
unsigned char *buf;
|
||||
|
@ -4615,7 +4618,7 @@ static int print_ipv4_arg(struct trace_seq *s, const char *ptr, char i,
|
|||
}
|
||||
|
||||
static int print_ipv6_arg(struct trace_seq *s, const char *ptr, char i,
|
||||
void *data, int size, struct tep_event_format *event,
|
||||
void *data, int size, struct tep_event *event,
|
||||
struct tep_print_arg *arg)
|
||||
{
|
||||
char have_c = 0;
|
||||
|
@ -4665,7 +4668,7 @@ static int print_ipv6_arg(struct trace_seq *s, const char *ptr, char i,
|
|||
}
|
||||
|
||||
static int print_ipsa_arg(struct trace_seq *s, const char *ptr, char i,
|
||||
void *data, int size, struct tep_event_format *event,
|
||||
void *data, int size, struct tep_event *event,
|
||||
struct tep_print_arg *arg)
|
||||
{
|
||||
char have_c = 0, have_p = 0;
|
||||
|
@ -4747,7 +4750,7 @@ static int print_ipsa_arg(struct trace_seq *s, const char *ptr, char i,
|
|||
}
|
||||
|
||||
static int print_ip_arg(struct trace_seq *s, const char *ptr,
|
||||
void *data, int size, struct tep_event_format *event,
|
||||
void *data, int size, struct tep_event *event,
|
||||
struct tep_print_arg *arg)
|
||||
{
|
||||
char i = *ptr; /* 'i' or 'I' */
|
||||
|
@ -4854,7 +4857,7 @@ void tep_print_field(struct trace_seq *s, void *data,
|
|||
}
|
||||
|
||||
void tep_print_fields(struct trace_seq *s, void *data,
|
||||
int size __maybe_unused, struct tep_event_format *event)
|
||||
int size __maybe_unused, struct tep_event *event)
|
||||
{
|
||||
struct tep_format_field *field;
|
||||
|
||||
|
@ -4866,7 +4869,7 @@ void tep_print_fields(struct trace_seq *s, void *data,
|
|||
}
|
||||
}
|
||||
|
||||
static void pretty_print(struct trace_seq *s, void *data, int size, struct tep_event_format *event)
|
||||
static void pretty_print(struct trace_seq *s, void *data, int size, struct tep_event *event)
|
||||
{
|
||||
struct tep_handle *pevent = event->pevent;
|
||||
struct tep_print_fmt *print_fmt = &event->print_fmt;
|
||||
|
@ -4881,7 +4884,7 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct tep_e
|
|||
char format[32];
|
||||
int show_func;
|
||||
int len_as_arg;
|
||||
int len_arg;
|
||||
int len_arg = 0;
|
||||
int len;
|
||||
int ls;
|
||||
|
||||
|
@ -5146,8 +5149,8 @@ void tep_data_lat_fmt(struct tep_handle *pevent,
|
|||
static int migrate_disable_exists;
|
||||
unsigned int lat_flags;
|
||||
unsigned int pc;
|
||||
int lock_depth;
|
||||
int migrate_disable;
|
||||
int lock_depth = 0;
|
||||
int migrate_disable = 0;
|
||||
int hardirq;
|
||||
int softirq;
|
||||
void *data = record->data;
|
||||
|
@ -5229,7 +5232,7 @@ int tep_data_type(struct tep_handle *pevent, struct tep_record *rec)
|
|||
*
|
||||
* This returns the event form a given @type;
|
||||
*/
|
||||
struct tep_event_format *tep_data_event_from_type(struct tep_handle *pevent, int type)
|
||||
struct tep_event *tep_data_event_from_type(struct tep_handle *pevent, int type)
|
||||
{
|
||||
return tep_find_event(pevent, type);
|
||||
}
|
||||
|
@ -5313,9 +5316,9 @@ pid_from_cmdlist(struct tep_handle *pevent, const char *comm, struct cmdline *ne
|
|||
* This returns the cmdline structure that holds a pid for a given
|
||||
* comm, or NULL if none found. As there may be more than one pid for
|
||||
* a given comm, the result of this call can be passed back into
|
||||
* a recurring call in the @next paramater, and then it will find the
|
||||
* a recurring call in the @next parameter, and then it will find the
|
||||
* next pid.
|
||||
* Also, it does a linear seach, so it may be slow.
|
||||
* Also, it does a linear search, so it may be slow.
|
||||
*/
|
||||
struct cmdline *tep_data_pid_from_comm(struct tep_handle *pevent, const char *comm,
|
||||
struct cmdline *next)
|
||||
|
@ -5387,7 +5390,7 @@ int tep_cmdline_pid(struct tep_handle *pevent, struct cmdline *cmdline)
|
|||
* This parses the raw @data using the given @event information and
|
||||
* writes the print format into the trace_seq.
|
||||
*/
|
||||
void tep_event_info(struct trace_seq *s, struct tep_event_format *event,
|
||||
void tep_event_info(struct trace_seq *s, struct tep_event *event,
|
||||
struct tep_record *record)
|
||||
{
|
||||
int print_pretty = 1;
|
||||
|
@ -5409,7 +5412,7 @@ void tep_event_info(struct trace_seq *s, struct tep_event_format *event,
|
|||
|
||||
static bool is_timestamp_in_us(char *trace_clock, bool use_trace_clock)
|
||||
{
|
||||
if (!use_trace_clock)
|
||||
if (!trace_clock || !use_trace_clock)
|
||||
return true;
|
||||
|
||||
if (!strcmp(trace_clock, "local") || !strcmp(trace_clock, "global")
|
||||
|
@ -5428,7 +5431,7 @@ static bool is_timestamp_in_us(char *trace_clock, bool use_trace_clock)
|
|||
* Returns the associated event for a given record, or NULL if non is
|
||||
* is found.
|
||||
*/
|
||||
struct tep_event_format *
|
||||
struct tep_event *
|
||||
tep_find_event_by_record(struct tep_handle *pevent, struct tep_record *record)
|
||||
{
|
||||
int type;
|
||||
|
@ -5453,7 +5456,7 @@ tep_find_event_by_record(struct tep_handle *pevent, struct tep_record *record)
|
|||
* Writes the tasks comm, pid and CPU to @s.
|
||||
*/
|
||||
void tep_print_event_task(struct tep_handle *pevent, struct trace_seq *s,
|
||||
struct tep_event_format *event,
|
||||
struct tep_event *event,
|
||||
struct tep_record *record)
|
||||
{
|
||||
void *data = record->data;
|
||||
|
@ -5481,7 +5484,7 @@ void tep_print_event_task(struct tep_handle *pevent, struct trace_seq *s,
|
|||
* Writes the timestamp of the record into @s.
|
||||
*/
|
||||
void tep_print_event_time(struct tep_handle *pevent, struct trace_seq *s,
|
||||
struct tep_event_format *event,
|
||||
struct tep_event *event,
|
||||
struct tep_record *record,
|
||||
bool use_trace_clock)
|
||||
{
|
||||
|
@ -5531,7 +5534,7 @@ void tep_print_event_time(struct tep_handle *pevent, struct trace_seq *s,
|
|||
* Writes the parsing of the record's data to @s.
|
||||
*/
|
||||
void tep_print_event_data(struct tep_handle *pevent, struct trace_seq *s,
|
||||
struct tep_event_format *event,
|
||||
struct tep_event *event,
|
||||
struct tep_record *record)
|
||||
{
|
||||
static const char *spaces = " "; /* 20 spaces */
|
||||
|
@ -5550,7 +5553,7 @@ void tep_print_event_data(struct tep_handle *pevent, struct trace_seq *s,
|
|||
void tep_print_event(struct tep_handle *pevent, struct trace_seq *s,
|
||||
struct tep_record *record, bool use_trace_clock)
|
||||
{
|
||||
struct tep_event_format *event;
|
||||
struct tep_event *event;
|
||||
|
||||
event = tep_find_event_by_record(pevent, record);
|
||||
if (!event) {
|
||||
|
@ -5572,8 +5575,8 @@ void tep_print_event(struct tep_handle *pevent, struct trace_seq *s,
|
|||
|
||||
static int events_id_cmp(const void *a, const void *b)
|
||||
{
|
||||
struct tep_event_format * const * ea = a;
|
||||
struct tep_event_format * const * eb = b;
|
||||
struct tep_event * const * ea = a;
|
||||
struct tep_event * const * eb = b;
|
||||
|
||||
if ((*ea)->id < (*eb)->id)
|
||||
return -1;
|
||||
|
@ -5586,8 +5589,8 @@ static int events_id_cmp(const void *a, const void *b)
|
|||
|
||||
static int events_name_cmp(const void *a, const void *b)
|
||||
{
|
||||
struct tep_event_format * const * ea = a;
|
||||
struct tep_event_format * const * eb = b;
|
||||
struct tep_event * const * ea = a;
|
||||
struct tep_event * const * eb = b;
|
||||
int res;
|
||||
|
||||
res = strcmp((*ea)->name, (*eb)->name);
|
||||
|
@ -5603,8 +5606,8 @@ static int events_name_cmp(const void *a, const void *b)
|
|||
|
||||
static int events_system_cmp(const void *a, const void *b)
|
||||
{
|
||||
struct tep_event_format * const * ea = a;
|
||||
struct tep_event_format * const * eb = b;
|
||||
struct tep_event * const * ea = a;
|
||||
struct tep_event * const * eb = b;
|
||||
int res;
|
||||
|
||||
res = strcmp((*ea)->system, (*eb)->system);
|
||||
|
@ -5618,9 +5621,9 @@ static int events_system_cmp(const void *a, const void *b)
|
|||
return events_id_cmp(a, b);
|
||||
}
|
||||
|
||||
struct tep_event_format **tep_list_events(struct tep_handle *pevent, enum tep_event_sort_type sort_type)
|
||||
struct tep_event **tep_list_events(struct tep_handle *pevent, enum tep_event_sort_type sort_type)
|
||||
{
|
||||
struct tep_event_format **events;
|
||||
struct tep_event **events;
|
||||
int (*sort)(const void *a, const void *b);
|
||||
|
||||
events = pevent->sort_events;
|
||||
|
@ -5703,7 +5706,7 @@ get_event_fields(const char *type, const char *name,
|
|||
* Returns an allocated array of fields. The last item in the array is NULL.
|
||||
* The array must be freed with free().
|
||||
*/
|
||||
struct tep_format_field **tep_event_common_fields(struct tep_event_format *event)
|
||||
struct tep_format_field **tep_event_common_fields(struct tep_event *event)
|
||||
{
|
||||
return get_event_fields("common", event->name,
|
||||
event->format.nr_common,
|
||||
|
@ -5717,7 +5720,7 @@ struct tep_format_field **tep_event_common_fields(struct tep_event_format *event
|
|||
* Returns an allocated array of fields. The last item in the array is NULL.
|
||||
* The array must be freed with free().
|
||||
*/
|
||||
struct tep_format_field **tep_event_fields(struct tep_event_format *event)
|
||||
struct tep_format_field **tep_event_fields(struct tep_event *event)
|
||||
{
|
||||
return get_event_fields("event", event->name,
|
||||
event->format.nr_fields,
|
||||
|
@ -5959,7 +5962,7 @@ int tep_parse_header_page(struct tep_handle *pevent, char *buf, unsigned long si
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int event_matches(struct tep_event_format *event,
|
||||
static int event_matches(struct tep_event *event,
|
||||
int id, const char *sys_name,
|
||||
const char *event_name)
|
||||
{
|
||||
|
@ -5982,7 +5985,7 @@ static void free_handler(struct event_handler *handle)
|
|||
free(handle);
|
||||
}
|
||||
|
||||
static int find_event_handle(struct tep_handle *pevent, struct tep_event_format *event)
|
||||
static int find_event_handle(struct tep_handle *pevent, struct tep_event *event)
|
||||
{
|
||||
struct event_handler *handle, **next;
|
||||
|
||||
|
@ -6023,11 +6026,11 @@ static int find_event_handle(struct tep_handle *pevent, struct tep_event_format
|
|||
*
|
||||
* /sys/kernel/debug/tracing/events/.../.../format
|
||||
*/
|
||||
enum tep_errno __tep_parse_format(struct tep_event_format **eventp,
|
||||
enum tep_errno __tep_parse_format(struct tep_event **eventp,
|
||||
struct tep_handle *pevent, const char *buf,
|
||||
unsigned long size, const char *sys)
|
||||
{
|
||||
struct tep_event_format *event;
|
||||
struct tep_event *event;
|
||||
int ret;
|
||||
|
||||
init_input_buf(buf, size);
|
||||
|
@ -6132,12 +6135,12 @@ enum tep_errno __tep_parse_format(struct tep_event_format **eventp,
|
|||
|
||||
static enum tep_errno
|
||||
__parse_event(struct tep_handle *pevent,
|
||||
struct tep_event_format **eventp,
|
||||
struct tep_event **eventp,
|
||||
const char *buf, unsigned long size,
|
||||
const char *sys)
|
||||
{
|
||||
int ret = __tep_parse_format(eventp, pevent, buf, size, sys);
|
||||
struct tep_event_format *event = *eventp;
|
||||
struct tep_event *event = *eventp;
|
||||
|
||||
if (event == NULL)
|
||||
return ret;
|
||||
|
@ -6154,7 +6157,7 @@ __parse_event(struct tep_handle *pevent,
|
|||
return 0;
|
||||
|
||||
event_add_failed:
|
||||
tep_free_format(event);
|
||||
tep_free_event(event);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -6174,7 +6177,7 @@ __parse_event(struct tep_handle *pevent,
|
|||
* /sys/kernel/debug/tracing/events/.../.../format
|
||||
*/
|
||||
enum tep_errno tep_parse_format(struct tep_handle *pevent,
|
||||
struct tep_event_format **eventp,
|
||||
struct tep_event **eventp,
|
||||
const char *buf,
|
||||
unsigned long size, const char *sys)
|
||||
{
|
||||
|
@ -6198,7 +6201,7 @@ enum tep_errno tep_parse_format(struct tep_handle *pevent,
|
|||
enum tep_errno tep_parse_event(struct tep_handle *pevent, const char *buf,
|
||||
unsigned long size, const char *sys)
|
||||
{
|
||||
struct tep_event_format *event = NULL;
|
||||
struct tep_event *event = NULL;
|
||||
return __parse_event(pevent, &event, buf, size, sys);
|
||||
}
|
||||
|
||||
|
@ -6235,7 +6238,7 @@ int get_field_val(struct trace_seq *s, struct tep_format_field *field,
|
|||
*
|
||||
* On failure, it returns NULL.
|
||||
*/
|
||||
void *tep_get_field_raw(struct trace_seq *s, struct tep_event_format *event,
|
||||
void *tep_get_field_raw(struct trace_seq *s, struct tep_event *event,
|
||||
const char *name, struct tep_record *record,
|
||||
int *len, int err)
|
||||
{
|
||||
|
@ -6282,7 +6285,7 @@ void *tep_get_field_raw(struct trace_seq *s, struct tep_event_format *event,
|
|||
*
|
||||
* Returns 0 on success -1 on field not found.
|
||||
*/
|
||||
int tep_get_field_val(struct trace_seq *s, struct tep_event_format *event,
|
||||
int tep_get_field_val(struct trace_seq *s, struct tep_event *event,
|
||||
const char *name, struct tep_record *record,
|
||||
unsigned long long *val, int err)
|
||||
{
|
||||
|
@ -6307,7 +6310,7 @@ int tep_get_field_val(struct trace_seq *s, struct tep_event_format *event,
|
|||
*
|
||||
* Returns 0 on success -1 on field not found.
|
||||
*/
|
||||
int tep_get_common_field_val(struct trace_seq *s, struct tep_event_format *event,
|
||||
int tep_get_common_field_val(struct trace_seq *s, struct tep_event *event,
|
||||
const char *name, struct tep_record *record,
|
||||
unsigned long long *val, int err)
|
||||
{
|
||||
|
@ -6332,7 +6335,7 @@ int tep_get_common_field_val(struct trace_seq *s, struct tep_event_format *event
|
|||
*
|
||||
* Returns 0 on success -1 on field not found.
|
||||
*/
|
||||
int tep_get_any_field_val(struct trace_seq *s, struct tep_event_format *event,
|
||||
int tep_get_any_field_val(struct trace_seq *s, struct tep_event *event,
|
||||
const char *name, struct tep_record *record,
|
||||
unsigned long long *val, int err)
|
||||
{
|
||||
|
@ -6358,7 +6361,7 @@ int tep_get_any_field_val(struct trace_seq *s, struct tep_event_format *event,
|
|||
* Returns: 0 on success, -1 field not found, or 1 if buffer is full.
|
||||
*/
|
||||
int tep_print_num_field(struct trace_seq *s, const char *fmt,
|
||||
struct tep_event_format *event, const char *name,
|
||||
struct tep_event *event, const char *name,
|
||||
struct tep_record *record, int err)
|
||||
{
|
||||
struct tep_format_field *field = tep_find_field(event, name);
|
||||
|
@ -6390,7 +6393,7 @@ int tep_print_num_field(struct trace_seq *s, const char *fmt,
|
|||
* Returns: 0 on success, -1 field not found, or 1 if buffer is full.
|
||||
*/
|
||||
int tep_print_func_field(struct trace_seq *s, const char *fmt,
|
||||
struct tep_event_format *event, const char *name,
|
||||
struct tep_event *event, const char *name,
|
||||
struct tep_record *record, int err)
|
||||
{
|
||||
struct tep_format_field *field = tep_find_field(event, name);
|
||||
|
@ -6550,11 +6553,11 @@ int tep_unregister_print_function(struct tep_handle *pevent,
|
|||
return -1;
|
||||
}
|
||||
|
||||
static struct tep_event_format *search_event(struct tep_handle *pevent, int id,
|
||||
const char *sys_name,
|
||||
const char *event_name)
|
||||
static struct tep_event *search_event(struct tep_handle *pevent, int id,
|
||||
const char *sys_name,
|
||||
const char *event_name)
|
||||
{
|
||||
struct tep_event_format *event;
|
||||
struct tep_event *event;
|
||||
|
||||
if (id >= 0) {
|
||||
/* search by id */
|
||||
|
@ -6594,7 +6597,7 @@ int tep_register_event_handler(struct tep_handle *pevent, int id,
|
|||
const char *sys_name, const char *event_name,
|
||||
tep_event_handler_func func, void *context)
|
||||
{
|
||||
struct tep_event_format *event;
|
||||
struct tep_event *event;
|
||||
struct event_handler *handle;
|
||||
|
||||
event = search_event(pevent, id, sys_name, event_name);
|
||||
|
@ -6678,7 +6681,7 @@ int tep_unregister_event_handler(struct tep_handle *pevent, int id,
|
|||
const char *sys_name, const char *event_name,
|
||||
tep_event_handler_func func, void *context)
|
||||
{
|
||||
struct tep_event_format *event;
|
||||
struct tep_event *event;
|
||||
struct event_handler *handle;
|
||||
struct event_handler **next;
|
||||
|
||||
|
@ -6730,6 +6733,13 @@ void tep_ref(struct tep_handle *pevent)
|
|||
pevent->ref_count++;
|
||||
}
|
||||
|
||||
int tep_get_ref(struct tep_handle *tep)
|
||||
{
|
||||
if (tep)
|
||||
return tep->ref_count;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void tep_free_format_field(struct tep_format_field *field)
|
||||
{
|
||||
free(field->type);
|
||||
|
@ -6756,7 +6766,7 @@ static void free_formats(struct tep_format *format)
|
|||
free_format_fields(format->fields);
|
||||
}
|
||||
|
||||
void tep_free_format(struct tep_event_format *event)
|
||||
void tep_free_event(struct tep_event *event)
|
||||
{
|
||||
free(event->name);
|
||||
free(event->system);
|
||||
|
@ -6842,7 +6852,7 @@ void tep_free(struct tep_handle *pevent)
|
|||
}
|
||||
|
||||
for (i = 0; i < pevent->nr_events; i++)
|
||||
tep_free_format(pevent->events[i]);
|
||||
tep_free_event(pevent->events[i]);
|
||||
|
||||
while (pevent->handlers) {
|
||||
handle = pevent->handlers;
|
||||
|
|
|
@ -57,11 +57,11 @@ struct tep_record {
|
|||
/* ----------------------- tep ----------------------- */
|
||||
|
||||
struct tep_handle;
|
||||
struct tep_event_format;
|
||||
struct tep_event;
|
||||
|
||||
typedef int (*tep_event_handler_func)(struct trace_seq *s,
|
||||
struct tep_record *record,
|
||||
struct tep_event_format *event,
|
||||
struct tep_event *event,
|
||||
void *context);
|
||||
|
||||
typedef int (*tep_plugin_load_func)(struct tep_handle *pevent);
|
||||
|
@ -143,7 +143,7 @@ enum tep_format_flags {
|
|||
|
||||
struct tep_format_field {
|
||||
struct tep_format_field *next;
|
||||
struct tep_event_format *event;
|
||||
struct tep_event *event;
|
||||
char *type;
|
||||
char *name;
|
||||
char *alias;
|
||||
|
@ -277,7 +277,7 @@ struct tep_print_fmt {
|
|||
struct tep_print_arg *args;
|
||||
};
|
||||
|
||||
struct tep_event_format {
|
||||
struct tep_event {
|
||||
struct tep_handle *pevent;
|
||||
char *name;
|
||||
int id;
|
||||
|
@ -409,20 +409,6 @@ void tep_print_plugins(struct trace_seq *s,
|
|||
typedef char *(tep_func_resolver_t)(void *priv,
|
||||
unsigned long long *addrp, char **modp);
|
||||
void tep_set_flag(struct tep_handle *tep, int flag);
|
||||
unsigned short __tep_data2host2(struct tep_handle *pevent, unsigned short data);
|
||||
unsigned int __tep_data2host4(struct tep_handle *pevent, unsigned int data);
|
||||
unsigned long long
|
||||
__tep_data2host8(struct tep_handle *pevent, unsigned long long data);
|
||||
|
||||
#define tep_data2host2(pevent, ptr) __tep_data2host2(pevent, *(unsigned short *)(ptr))
|
||||
#define tep_data2host4(pevent, ptr) __tep_data2host4(pevent, *(unsigned int *)(ptr))
|
||||
#define tep_data2host8(pevent, ptr) \
|
||||
({ \
|
||||
unsigned long long __val; \
|
||||
\
|
||||
memcpy(&__val, (ptr), sizeof(unsigned long long)); \
|
||||
__tep_data2host8(pevent, __val); \
|
||||
})
|
||||
|
||||
static inline int tep_host_bigendian(void)
|
||||
{
|
||||
|
@ -454,14 +440,14 @@ int tep_register_print_string(struct tep_handle *pevent, const char *fmt,
|
|||
int tep_pid_is_registered(struct tep_handle *pevent, int pid);
|
||||
|
||||
void tep_print_event_task(struct tep_handle *pevent, struct trace_seq *s,
|
||||
struct tep_event_format *event,
|
||||
struct tep_event *event,
|
||||
struct tep_record *record);
|
||||
void tep_print_event_time(struct tep_handle *pevent, struct trace_seq *s,
|
||||
struct tep_event_format *event,
|
||||
struct tep_event *event,
|
||||
struct tep_record *record,
|
||||
bool use_trace_clock);
|
||||
void tep_print_event_data(struct tep_handle *pevent, struct trace_seq *s,
|
||||
struct tep_event_format *event,
|
||||
struct tep_event *event,
|
||||
struct tep_record *record);
|
||||
void tep_print_event(struct tep_handle *pevent, struct trace_seq *s,
|
||||
struct tep_record *record, bool use_trace_clock);
|
||||
|
@ -472,32 +458,30 @@ int tep_parse_header_page(struct tep_handle *pevent, char *buf, unsigned long si
|
|||
enum tep_errno tep_parse_event(struct tep_handle *pevent, const char *buf,
|
||||
unsigned long size, const char *sys);
|
||||
enum tep_errno tep_parse_format(struct tep_handle *pevent,
|
||||
struct tep_event_format **eventp,
|
||||
struct tep_event **eventp,
|
||||
const char *buf,
|
||||
unsigned long size, const char *sys);
|
||||
void tep_free_format(struct tep_event_format *event);
|
||||
void tep_free_format_field(struct tep_format_field *field);
|
||||
|
||||
void *tep_get_field_raw(struct trace_seq *s, struct tep_event_format *event,
|
||||
void *tep_get_field_raw(struct trace_seq *s, struct tep_event *event,
|
||||
const char *name, struct tep_record *record,
|
||||
int *len, int err);
|
||||
|
||||
int tep_get_field_val(struct trace_seq *s, struct tep_event_format *event,
|
||||
int tep_get_field_val(struct trace_seq *s, struct tep_event *event,
|
||||
const char *name, struct tep_record *record,
|
||||
unsigned long long *val, int err);
|
||||
int tep_get_common_field_val(struct trace_seq *s, struct tep_event_format *event,
|
||||
int tep_get_common_field_val(struct trace_seq *s, struct tep_event *event,
|
||||
const char *name, struct tep_record *record,
|
||||
unsigned long long *val, int err);
|
||||
int tep_get_any_field_val(struct trace_seq *s, struct tep_event_format *event,
|
||||
int tep_get_any_field_val(struct trace_seq *s, struct tep_event *event,
|
||||
const char *name, struct tep_record *record,
|
||||
unsigned long long *val, int err);
|
||||
|
||||
int tep_print_num_field(struct trace_seq *s, const char *fmt,
|
||||
struct tep_event_format *event, const char *name,
|
||||
struct tep_event *event, const char *name,
|
||||
struct tep_record *record, int err);
|
||||
|
||||
int tep_print_func_field(struct trace_seq *s, const char *fmt,
|
||||
struct tep_event_format *event, const char *name,
|
||||
struct tep_event *event, const char *name,
|
||||
struct tep_record *record, int err);
|
||||
|
||||
int tep_register_event_handler(struct tep_handle *pevent, int id,
|
||||
|
@ -513,9 +497,9 @@ int tep_register_print_function(struct tep_handle *pevent,
|
|||
int tep_unregister_print_function(struct tep_handle *pevent,
|
||||
tep_func_handler func, char *name);
|
||||
|
||||
struct tep_format_field *tep_find_common_field(struct tep_event_format *event, const char *name);
|
||||
struct tep_format_field *tep_find_field(struct tep_event_format *event, const char *name);
|
||||
struct tep_format_field *tep_find_any_field(struct tep_event_format *event, const char *name);
|
||||
struct tep_format_field *tep_find_common_field(struct tep_event *event, const char *name);
|
||||
struct tep_format_field *tep_find_field(struct tep_event *event, const char *name);
|
||||
struct tep_format_field *tep_find_any_field(struct tep_event *event, const char *name);
|
||||
|
||||
const char *tep_find_function(struct tep_handle *pevent, unsigned long long addr);
|
||||
unsigned long long
|
||||
|
@ -524,19 +508,19 @@ unsigned long long tep_read_number(struct tep_handle *pevent, const void *ptr, i
|
|||
int tep_read_number_field(struct tep_format_field *field, const void *data,
|
||||
unsigned long long *value);
|
||||
|
||||
struct tep_event_format *tep_get_first_event(struct tep_handle *tep);
|
||||
struct tep_event *tep_get_first_event(struct tep_handle *tep);
|
||||
int tep_get_events_count(struct tep_handle *tep);
|
||||
struct tep_event_format *tep_find_event(struct tep_handle *pevent, int id);
|
||||
struct tep_event *tep_find_event(struct tep_handle *pevent, int id);
|
||||
|
||||
struct tep_event_format *
|
||||
struct tep_event *
|
||||
tep_find_event_by_name(struct tep_handle *pevent, const char *sys, const char *name);
|
||||
struct tep_event_format *
|
||||
struct tep_event *
|
||||
tep_find_event_by_record(struct tep_handle *pevent, struct tep_record *record);
|
||||
|
||||
void tep_data_lat_fmt(struct tep_handle *pevent,
|
||||
struct trace_seq *s, struct tep_record *record);
|
||||
int tep_data_type(struct tep_handle *pevent, struct tep_record *rec);
|
||||
struct tep_event_format *tep_data_event_from_type(struct tep_handle *pevent, int type);
|
||||
struct tep_event *tep_data_event_from_type(struct tep_handle *pevent, int type);
|
||||
int tep_data_pid(struct tep_handle *pevent, struct tep_record *rec);
|
||||
int tep_data_preempt_count(struct tep_handle *pevent, struct tep_record *rec);
|
||||
int tep_data_flags(struct tep_handle *pevent, struct tep_record *rec);
|
||||
|
@ -549,15 +533,15 @@ int tep_cmdline_pid(struct tep_handle *pevent, struct cmdline *cmdline);
|
|||
void tep_print_field(struct trace_seq *s, void *data,
|
||||
struct tep_format_field *field);
|
||||
void tep_print_fields(struct trace_seq *s, void *data,
|
||||
int size __maybe_unused, struct tep_event_format *event);
|
||||
void tep_event_info(struct trace_seq *s, struct tep_event_format *event,
|
||||
struct tep_record *record);
|
||||
int size __maybe_unused, struct tep_event *event);
|
||||
void tep_event_info(struct trace_seq *s, struct tep_event *event,
|
||||
struct tep_record *record);
|
||||
int tep_strerror(struct tep_handle *pevent, enum tep_errno errnum,
|
||||
char *buf, size_t buflen);
|
||||
char *buf, size_t buflen);
|
||||
|
||||
struct tep_event_format **tep_list_events(struct tep_handle *pevent, enum tep_event_sort_type);
|
||||
struct tep_format_field **tep_event_common_fields(struct tep_event_format *event);
|
||||
struct tep_format_field **tep_event_fields(struct tep_event_format *event);
|
||||
struct tep_event **tep_list_events(struct tep_handle *pevent, enum tep_event_sort_type);
|
||||
struct tep_format_field **tep_event_common_fields(struct tep_event *event);
|
||||
struct tep_format_field **tep_event_fields(struct tep_event *event);
|
||||
|
||||
enum tep_endian {
|
||||
TEP_LITTLE_ENDIAN = 0,
|
||||
|
@ -581,6 +565,7 @@ struct tep_handle *tep_alloc(void);
|
|||
void tep_free(struct tep_handle *pevent);
|
||||
void tep_ref(struct tep_handle *pevent);
|
||||
void tep_unref(struct tep_handle *pevent);
|
||||
int tep_get_ref(struct tep_handle *tep);
|
||||
|
||||
/* access to the internal parser */
|
||||
void tep_buffer_init(const char *buf, unsigned long long size);
|
||||
|
@ -712,7 +697,7 @@ struct tep_filter_arg {
|
|||
|
||||
struct tep_filter_type {
|
||||
int event_id;
|
||||
struct tep_event_format *event;
|
||||
struct tep_event *event;
|
||||
struct tep_filter_arg *filter;
|
||||
};
|
||||
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
prefix=INSTALL_PREFIX
|
||||
libdir=${prefix}/lib64
|
||||
includedir=${prefix}/include/traceevent
|
||||
|
||||
Name: libtraceevent
|
||||
URL: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
|
||||
Description: Linux kernel trace event library
|
||||
Version: LIB_VERSION
|
||||
Cflags: -I${includedir}
|
||||
Libs: -L${libdir} -ltraceevent
|
|
@ -27,7 +27,7 @@ static struct tep_format_field cpu = {
|
|||
|
||||
struct event_list {
|
||||
struct event_list *next;
|
||||
struct tep_event_format *event;
|
||||
struct tep_event *event;
|
||||
};
|
||||
|
||||
static void show_error(char *error_buf, const char *fmt, ...)
|
||||
|
@ -229,7 +229,7 @@ static void free_arg(struct tep_filter_arg *arg)
|
|||
}
|
||||
|
||||
static int add_event(struct event_list **events,
|
||||
struct tep_event_format *event)
|
||||
struct tep_event *event)
|
||||
{
|
||||
struct event_list *list;
|
||||
|
||||
|
@ -243,7 +243,7 @@ static int add_event(struct event_list **events,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int event_match(struct tep_event_format *event,
|
||||
static int event_match(struct tep_event *event,
|
||||
regex_t *sreg, regex_t *ereg)
|
||||
{
|
||||
if (sreg) {
|
||||
|
@ -259,7 +259,7 @@ static enum tep_errno
|
|||
find_event(struct tep_handle *pevent, struct event_list **events,
|
||||
char *sys_name, char *event_name)
|
||||
{
|
||||
struct tep_event_format *event;
|
||||
struct tep_event *event;
|
||||
regex_t ereg;
|
||||
regex_t sreg;
|
||||
int match = 0;
|
||||
|
@ -334,7 +334,7 @@ static void free_events(struct event_list *events)
|
|||
}
|
||||
|
||||
static enum tep_errno
|
||||
create_arg_item(struct tep_event_format *event, const char *token,
|
||||
create_arg_item(struct tep_event *event, const char *token,
|
||||
enum tep_event_type type, struct tep_filter_arg **parg, char *error_str)
|
||||
{
|
||||
struct tep_format_field *field;
|
||||
|
@ -940,7 +940,7 @@ static int collapse_tree(struct tep_filter_arg *arg,
|
|||
}
|
||||
|
||||
static enum tep_errno
|
||||
process_filter(struct tep_event_format *event, struct tep_filter_arg **parg,
|
||||
process_filter(struct tep_event *event, struct tep_filter_arg **parg,
|
||||
char *error_str, int not)
|
||||
{
|
||||
enum tep_event_type type;
|
||||
|
@ -1180,7 +1180,7 @@ process_filter(struct tep_event_format *event, struct tep_filter_arg **parg,
|
|||
}
|
||||
|
||||
static enum tep_errno
|
||||
process_event(struct tep_event_format *event, const char *filter_str,
|
||||
process_event(struct tep_event *event, const char *filter_str,
|
||||
struct tep_filter_arg **parg, char *error_str)
|
||||
{
|
||||
int ret;
|
||||
|
@ -1205,7 +1205,7 @@ process_event(struct tep_event_format *event, const char *filter_str,
|
|||
}
|
||||
|
||||
static enum tep_errno
|
||||
filter_event(struct tep_event_filter *filter, struct tep_event_format *event,
|
||||
filter_event(struct tep_event_filter *filter, struct tep_event *event,
|
||||
const char *filter_str, char *error_str)
|
||||
{
|
||||
struct tep_filter_type *filter_type;
|
||||
|
@ -1457,7 +1457,7 @@ static int copy_filter_type(struct tep_event_filter *filter,
|
|||
struct tep_filter_type *filter_type)
|
||||
{
|
||||
struct tep_filter_arg *arg;
|
||||
struct tep_event_format *event;
|
||||
struct tep_event *event;
|
||||
const char *sys;
|
||||
const char *name;
|
||||
char *str;
|
||||
|
@ -1539,7 +1539,7 @@ int tep_update_trivial(struct tep_event_filter *dest, struct tep_event_filter *s
|
|||
{
|
||||
struct tep_handle *src_pevent;
|
||||
struct tep_handle *dest_pevent;
|
||||
struct tep_event_format *event;
|
||||
struct tep_event *event;
|
||||
struct tep_filter_type *filter_type;
|
||||
struct tep_filter_arg *arg;
|
||||
char *str;
|
||||
|
@ -1683,11 +1683,11 @@ int tep_filter_event_has_trivial(struct tep_event_filter *filter,
|
|||
}
|
||||
}
|
||||
|
||||
static int test_filter(struct tep_event_format *event, struct tep_filter_arg *arg,
|
||||
static int test_filter(struct tep_event *event, struct tep_filter_arg *arg,
|
||||
struct tep_record *record, enum tep_errno *err);
|
||||
|
||||
static const char *
|
||||
get_comm(struct tep_event_format *event, struct tep_record *record)
|
||||
get_comm(struct tep_event *event, struct tep_record *record)
|
||||
{
|
||||
const char *comm;
|
||||
int pid;
|
||||
|
@ -1698,7 +1698,7 @@ get_comm(struct tep_event_format *event, struct tep_record *record)
|
|||
}
|
||||
|
||||
static unsigned long long
|
||||
get_value(struct tep_event_format *event,
|
||||
get_value(struct tep_event *event,
|
||||
struct tep_format_field *field, struct tep_record *record)
|
||||
{
|
||||
unsigned long long val;
|
||||
|
@ -1734,11 +1734,11 @@ get_value(struct tep_event_format *event,
|
|||
}
|
||||
|
||||
static unsigned long long
|
||||
get_arg_value(struct tep_event_format *event, struct tep_filter_arg *arg,
|
||||
get_arg_value(struct tep_event *event, struct tep_filter_arg *arg,
|
||||
struct tep_record *record, enum tep_errno *err);
|
||||
|
||||
static unsigned long long
|
||||
get_exp_value(struct tep_event_format *event, struct tep_filter_arg *arg,
|
||||
get_exp_value(struct tep_event *event, struct tep_filter_arg *arg,
|
||||
struct tep_record *record, enum tep_errno *err)
|
||||
{
|
||||
unsigned long long lval, rval;
|
||||
|
@ -1793,7 +1793,7 @@ get_exp_value(struct tep_event_format *event, struct tep_filter_arg *arg,
|
|||
}
|
||||
|
||||
static unsigned long long
|
||||
get_arg_value(struct tep_event_format *event, struct tep_filter_arg *arg,
|
||||
get_arg_value(struct tep_event *event, struct tep_filter_arg *arg,
|
||||
struct tep_record *record, enum tep_errno *err)
|
||||
{
|
||||
switch (arg->type) {
|
||||
|
@ -1817,7 +1817,7 @@ get_arg_value(struct tep_event_format *event, struct tep_filter_arg *arg,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int test_num(struct tep_event_format *event, struct tep_filter_arg *arg,
|
||||
static int test_num(struct tep_event *event, struct tep_filter_arg *arg,
|
||||
struct tep_record *record, enum tep_errno *err)
|
||||
{
|
||||
unsigned long long lval, rval;
|
||||
|
@ -1860,7 +1860,7 @@ static int test_num(struct tep_event_format *event, struct tep_filter_arg *arg,
|
|||
|
||||
static const char *get_field_str(struct tep_filter_arg *arg, struct tep_record *record)
|
||||
{
|
||||
struct tep_event_format *event;
|
||||
struct tep_event *event;
|
||||
struct tep_handle *pevent;
|
||||
unsigned long long addr;
|
||||
const char *val = NULL;
|
||||
|
@ -1908,7 +1908,7 @@ static const char *get_field_str(struct tep_filter_arg *arg, struct tep_record *
|
|||
return val;
|
||||
}
|
||||
|
||||
static int test_str(struct tep_event_format *event, struct tep_filter_arg *arg,
|
||||
static int test_str(struct tep_event *event, struct tep_filter_arg *arg,
|
||||
struct tep_record *record, enum tep_errno *err)
|
||||
{
|
||||
const char *val;
|
||||
|
@ -1939,7 +1939,7 @@ static int test_str(struct tep_event_format *event, struct tep_filter_arg *arg,
|
|||
}
|
||||
}
|
||||
|
||||
static int test_op(struct tep_event_format *event, struct tep_filter_arg *arg,
|
||||
static int test_op(struct tep_event *event, struct tep_filter_arg *arg,
|
||||
struct tep_record *record, enum tep_errno *err)
|
||||
{
|
||||
switch (arg->op.type) {
|
||||
|
@ -1961,7 +1961,7 @@ static int test_op(struct tep_event_format *event, struct tep_filter_arg *arg,
|
|||
}
|
||||
}
|
||||
|
||||
static int test_filter(struct tep_event_format *event, struct tep_filter_arg *arg,
|
||||
static int test_filter(struct tep_event *event, struct tep_filter_arg *arg,
|
||||
struct tep_record *record, enum tep_errno *err)
|
||||
{
|
||||
if (*err) {
|
||||
|
|
|
@ -124,7 +124,7 @@ static int add_and_get_index(const char *parent, const char *child, int cpu)
|
|||
}
|
||||
|
||||
static int function_handler(struct trace_seq *s, struct tep_record *record,
|
||||
struct tep_event_format *event, void *context)
|
||||
struct tep_event *event, void *context)
|
||||
{
|
||||
struct tep_handle *pevent = event->pevent;
|
||||
unsigned long long function;
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
static int timer_expire_handler(struct trace_seq *s,
|
||||
struct tep_record *record,
|
||||
struct tep_event_format *event, void *context)
|
||||
struct tep_event *event, void *context)
|
||||
{
|
||||
trace_seq_printf(s, "hrtimer=");
|
||||
|
||||
|
@ -47,7 +47,7 @@ static int timer_expire_handler(struct trace_seq *s,
|
|||
|
||||
static int timer_start_handler(struct trace_seq *s,
|
||||
struct tep_record *record,
|
||||
struct tep_event_format *event, void *context)
|
||||
struct tep_event *event, void *context)
|
||||
{
|
||||
trace_seq_printf(s, "hrtimer=");
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "trace-seq.h"
|
||||
|
||||
static int call_site_handler(struct trace_seq *s, struct tep_record *record,
|
||||
struct tep_event_format *event, void *context)
|
||||
struct tep_event *event, void *context)
|
||||
{
|
||||
struct tep_format_field *field;
|
||||
unsigned long long val, addr;
|
||||
|
|
|
@ -249,7 +249,7 @@ static const char *find_exit_reason(unsigned isa, int val)
|
|||
}
|
||||
|
||||
static int print_exit_reason(struct trace_seq *s, struct tep_record *record,
|
||||
struct tep_event_format *event, const char *field)
|
||||
struct tep_event *event, const char *field)
|
||||
{
|
||||
unsigned long long isa;
|
||||
unsigned long long val;
|
||||
|
@ -270,7 +270,7 @@ static int print_exit_reason(struct trace_seq *s, struct tep_record *record,
|
|||
}
|
||||
|
||||
static int kvm_exit_handler(struct trace_seq *s, struct tep_record *record,
|
||||
struct tep_event_format *event, void *context)
|
||||
struct tep_event *event, void *context)
|
||||
{
|
||||
unsigned long long info1 = 0, info2 = 0;
|
||||
|
||||
|
@ -293,7 +293,7 @@ static int kvm_exit_handler(struct trace_seq *s, struct tep_record *record,
|
|||
|
||||
static int kvm_emulate_insn_handler(struct trace_seq *s,
|
||||
struct tep_record *record,
|
||||
struct tep_event_format *event, void *context)
|
||||
struct tep_event *event, void *context)
|
||||
{
|
||||
unsigned long long rip, csbase, len, flags, failed;
|
||||
int llen;
|
||||
|
@ -332,7 +332,7 @@ static int kvm_emulate_insn_handler(struct trace_seq *s,
|
|||
|
||||
|
||||
static int kvm_nested_vmexit_inject_handler(struct trace_seq *s, struct tep_record *record,
|
||||
struct tep_event_format *event, void *context)
|
||||
struct tep_event *event, void *context)
|
||||
{
|
||||
if (print_exit_reason(s, record, event, "exit_code") < 0)
|
||||
return -1;
|
||||
|
@ -346,7 +346,7 @@ static int kvm_nested_vmexit_inject_handler(struct trace_seq *s, struct tep_reco
|
|||
}
|
||||
|
||||
static int kvm_nested_vmexit_handler(struct trace_seq *s, struct tep_record *record,
|
||||
struct tep_event_format *event, void *context)
|
||||
struct tep_event *event, void *context)
|
||||
{
|
||||
tep_print_num_field(s, "rip %llx ", event, "rip", record, 1);
|
||||
|
||||
|
@ -372,7 +372,7 @@ union kvm_mmu_page_role {
|
|||
};
|
||||
|
||||
static int kvm_mmu_print_role(struct trace_seq *s, struct tep_record *record,
|
||||
struct tep_event_format *event, void *context)
|
||||
struct tep_event *event, void *context)
|
||||
{
|
||||
unsigned long long val;
|
||||
static const char *access_str[] = {
|
||||
|
@ -387,7 +387,7 @@ static int kvm_mmu_print_role(struct trace_seq *s, struct tep_record *record,
|
|||
|
||||
/*
|
||||
* We can only use the structure if file is of the same
|
||||
* endianess.
|
||||
* endianness.
|
||||
*/
|
||||
if (tep_is_file_bigendian(event->pevent) ==
|
||||
tep_is_host_bigendian(event->pevent)) {
|
||||
|
@ -419,7 +419,7 @@ static int kvm_mmu_print_role(struct trace_seq *s, struct tep_record *record,
|
|||
|
||||
static int kvm_mmu_get_page_handler(struct trace_seq *s,
|
||||
struct tep_record *record,
|
||||
struct tep_event_format *event, void *context)
|
||||
struct tep_event *event, void *context)
|
||||
{
|
||||
unsigned long long val;
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
#define INDENT 65
|
||||
|
||||
static void print_string(struct trace_seq *s, struct tep_event_format *event,
|
||||
static void print_string(struct trace_seq *s, struct tep_event *event,
|
||||
const char *name, const void *data)
|
||||
{
|
||||
struct tep_format_field *f = tep_find_field(event, name);
|
||||
|
@ -60,7 +60,7 @@ static void print_string(struct trace_seq *s, struct tep_event_format *event,
|
|||
|
||||
static int drv_bss_info_changed(struct trace_seq *s,
|
||||
struct tep_record *record,
|
||||
struct tep_event_format *event, void *context)
|
||||
struct tep_event *event, void *context)
|
||||
{
|
||||
void *data = record->data;
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ static void write_and_save_comm(struct tep_format_field *field,
|
|||
|
||||
static int sched_wakeup_handler(struct trace_seq *s,
|
||||
struct tep_record *record,
|
||||
struct tep_event_format *event, void *context)
|
||||
struct tep_event *event, void *context)
|
||||
{
|
||||
struct tep_format_field *field;
|
||||
unsigned long long val;
|
||||
|
@ -96,7 +96,7 @@ static int sched_wakeup_handler(struct trace_seq *s,
|
|||
|
||||
static int sched_switch_handler(struct trace_seq *s,
|
||||
struct tep_record *record,
|
||||
struct tep_event_format *event, void *context)
|
||||
struct tep_event *event, void *context)
|
||||
{
|
||||
struct tep_format_field *field;
|
||||
unsigned long long val;
|
||||
|
|
|
@ -199,6 +199,12 @@ colors.*::
|
|||
Colors for headers in the output of a sub-commands (top, report).
|
||||
Default values are 'white', 'blue'.
|
||||
|
||||
core.*::
|
||||
core.proc-map-timeout::
|
||||
Sets a timeout (in milliseconds) for parsing /proc/<pid>/maps files.
|
||||
Can be overridden by the --proc-map-timeout option on supported
|
||||
subcommands. The default timeout is 500ms.
|
||||
|
||||
tui.*, gtk.*::
|
||||
Subcommands that can be configured here are 'top', 'report' and 'annotate'.
|
||||
These values are booleans, for example:
|
||||
|
|
|
@ -172,7 +172,7 @@ like cycles and instructions and some software events.
|
|||
Other PMUs and global measurements are normally root only.
|
||||
Some event qualifiers, such as "any", are also root only.
|
||||
|
||||
This can be overriden by setting the kernel.perf_event_paranoid
|
||||
This can be overridden by setting the kernel.perf_event_paranoid
|
||||
sysctl to -1, which allows non root to use these events.
|
||||
|
||||
For accessing trace point events perf needs to have read access to
|
||||
|
|
|
@ -435,6 +435,11 @@ Specify vmlinux path which has debuginfo.
|
|||
--buildid-all::
|
||||
Record build-id of all DSOs regardless whether it's actually hit or not.
|
||||
|
||||
--aio[=n]::
|
||||
Use <n> control blocks in asynchronous (Posix AIO) trace writing mode (default: 1, max: 4).
|
||||
Asynchronous mode is supported only when linking Perf tool with libc library
|
||||
providing implementation for Posix AIO API.
|
||||
|
||||
--all-kernel::
|
||||
Configure all used events to run in kernel space.
|
||||
|
||||
|
|
|
@ -126,6 +126,14 @@ OPTIONS
|
|||
And default sort keys are changed to comm, dso_from, symbol_from, dso_to
|
||||
and symbol_to, see '--branch-stack'.
|
||||
|
||||
When the sort key symbol is specified, columns "IPC" and "IPC Coverage"
|
||||
are enabled automatically. Column "IPC" reports the average IPC per function
|
||||
and column "IPC coverage" reports the percentage of instructions with
|
||||
sampled IPC in this function. IPC means Instruction Per Cycle. If it's low,
|
||||
it indicates there may be a performance bottleneck when the function is
|
||||
executed, such as a memory access bottleneck. If a function has high overhead
|
||||
and low IPC, it's worth further analyzing it to optimize its performance.
|
||||
|
||||
If the --mem-mode option is used, the following sort keys are also available
|
||||
(incompatible with --branch-stack):
|
||||
symbol_daddr, dso_daddr, locked, tlb, mem, snoop, dcacheline.
|
||||
|
@ -244,7 +252,7 @@ OPTIONS
|
|||
Usually more convenient to use --branch-history for this.
|
||||
|
||||
value can be:
|
||||
- percent: diplay overhead percent (default)
|
||||
- percent: display overhead percent (default)
|
||||
- period: display event period
|
||||
- count: display event count
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@ OPTIONS
|
|||
Comma separated list of fields to print. Options are:
|
||||
comm, tid, pid, time, cpu, event, trace, ip, sym, dso, addr, symoff,
|
||||
srcline, period, iregs, uregs, brstack, brstacksym, flags, bpf-output, brstackinsn,
|
||||
brstackoff, callindent, insn, insnlen, synth, phys_addr, metric, misc.
|
||||
brstackoff, callindent, insn, insnlen, synth, phys_addr, metric, misc, srccode.
|
||||
Field list can be prepended with the type, trace, sw or hw,
|
||||
to indicate to which event type the field list applies.
|
||||
e.g., -F sw:comm,tid,time,ip,sym and -F trace:time,cpu,trace
|
||||
|
|
|
@ -50,7 +50,7 @@ report::
|
|||
/sys/bus/event_source/devices/<pmu>/format/*
|
||||
|
||||
Note that the last two syntaxes support prefix and glob matching in
|
||||
the PMU name to simplify creation of events accross multiple instances
|
||||
the PMU name to simplify creation of events across multiple instances
|
||||
of the same type of PMU in large systems (e.g. memory controller PMUs).
|
||||
Multiple PMU instances are typical for uncore PMUs, so the prefix
|
||||
'uncore_' is also ignored when performing this match.
|
||||
|
@ -277,7 +277,7 @@ echo 0 > /proc/sys/kernel/nmi_watchdog
|
|||
for best results. Otherwise the bottlenecks may be inconsistent
|
||||
on workload with changing phases.
|
||||
|
||||
This enables --metric-only, unless overriden with --no-metric-only.
|
||||
This enables --metric-only, unless overridden with --no-metric-only.
|
||||
|
||||
To interpret the results it is usually needed to know on which
|
||||
CPUs the workload runs on. If needed the CPUs can be forced using
|
||||
|
|
|
@ -70,6 +70,9 @@ Default is to monitor all CPUS.
|
|||
--ignore-vmlinux::
|
||||
Ignore vmlinux files.
|
||||
|
||||
--kallsyms=<file>::
|
||||
kallsyms pathname
|
||||
|
||||
-m <pages>::
|
||||
--mmap-pages=<pages>::
|
||||
Number of mmap data pages (must be a power of two) or size
|
||||
|
|
|
@ -365,6 +365,12 @@ ifeq ($(feature-glibc), 1)
|
|||
CFLAGS += -DHAVE_GLIBC_SUPPORT
|
||||
endif
|
||||
|
||||
ifeq ($(feature-libaio), 1)
|
||||
ifndef NO_AIO
|
||||
CFLAGS += -DHAVE_AIO_SUPPORT
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef NO_DWARF
|
||||
NO_LIBDW_DWARF_UNWIND := 1
|
||||
endif
|
||||
|
@ -588,7 +594,7 @@ endif
|
|||
|
||||
ifndef NO_LIBCRYPTO
|
||||
ifneq ($(feature-libcrypto), 1)
|
||||
msg := $(warning No libcrypto.h found, disables jitted code injection, please install libssl-devel or libssl-dev);
|
||||
msg := $(warning No libcrypto.h found, disables jitted code injection, please install openssl-devel or libssl-dev);
|
||||
NO_LIBCRYPTO := 1
|
||||
else
|
||||
CFLAGS += -DHAVE_LIBCRYPTO_SUPPORT
|
||||
|
|
|
@ -101,8 +101,13 @@ include ../scripts/utilities.mak
|
|||
# Define LIBCLANGLLVM if you DO want builtin clang and llvm support.
|
||||
# When selected, pass LLVM_CONFIG=/path/to/llvm-config to `make' if
|
||||
# llvm-config is not in $PATH.
|
||||
|
||||
#
|
||||
# Define NO_CORESIGHT if you do not want support for CoreSight trace decoding.
|
||||
#
|
||||
# Define NO_AIO if you do not want support of Posix AIO based trace
|
||||
# streaming for record mode. Currently Posix AIO trace streaming is
|
||||
# supported only when linking with glibc.
|
||||
#
|
||||
|
||||
# As per kernel Makefile, avoid funny character set dependencies
|
||||
unexport LC_ALL
|
||||
|
@ -469,7 +474,7 @@ $(madvise_behavior_array): $(madvise_hdr_dir)/mman-common.h $(madvise_behavior_t
|
|||
mmap_flags_array := $(beauty_outdir)/mmap_flags_array.c
|
||||
mmap_flags_tbl := $(srctree)/tools/perf/trace/beauty/mmap_flags.sh
|
||||
|
||||
$(mmap_flags_array): $(asm_generic_uapi_dir)/mman.h $(asm_generic_uapi_dir)/mman-common.h $(arch_asm_uapi_dir)/mman.h $(mmap_flags_tbl)
|
||||
$(mmap_flags_array): $(asm_generic_uapi_dir)/mman.h $(asm_generic_uapi_dir)/mman-common.h $(mmap_flags_tbl)
|
||||
$(Q)$(SHELL) '$(mmap_flags_tbl)' $(asm_generic_uapi_dir) $(arch_asm_uapi_dir) > $@
|
||||
|
||||
mount_flags_array := $(beauty_outdir)/mount_flags_array.c
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
#include <linux/compiler.h>
|
||||
|
||||
static int arc__annotate_init(struct arch *arch, char *cpuid __maybe_unused)
|
||||
{
|
||||
arch->initialized = true;
|
||||
arch->objdump.comment_char = ';';
|
||||
return 0;
|
||||
}
|
|
@ -5,6 +5,13 @@
|
|||
#include "../util/util.h"
|
||||
#include "../util/debug.h"
|
||||
|
||||
const char *const arc_triplets[] = {
|
||||
"arc-linux-",
|
||||
"arc-snps-linux-uclibc-",
|
||||
"arc-snps-linux-gnu-",
|
||||
NULL
|
||||
};
|
||||
|
||||
const char *const arm_triplets[] = {
|
||||
"arm-eabi-",
|
||||
"arm-linux-androideabi-",
|
||||
|
@ -147,7 +154,9 @@ static int perf_env__lookup_binutils_path(struct perf_env *env,
|
|||
zfree(&buf);
|
||||
}
|
||||
|
||||
if (!strcmp(arch, "arm"))
|
||||
if (!strcmp(arch, "arc"))
|
||||
path_list = arc_triplets;
|
||||
else if (!strcmp(arch, "arm"))
|
||||
path_list = arm_triplets;
|
||||
else if (!strcmp(arch, "arm64"))
|
||||
path_list = arm64_triplets;
|
||||
|
@ -200,3 +209,13 @@ int perf_env__lookup_objdump(struct perf_env *env, const char **path)
|
|||
|
||||
return perf_env__lookup_binutils_path(env, "objdump", path);
|
||||
}
|
||||
|
||||
/*
|
||||
* Some architectures have a single address space for kernel and user addresses,
|
||||
* which makes it possible to determine if an address is in kernel space or user
|
||||
* space.
|
||||
*/
|
||||
bool perf_env__single_address_space(struct perf_env *env)
|
||||
{
|
||||
return strcmp(perf_env__arch(env), "sparc");
|
||||
}
|
||||
|
|
|
@ -5,5 +5,6 @@
|
|||
#include "../util/env.h"
|
||||
|
||||
int perf_env__lookup_objdump(struct perf_env *env, const char **path);
|
||||
bool perf_env__single_address_space(struct perf_env *env);
|
||||
|
||||
#endif /* ARCH_PERF_COMMON_H */
|
||||
|
|
|
@ -170,7 +170,7 @@ static int test_data_set(struct test_data *dat_set, int x86_64)
|
|||
*
|
||||
* If the test passes %0 is returned, otherwise %-1 is returned. Use the
|
||||
* verbose (-v) option to see all the instructions and whether or not they
|
||||
* decoded successfuly.
|
||||
* decoded successfully.
|
||||
*/
|
||||
int test__insn_x86(struct test *test __maybe_unused, int subtest __maybe_unused)
|
||||
{
|
||||
|
|
|
@ -524,10 +524,21 @@ static int intel_pt_validate_config(struct perf_pmu *intel_pt_pmu,
|
|||
struct perf_evsel *evsel)
|
||||
{
|
||||
int err;
|
||||
char c;
|
||||
|
||||
if (!evsel)
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* If supported, force pass-through config term (pt=1) even if user
|
||||
* sets pt=0, which avoids senseless kernel errors.
|
||||
*/
|
||||
if (perf_pmu__scan_file(intel_pt_pmu, "format/pt", "%c", &c) == 1 &&
|
||||
!(evsel->attr.config & 1)) {
|
||||
pr_warning("pt=0 doesn't make sense, forcing pt=1\n");
|
||||
evsel->attr.config |= 1;
|
||||
}
|
||||
|
||||
err = intel_pt_val_config_term(intel_pt_pmu, "caps/cycle_thresholds",
|
||||
"cyc_thresh", "caps/psb_cyc",
|
||||
evsel->attr.config);
|
||||
|
|
|
@ -189,7 +189,7 @@ static void add_man_viewer(const char *name)
|
|||
while (*p)
|
||||
p = &((*p)->next);
|
||||
*p = zalloc(sizeof(**p) + len + 1);
|
||||
strncpy((*p)->name, name, len);
|
||||
strcpy((*p)->name, name);
|
||||
}
|
||||
|
||||
static int supported_man_viewer(const char *name, size_t len)
|
||||
|
|
|
@ -1364,7 +1364,7 @@ static int kvm_events_live(struct perf_kvm_stat *kvm,
|
|||
"show events other than"
|
||||
" HLT (x86 only) or Wait state (s390 only)"
|
||||
" that take longer than duration usecs"),
|
||||
OPT_UINTEGER(0, "proc-map-timeout", &kvm->opts.proc_map_timeout,
|
||||
OPT_UINTEGER(0, "proc-map-timeout", &proc_map_timeout,
|
||||
"per thread proc mmap processing timeout in ms"),
|
||||
OPT_END()
|
||||
};
|
||||
|
@ -1394,7 +1394,6 @@ static int kvm_events_live(struct perf_kvm_stat *kvm,
|
|||
kvm->opts.target.uses_mmap = false;
|
||||
kvm->opts.target.uid_str = NULL;
|
||||
kvm->opts.target.uid = UINT_MAX;
|
||||
kvm->opts.proc_map_timeout = 500;
|
||||
|
||||
symbol__init(NULL);
|
||||
disable_buildid_cache();
|
||||
|
@ -1453,8 +1452,7 @@ static int kvm_events_live(struct perf_kvm_stat *kvm,
|
|||
perf_session__set_id_hdr_size(kvm->session);
|
||||
ordered_events__set_copy_on_queue(&kvm->session->ordered_events, true);
|
||||
machine__synthesize_threads(&kvm->session->machines.host, &kvm->opts.target,
|
||||
kvm->evlist->threads, false,
|
||||
kvm->opts.proc_map_timeout, 1);
|
||||
kvm->evlist->threads, false, 1);
|
||||
err = kvm_live_open_events(kvm);
|
||||
if (err)
|
||||
goto out;
|
||||
|
|
|
@ -124,6 +124,210 @@ static int record__write(struct record *rec, struct perf_mmap *map __maybe_unuse
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef HAVE_AIO_SUPPORT
|
||||
static int record__aio_write(struct aiocb *cblock, int trace_fd,
|
||||
void *buf, size_t size, off_t off)
|
||||
{
|
||||
int rc;
|
||||
|
||||
cblock->aio_fildes = trace_fd;
|
||||
cblock->aio_buf = buf;
|
||||
cblock->aio_nbytes = size;
|
||||
cblock->aio_offset = off;
|
||||
cblock->aio_sigevent.sigev_notify = SIGEV_NONE;
|
||||
|
||||
do {
|
||||
rc = aio_write(cblock);
|
||||
if (rc == 0) {
|
||||
break;
|
||||
} else if (errno != EAGAIN) {
|
||||
cblock->aio_fildes = -1;
|
||||
pr_err("failed to queue perf data, error: %m\n");
|
||||
break;
|
||||
}
|
||||
} while (1);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int record__aio_complete(struct perf_mmap *md, struct aiocb *cblock)
|
||||
{
|
||||
void *rem_buf;
|
||||
off_t rem_off;
|
||||
size_t rem_size;
|
||||
int rc, aio_errno;
|
||||
ssize_t aio_ret, written;
|
||||
|
||||
aio_errno = aio_error(cblock);
|
||||
if (aio_errno == EINPROGRESS)
|
||||
return 0;
|
||||
|
||||
written = aio_ret = aio_return(cblock);
|
||||
if (aio_ret < 0) {
|
||||
if (aio_errno != EINTR)
|
||||
pr_err("failed to write perf data, error: %m\n");
|
||||
written = 0;
|
||||
}
|
||||
|
||||
rem_size = cblock->aio_nbytes - written;
|
||||
|
||||
if (rem_size == 0) {
|
||||
cblock->aio_fildes = -1;
|
||||
/*
|
||||
* md->refcount is incremented in perf_mmap__push() for
|
||||
* every enqueued aio write request so decrement it because
|
||||
* the request is now complete.
|
||||
*/
|
||||
perf_mmap__put(md);
|
||||
rc = 1;
|
||||
} else {
|
||||
/*
|
||||
* aio write request may require restart with the
|
||||
* reminder if the kernel didn't write whole
|
||||
* chunk at once.
|
||||
*/
|
||||
rem_off = cblock->aio_offset + written;
|
||||
rem_buf = (void *)(cblock->aio_buf + written);
|
||||
record__aio_write(cblock, cblock->aio_fildes,
|
||||
rem_buf, rem_size, rem_off);
|
||||
rc = 0;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int record__aio_sync(struct perf_mmap *md, bool sync_all)
|
||||
{
|
||||
struct aiocb **aiocb = md->aio.aiocb;
|
||||
struct aiocb *cblocks = md->aio.cblocks;
|
||||
struct timespec timeout = { 0, 1000 * 1000 * 1 }; /* 1ms */
|
||||
int i, do_suspend;
|
||||
|
||||
do {
|
||||
do_suspend = 0;
|
||||
for (i = 0; i < md->aio.nr_cblocks; ++i) {
|
||||
if (cblocks[i].aio_fildes == -1 || record__aio_complete(md, &cblocks[i])) {
|
||||
if (sync_all)
|
||||
aiocb[i] = NULL;
|
||||
else
|
||||
return i;
|
||||
} else {
|
||||
/*
|
||||
* Started aio write is not complete yet
|
||||
* so it has to be waited before the
|
||||
* next allocation.
|
||||
*/
|
||||
aiocb[i] = &cblocks[i];
|
||||
do_suspend = 1;
|
||||
}
|
||||
}
|
||||
if (!do_suspend)
|
||||
return -1;
|
||||
|
||||
while (aio_suspend((const struct aiocb **)aiocb, md->aio.nr_cblocks, &timeout)) {
|
||||
if (!(errno == EAGAIN || errno == EINTR))
|
||||
pr_err("failed to sync perf data, error: %m\n");
|
||||
}
|
||||
} while (1);
|
||||
}
|
||||
|
||||
static int record__aio_pushfn(void *to, struct aiocb *cblock, void *bf, size_t size, off_t off)
|
||||
{
|
||||
struct record *rec = to;
|
||||
int ret, trace_fd = rec->session->data->file.fd;
|
||||
|
||||
rec->samples++;
|
||||
|
||||
ret = record__aio_write(cblock, trace_fd, bf, size, off);
|
||||
if (!ret) {
|
||||
rec->bytes_written += size;
|
||||
if (switch_output_size(rec))
|
||||
trigger_hit(&switch_output_trigger);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static off_t record__aio_get_pos(int trace_fd)
|
||||
{
|
||||
return lseek(trace_fd, 0, SEEK_CUR);
|
||||
}
|
||||
|
||||
static void record__aio_set_pos(int trace_fd, off_t pos)
|
||||
{
|
||||
lseek(trace_fd, pos, SEEK_SET);
|
||||
}
|
||||
|
||||
static void record__aio_mmap_read_sync(struct record *rec)
|
||||
{
|
||||
int i;
|
||||
struct perf_evlist *evlist = rec->evlist;
|
||||
struct perf_mmap *maps = evlist->mmap;
|
||||
|
||||
if (!rec->opts.nr_cblocks)
|
||||
return;
|
||||
|
||||
for (i = 0; i < evlist->nr_mmaps; i++) {
|
||||
struct perf_mmap *map = &maps[i];
|
||||
|
||||
if (map->base)
|
||||
record__aio_sync(map, true);
|
||||
}
|
||||
}
|
||||
|
||||
static int nr_cblocks_default = 1;
|
||||
static int nr_cblocks_max = 4;
|
||||
|
||||
static int record__aio_parse(const struct option *opt,
|
||||
const char *str,
|
||||
int unset)
|
||||
{
|
||||
struct record_opts *opts = (struct record_opts *)opt->value;
|
||||
|
||||
if (unset) {
|
||||
opts->nr_cblocks = 0;
|
||||
} else {
|
||||
if (str)
|
||||
opts->nr_cblocks = strtol(str, NULL, 0);
|
||||
if (!opts->nr_cblocks)
|
||||
opts->nr_cblocks = nr_cblocks_default;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#else /* HAVE_AIO_SUPPORT */
|
||||
static int nr_cblocks_max = 0;
|
||||
|
||||
static int record__aio_sync(struct perf_mmap *md __maybe_unused, bool sync_all __maybe_unused)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int record__aio_pushfn(void *to __maybe_unused, struct aiocb *cblock __maybe_unused,
|
||||
void *bf __maybe_unused, size_t size __maybe_unused, off_t off __maybe_unused)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
static off_t record__aio_get_pos(int trace_fd __maybe_unused)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void record__aio_set_pos(int trace_fd __maybe_unused, off_t pos __maybe_unused)
|
||||
{
|
||||
}
|
||||
|
||||
static void record__aio_mmap_read_sync(struct record *rec __maybe_unused)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
static int record__aio_enabled(struct record *rec)
|
||||
{
|
||||
return rec->opts.nr_cblocks > 0;
|
||||
}
|
||||
|
||||
static int process_synthesized_event(struct perf_tool *tool,
|
||||
union perf_event *event,
|
||||
struct perf_sample *sample __maybe_unused,
|
||||
|
@ -329,7 +533,7 @@ static int record__mmap_evlist(struct record *rec,
|
|||
|
||||
if (perf_evlist__mmap_ex(evlist, opts->mmap_pages,
|
||||
opts->auxtrace_mmap_pages,
|
||||
opts->auxtrace_snapshot_mode) < 0) {
|
||||
opts->auxtrace_snapshot_mode, opts->nr_cblocks) < 0) {
|
||||
if (errno == EPERM) {
|
||||
pr_err("Permission error mapping pages.\n"
|
||||
"Consider increasing "
|
||||
|
@ -525,6 +729,8 @@ static int record__mmap_read_evlist(struct record *rec, struct perf_evlist *evli
|
|||
int i;
|
||||
int rc = 0;
|
||||
struct perf_mmap *maps;
|
||||
int trace_fd = rec->data.file.fd;
|
||||
off_t off;
|
||||
|
||||
if (!evlist)
|
||||
return 0;
|
||||
|
@ -536,13 +742,30 @@ static int record__mmap_read_evlist(struct record *rec, struct perf_evlist *evli
|
|||
if (overwrite && evlist->bkw_mmap_state != BKW_MMAP_DATA_PENDING)
|
||||
return 0;
|
||||
|
||||
if (record__aio_enabled(rec))
|
||||
off = record__aio_get_pos(trace_fd);
|
||||
|
||||
for (i = 0; i < evlist->nr_mmaps; i++) {
|
||||
struct perf_mmap *map = &maps[i];
|
||||
|
||||
if (map->base) {
|
||||
if (perf_mmap__push(map, rec, record__pushfn) != 0) {
|
||||
rc = -1;
|
||||
goto out;
|
||||
if (!record__aio_enabled(rec)) {
|
||||
if (perf_mmap__push(map, rec, record__pushfn) != 0) {
|
||||
rc = -1;
|
||||
goto out;
|
||||
}
|
||||
} else {
|
||||
int idx;
|
||||
/*
|
||||
* Call record__aio_sync() to wait till map->data buffer
|
||||
* becomes available after previous aio write request.
|
||||
*/
|
||||
idx = record__aio_sync(map, false);
|
||||
if (perf_mmap__aio_push(map, rec, idx, record__aio_pushfn, &off) != 0) {
|
||||
record__aio_set_pos(trace_fd, off);
|
||||
rc = -1;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -553,6 +776,9 @@ static int record__mmap_read_evlist(struct record *rec, struct perf_evlist *evli
|
|||
}
|
||||
}
|
||||
|
||||
if (record__aio_enabled(rec))
|
||||
record__aio_set_pos(trace_fd, off);
|
||||
|
||||
/*
|
||||
* Mark the round finished in case we wrote
|
||||
* at least one event.
|
||||
|
@ -641,8 +867,7 @@ static int record__synthesize_workload(struct record *rec, bool tail)
|
|||
err = perf_event__synthesize_thread_map(&rec->tool, thread_map,
|
||||
process_synthesized_event,
|
||||
&rec->session->machines.host,
|
||||
rec->opts.sample_address,
|
||||
rec->opts.proc_map_timeout);
|
||||
rec->opts.sample_address);
|
||||
thread_map__put(thread_map);
|
||||
return err;
|
||||
}
|
||||
|
@ -658,6 +883,8 @@ record__switch_output(struct record *rec, bool at_exit)
|
|||
/* Same Size: "2015122520103046"*/
|
||||
char timestamp[] = "InvalidTimestamp";
|
||||
|
||||
record__aio_mmap_read_sync(rec);
|
||||
|
||||
record__synthesize(rec, true);
|
||||
if (target__none(&rec->opts.target))
|
||||
record__synthesize_workload(rec, true);
|
||||
|
@ -857,7 +1084,7 @@ static int record__synthesize(struct record *rec, bool tail)
|
|||
|
||||
err = __machine__synthesize_threads(machine, tool, &opts->target, rec->evlist->threads,
|
||||
process_synthesized_event, opts->sample_address,
|
||||
opts->proc_map_timeout, 1);
|
||||
1);
|
||||
out:
|
||||
return err;
|
||||
}
|
||||
|
@ -1168,6 +1395,8 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
|
|||
record__synthesize_workload(rec, true);
|
||||
|
||||
out_child:
|
||||
record__aio_mmap_read_sync(rec);
|
||||
|
||||
if (forks) {
|
||||
int exit_status;
|
||||
|
||||
|
@ -1301,6 +1530,13 @@ static int perf_record_config(const char *var, const char *value, void *cb)
|
|||
var = "call-graph.record-mode";
|
||||
return perf_default_config(var, value, cb);
|
||||
}
|
||||
#ifdef HAVE_AIO_SUPPORT
|
||||
if (!strcmp(var, "record.aio")) {
|
||||
rec->opts.nr_cblocks = strtol(value, NULL, 0);
|
||||
if (!rec->opts.nr_cblocks)
|
||||
rec->opts.nr_cblocks = nr_cblocks_default;
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1546,7 +1782,6 @@ static struct record record = {
|
|||
.uses_mmap = true,
|
||||
.default_per_cpu = true,
|
||||
},
|
||||
.proc_map_timeout = 500,
|
||||
},
|
||||
.tool = {
|
||||
.sample = process_sample_event,
|
||||
|
@ -1676,7 +1911,7 @@ static struct option __record_options[] = {
|
|||
parse_clockid),
|
||||
OPT_STRING_OPTARG('S', "snapshot", &record.opts.auxtrace_snapshot_opts,
|
||||
"opts", "AUX area tracing Snapshot Mode", ""),
|
||||
OPT_UINTEGER(0, "proc-map-timeout", &record.opts.proc_map_timeout,
|
||||
OPT_UINTEGER(0, "proc-map-timeout", &proc_map_timeout,
|
||||
"per thread proc mmap processing timeout in ms"),
|
||||
OPT_BOOLEAN(0, "namespaces", &record.opts.record_namespaces,
|
||||
"Record namespaces events"),
|
||||
|
@ -1706,6 +1941,11 @@ static struct option __record_options[] = {
|
|||
"signal"),
|
||||
OPT_BOOLEAN(0, "dry-run", &dry_run,
|
||||
"Parse options then exit"),
|
||||
#ifdef HAVE_AIO_SUPPORT
|
||||
OPT_CALLBACK_OPTARG(0, "aio", &record.opts,
|
||||
&nr_cblocks_default, "n", "Use <n> control blocks in asynchronous trace writing mode (default: 1, max: 4)",
|
||||
record__aio_parse),
|
||||
#endif
|
||||
OPT_END()
|
||||
};
|
||||
|
||||
|
@ -1898,6 +2138,11 @@ int cmd_record(int argc, const char **argv)
|
|||
goto out;
|
||||
}
|
||||
|
||||
if (rec->opts.nr_cblocks > nr_cblocks_max)
|
||||
rec->opts.nr_cblocks = nr_cblocks_max;
|
||||
if (verbose > 0)
|
||||
pr_info("nr_cblocks: %d\n", rec->opts.nr_cblocks);
|
||||
|
||||
err = __cmd_record(&record, argc, argv);
|
||||
out:
|
||||
perf_evlist__delete(rec->evlist);
|
||||
|
|
|
@ -85,6 +85,7 @@ struct report {
|
|||
int socket_filter;
|
||||
DECLARE_BITMAP(cpu_bitmap, MAX_NR_CPUS);
|
||||
struct branch_type_stat brtype_stat;
|
||||
bool symbol_ipc;
|
||||
};
|
||||
|
||||
static int report__config(const char *var, const char *value, void *cb)
|
||||
|
@ -129,7 +130,7 @@ static int hist_iter__report_callback(struct hist_entry_iter *iter,
|
|||
struct mem_info *mi;
|
||||
struct branch_info *bi;
|
||||
|
||||
if (!ui__has_annotation())
|
||||
if (!ui__has_annotation() && !rep->symbol_ipc)
|
||||
return 0;
|
||||
|
||||
hist__account_cycles(sample->branch_stack, al, sample,
|
||||
|
@ -174,7 +175,7 @@ static int hist_iter__branch_callback(struct hist_entry_iter *iter,
|
|||
struct perf_evsel *evsel = iter->evsel;
|
||||
int err;
|
||||
|
||||
if (!ui__has_annotation())
|
||||
if (!ui__has_annotation() && !rep->symbol_ipc)
|
||||
return 0;
|
||||
|
||||
hist__account_cycles(sample->branch_stack, al, sample,
|
||||
|
@ -1133,6 +1134,7 @@ int cmd_report(int argc, const char **argv)
|
|||
.mode = PERF_DATA_MODE_READ,
|
||||
};
|
||||
int ret = hists__init();
|
||||
char sort_tmp[128];
|
||||
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
@ -1284,6 +1286,24 @@ int cmd_report(int argc, const char **argv)
|
|||
else
|
||||
use_browser = 0;
|
||||
|
||||
if (sort_order && strstr(sort_order, "ipc")) {
|
||||
parse_options_usage(report_usage, options, "s", 1);
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (sort_order && strstr(sort_order, "symbol")) {
|
||||
if (sort__mode == SORT_MODE__BRANCH) {
|
||||
snprintf(sort_tmp, sizeof(sort_tmp), "%s,%s",
|
||||
sort_order, "ipc_lbr");
|
||||
report.symbol_ipc = true;
|
||||
} else {
|
||||
snprintf(sort_tmp, sizeof(sort_tmp), "%s,%s",
|
||||
sort_order, "ipc_null");
|
||||
}
|
||||
|
||||
sort_order = sort_tmp;
|
||||
}
|
||||
|
||||
if (setup_sorting(session->evlist) < 0) {
|
||||
if (sort_order)
|
||||
parse_options_usage(report_usage, options, "s", 1);
|
||||
|
@ -1311,7 +1331,7 @@ int cmd_report(int argc, const char **argv)
|
|||
* so don't allocate extra space that won't be used in the stdio
|
||||
* implementation.
|
||||
*/
|
||||
if (ui__has_annotation()) {
|
||||
if (ui__has_annotation() || report.symbol_ipc) {
|
||||
ret = symbol__annotation_init();
|
||||
if (ret < 0)
|
||||
goto error;
|
||||
|
|
|
@ -96,6 +96,7 @@ enum perf_output_field {
|
|||
PERF_OUTPUT_UREGS = 1U << 27,
|
||||
PERF_OUTPUT_METRIC = 1U << 28,
|
||||
PERF_OUTPUT_MISC = 1U << 29,
|
||||
PERF_OUTPUT_SRCCODE = 1U << 30,
|
||||
};
|
||||
|
||||
struct output_option {
|
||||
|
@ -132,6 +133,7 @@ struct output_option {
|
|||
{.str = "phys_addr", .field = PERF_OUTPUT_PHYS_ADDR},
|
||||
{.str = "metric", .field = PERF_OUTPUT_METRIC},
|
||||
{.str = "misc", .field = PERF_OUTPUT_MISC},
|
||||
{.str = "srccode", .field = PERF_OUTPUT_SRCCODE},
|
||||
};
|
||||
|
||||
enum {
|
||||
|
@ -424,7 +426,7 @@ static int perf_evsel__check_attr(struct perf_evsel *evsel,
|
|||
pr_err("Display of DSO requested but no address to convert.\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
if (PRINT_FIELD(SRCLINE) && !PRINT_FIELD(IP)) {
|
||||
if ((PRINT_FIELD(SRCLINE) || PRINT_FIELD(SRCCODE)) && !PRINT_FIELD(IP)) {
|
||||
pr_err("Display of source line number requested but sample IP is not\n"
|
||||
"selected. Hence, no address to lookup the source line number.\n");
|
||||
return -EINVAL;
|
||||
|
@ -724,8 +726,8 @@ static int perf_sample__fprintf_brstack(struct perf_sample *sample,
|
|||
if (PRINT_FIELD(DSO)) {
|
||||
memset(&alf, 0, sizeof(alf));
|
||||
memset(&alt, 0, sizeof(alt));
|
||||
thread__find_map(thread, sample->cpumode, from, &alf);
|
||||
thread__find_map(thread, sample->cpumode, to, &alt);
|
||||
thread__find_map_fb(thread, sample->cpumode, from, &alf);
|
||||
thread__find_map_fb(thread, sample->cpumode, to, &alt);
|
||||
}
|
||||
|
||||
printed += fprintf(fp, " 0x%"PRIx64, from);
|
||||
|
@ -771,8 +773,8 @@ static int perf_sample__fprintf_brstacksym(struct perf_sample *sample,
|
|||
from = br->entries[i].from;
|
||||
to = br->entries[i].to;
|
||||
|
||||
thread__find_symbol(thread, sample->cpumode, from, &alf);
|
||||
thread__find_symbol(thread, sample->cpumode, to, &alt);
|
||||
thread__find_symbol_fb(thread, sample->cpumode, from, &alf);
|
||||
thread__find_symbol_fb(thread, sample->cpumode, to, &alt);
|
||||
|
||||
printed += symbol__fprintf_symname_offs(alf.sym, &alf, fp);
|
||||
if (PRINT_FIELD(DSO)) {
|
||||
|
@ -816,11 +818,11 @@ static int perf_sample__fprintf_brstackoff(struct perf_sample *sample,
|
|||
from = br->entries[i].from;
|
||||
to = br->entries[i].to;
|
||||
|
||||
if (thread__find_map(thread, sample->cpumode, from, &alf) &&
|
||||
if (thread__find_map_fb(thread, sample->cpumode, from, &alf) &&
|
||||
!alf.map->dso->adjust_symbols)
|
||||
from = map__map_ip(alf.map, from);
|
||||
|
||||
if (thread__find_map(thread, sample->cpumode, to, &alt) &&
|
||||
if (thread__find_map_fb(thread, sample->cpumode, to, &alt) &&
|
||||
!alt.map->dso->adjust_symbols)
|
||||
to = map__map_ip(alt.map, to);
|
||||
|
||||
|
@ -907,6 +909,22 @@ static int grab_bb(u8 *buffer, u64 start, u64 end,
|
|||
return len;
|
||||
}
|
||||
|
||||
static int print_srccode(struct thread *thread, u8 cpumode, uint64_t addr)
|
||||
{
|
||||
struct addr_location al;
|
||||
int ret = 0;
|
||||
|
||||
memset(&al, 0, sizeof(al));
|
||||
thread__find_map(thread, cpumode, addr, &al);
|
||||
if (!al.map)
|
||||
return 0;
|
||||
ret = map__fprintf_srccode(al.map, al.addr, stdout,
|
||||
&thread->srccode_state);
|
||||
if (ret)
|
||||
ret += printf("\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int ip__fprintf_jump(uint64_t ip, struct branch_entry *en,
|
||||
struct perf_insn *x, u8 *inbuf, int len,
|
||||
int insn, FILE *fp, int *total_cycles)
|
||||
|
@ -998,6 +1016,8 @@ static int perf_sample__fprintf_brstackinsn(struct perf_sample *sample,
|
|||
x.cpumode, x.cpu, &lastsym, attr, fp);
|
||||
printed += ip__fprintf_jump(br->entries[nr - 1].from, &br->entries[nr - 1],
|
||||
&x, buffer, len, 0, fp, &total_cycles);
|
||||
if (PRINT_FIELD(SRCCODE))
|
||||
printed += print_srccode(thread, x.cpumode, br->entries[nr - 1].from);
|
||||
}
|
||||
|
||||
/* Print all blocks */
|
||||
|
@ -1027,12 +1047,16 @@ static int perf_sample__fprintf_brstackinsn(struct perf_sample *sample,
|
|||
if (ip == end) {
|
||||
printed += ip__fprintf_jump(ip, &br->entries[i], &x, buffer + off, len - off, insn, fp,
|
||||
&total_cycles);
|
||||
if (PRINT_FIELD(SRCCODE))
|
||||
printed += print_srccode(thread, x.cpumode, ip);
|
||||
break;
|
||||
} else {
|
||||
printed += fprintf(fp, "\t%016" PRIx64 "\t%s\n", ip,
|
||||
dump_insn(&x, ip, buffer + off, len - off, &ilen));
|
||||
if (ilen == 0)
|
||||
break;
|
||||
if (PRINT_FIELD(SRCCODE))
|
||||
print_srccode(thread, x.cpumode, ip);
|
||||
insn++;
|
||||
}
|
||||
}
|
||||
|
@ -1063,6 +1087,8 @@ static int perf_sample__fprintf_brstackinsn(struct perf_sample *sample,
|
|||
|
||||
printed += fprintf(fp, "\t%016" PRIx64 "\t%s\n", sample->ip,
|
||||
dump_insn(&x, sample->ip, buffer, len, NULL));
|
||||
if (PRINT_FIELD(SRCCODE))
|
||||
print_srccode(thread, x.cpumode, sample->ip);
|
||||
goto out;
|
||||
}
|
||||
for (off = 0; off <= end - start; off += ilen) {
|
||||
|
@ -1070,6 +1096,8 @@ static int perf_sample__fprintf_brstackinsn(struct perf_sample *sample,
|
|||
dump_insn(&x, start + off, buffer + off, len - off, &ilen));
|
||||
if (ilen == 0)
|
||||
break;
|
||||
if (PRINT_FIELD(SRCCODE))
|
||||
print_srccode(thread, x.cpumode, start + off);
|
||||
}
|
||||
out:
|
||||
return printed;
|
||||
|
@ -1252,7 +1280,16 @@ static int perf_sample__fprintf_bts(struct perf_sample *sample,
|
|||
printed += map__fprintf_srcline(al->map, al->addr, "\n ", fp);
|
||||
|
||||
printed += perf_sample__fprintf_insn(sample, attr, thread, machine, fp);
|
||||
return printed + fprintf(fp, "\n");
|
||||
printed += fprintf(fp, "\n");
|
||||
if (PRINT_FIELD(SRCCODE)) {
|
||||
int ret = map__fprintf_srccode(al->map, al->addr, stdout,
|
||||
&thread->srccode_state);
|
||||
if (ret) {
|
||||
printed += ret;
|
||||
printed += printf("\n");
|
||||
}
|
||||
}
|
||||
return printed;
|
||||
}
|
||||
|
||||
static struct {
|
||||
|
@ -1792,6 +1829,12 @@ static void process_event(struct perf_script *script,
|
|||
fprintf(fp, "%16" PRIx64, sample->phys_addr);
|
||||
fprintf(fp, "\n");
|
||||
|
||||
if (PRINT_FIELD(SRCCODE)) {
|
||||
if (map__fprintf_srccode(al->map, al->addr, stdout,
|
||||
&thread->srccode_state))
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
if (PRINT_FIELD(METRIC))
|
||||
perf_sample__fprint_metric(script, thread, evsel, sample, fp);
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#include "arch/common.h"
|
||||
|
||||
#include "util/debug.h"
|
||||
#include "util/ordered-events.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <elf.h>
|
||||
|
@ -272,8 +273,6 @@ static void perf_top__print_sym_table(struct perf_top *top)
|
|||
perf_top__header_snprintf(top, bf, sizeof(bf));
|
||||
printf("%s\n", bf);
|
||||
|
||||
perf_top__reset_sample_counters(top);
|
||||
|
||||
printf("%-*.*s\n", win_width, win_width, graph_dotted_line);
|
||||
|
||||
if (!top->record_opts.overwrite &&
|
||||
|
@ -553,8 +552,6 @@ static void perf_top__sort_new_samples(void *arg)
|
|||
struct perf_evsel *evsel = t->sym_evsel;
|
||||
struct hists *hists;
|
||||
|
||||
perf_top__reset_sample_counters(t);
|
||||
|
||||
if (t->evlist->selected != NULL)
|
||||
t->sym_evsel = t->evlist->selected;
|
||||
|
||||
|
@ -571,6 +568,15 @@ static void perf_top__sort_new_samples(void *arg)
|
|||
|
||||
hists__collapse_resort(hists, NULL);
|
||||
perf_evsel__output_resort(evsel, NULL);
|
||||
|
||||
if (t->lost || t->drop)
|
||||
pr_warning("Too slow to read ring buffer (change period (-c/-F) or limit CPUs (-C)\n");
|
||||
}
|
||||
|
||||
static void stop_top(void)
|
||||
{
|
||||
session_done = 1;
|
||||
done = 1;
|
||||
}
|
||||
|
||||
static void *display_thread_tui(void *arg)
|
||||
|
@ -595,7 +601,7 @@ static void *display_thread_tui(void *arg)
|
|||
|
||||
/*
|
||||
* Initialize the uid_filter_str, in the future the TUI will allow
|
||||
* Zooming in/out UIDs. For now juse use whatever the user passed
|
||||
* Zooming in/out UIDs. For now just use whatever the user passed
|
||||
* via --uid.
|
||||
*/
|
||||
evlist__for_each_entry(top->evlist, pos) {
|
||||
|
@ -609,13 +615,13 @@ static void *display_thread_tui(void *arg)
|
|||
!top->record_opts.overwrite,
|
||||
&top->annotation_opts);
|
||||
|
||||
done = 1;
|
||||
stop_top();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void display_sig(int sig __maybe_unused)
|
||||
{
|
||||
done = 1;
|
||||
stop_top();
|
||||
}
|
||||
|
||||
static void display_setup_sig(void)
|
||||
|
@ -668,7 +674,7 @@ static void *display_thread(void *arg)
|
|||
|
||||
if (perf_top__handle_keypress(top, c))
|
||||
goto repeat;
|
||||
done = 1;
|
||||
stop_top();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -800,78 +806,61 @@ static void perf_event__process_sample(struct perf_tool *tool,
|
|||
addr_location__put(&al);
|
||||
}
|
||||
|
||||
static void
|
||||
perf_top__process_lost(struct perf_top *top, union perf_event *event,
|
||||
struct perf_evsel *evsel)
|
||||
{
|
||||
struct hists *hists = evsel__hists(evsel);
|
||||
|
||||
top->lost += event->lost.lost;
|
||||
top->lost_total += event->lost.lost;
|
||||
hists->stats.total_lost += event->lost.lost;
|
||||
}
|
||||
|
||||
static void
|
||||
perf_top__process_lost_samples(struct perf_top *top,
|
||||
union perf_event *event,
|
||||
struct perf_evsel *evsel)
|
||||
{
|
||||
struct hists *hists = evsel__hists(evsel);
|
||||
|
||||
top->lost += event->lost_samples.lost;
|
||||
top->lost_total += event->lost_samples.lost;
|
||||
hists->stats.total_lost_samples += event->lost_samples.lost;
|
||||
}
|
||||
|
||||
static u64 last_timestamp;
|
||||
|
||||
static void perf_top__mmap_read_idx(struct perf_top *top, int idx)
|
||||
{
|
||||
struct record_opts *opts = &top->record_opts;
|
||||
struct perf_evlist *evlist = top->evlist;
|
||||
struct perf_sample sample;
|
||||
struct perf_evsel *evsel;
|
||||
struct perf_mmap *md;
|
||||
struct perf_session *session = top->session;
|
||||
union perf_event *event;
|
||||
struct machine *machine;
|
||||
int ret;
|
||||
|
||||
md = opts->overwrite ? &evlist->overwrite_mmap[idx] : &evlist->mmap[idx];
|
||||
if (perf_mmap__read_init(md) < 0)
|
||||
return;
|
||||
|
||||
while ((event = perf_mmap__read_event(md)) != NULL) {
|
||||
ret = perf_evlist__parse_sample(evlist, event, &sample);
|
||||
if (ret) {
|
||||
pr_err("Can't parse sample, err = %d\n", ret);
|
||||
goto next_event;
|
||||
}
|
||||
int ret;
|
||||
|
||||
evsel = perf_evlist__id2evsel(session->evlist, sample.id);
|
||||
assert(evsel != NULL);
|
||||
|
||||
if (event->header.type == PERF_RECORD_SAMPLE)
|
||||
++top->samples;
|
||||
|
||||
switch (sample.cpumode) {
|
||||
case PERF_RECORD_MISC_USER:
|
||||
++top->us_samples;
|
||||
if (top->hide_user_symbols)
|
||||
goto next_event;
|
||||
machine = &session->machines.host;
|
||||
ret = perf_evlist__parse_sample_timestamp(evlist, event, &last_timestamp);
|
||||
if (ret && ret != -1)
|
||||
break;
|
||||
case PERF_RECORD_MISC_KERNEL:
|
||||
++top->kernel_samples;
|
||||
if (top->hide_kernel_symbols)
|
||||
goto next_event;
|
||||
machine = &session->machines.host;
|
||||
break;
|
||||
case PERF_RECORD_MISC_GUEST_KERNEL:
|
||||
++top->guest_kernel_samples;
|
||||
machine = perf_session__find_machine(session,
|
||||
sample.pid);
|
||||
break;
|
||||
case PERF_RECORD_MISC_GUEST_USER:
|
||||
++top->guest_us_samples;
|
||||
/*
|
||||
* TODO: we don't process guest user from host side
|
||||
* except simple counting.
|
||||
*/
|
||||
goto next_event;
|
||||
default:
|
||||
if (event->header.type == PERF_RECORD_SAMPLE)
|
||||
goto next_event;
|
||||
machine = &session->machines.host;
|
||||
break;
|
||||
}
|
||||
|
||||
ret = ordered_events__queue(top->qe.in, event, last_timestamp, 0);
|
||||
if (ret)
|
||||
break;
|
||||
|
||||
if (event->header.type == PERF_RECORD_SAMPLE) {
|
||||
perf_event__process_sample(&top->tool, event, evsel,
|
||||
&sample, machine);
|
||||
} else if (event->header.type < PERF_RECORD_MAX) {
|
||||
hists__inc_nr_events(evsel__hists(evsel), event->header.type);
|
||||
machine__process_event(machine, event, &sample);
|
||||
} else
|
||||
++session->evlist->stats.nr_unknown_events;
|
||||
next_event:
|
||||
perf_mmap__consume(md);
|
||||
|
||||
if (top->qe.rotate) {
|
||||
pthread_mutex_lock(&top->qe.mutex);
|
||||
top->qe.rotate = false;
|
||||
pthread_cond_signal(&top->qe.cond);
|
||||
pthread_mutex_unlock(&top->qe.mutex);
|
||||
}
|
||||
}
|
||||
|
||||
perf_mmap__read_done(md);
|
||||
|
@ -881,10 +870,8 @@ static void perf_top__mmap_read(struct perf_top *top)
|
|||
{
|
||||
bool overwrite = top->record_opts.overwrite;
|
||||
struct perf_evlist *evlist = top->evlist;
|
||||
unsigned long long start, end;
|
||||
int i;
|
||||
|
||||
start = rdclock();
|
||||
if (overwrite)
|
||||
perf_evlist__toggle_bkw_mmap(evlist, BKW_MMAP_DATA_PENDING);
|
||||
|
||||
|
@ -895,13 +882,6 @@ static void perf_top__mmap_read(struct perf_top *top)
|
|||
perf_evlist__toggle_bkw_mmap(evlist, BKW_MMAP_EMPTY);
|
||||
perf_evlist__toggle_bkw_mmap(evlist, BKW_MMAP_RUNNING);
|
||||
}
|
||||
end = rdclock();
|
||||
|
||||
if ((end - start) > (unsigned long long)top->delay_secs * NSEC_PER_SEC)
|
||||
ui__warning("Too slow to read ring buffer.\n"
|
||||
"Please try increasing the period (-c) or\n"
|
||||
"decreasing the freq (-F) or\n"
|
||||
"limiting the number of CPUs (-C)\n");
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1063,6 +1043,150 @@ static int callchain_param__setup_sample_type(struct callchain_param *callchain)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static struct ordered_events *rotate_queues(struct perf_top *top)
|
||||
{
|
||||
struct ordered_events *in = top->qe.in;
|
||||
|
||||
if (top->qe.in == &top->qe.data[1])
|
||||
top->qe.in = &top->qe.data[0];
|
||||
else
|
||||
top->qe.in = &top->qe.data[1];
|
||||
|
||||
return in;
|
||||
}
|
||||
|
||||
static void *process_thread(void *arg)
|
||||
{
|
||||
struct perf_top *top = arg;
|
||||
|
||||
while (!done) {
|
||||
struct ordered_events *out, *in = top->qe.in;
|
||||
|
||||
if (!in->nr_events) {
|
||||
usleep(100);
|
||||
continue;
|
||||
}
|
||||
|
||||
out = rotate_queues(top);
|
||||
|
||||
pthread_mutex_lock(&top->qe.mutex);
|
||||
top->qe.rotate = true;
|
||||
pthread_cond_wait(&top->qe.cond, &top->qe.mutex);
|
||||
pthread_mutex_unlock(&top->qe.mutex);
|
||||
|
||||
if (ordered_events__flush(out, OE_FLUSH__TOP))
|
||||
pr_err("failed to process events\n");
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Allow only 'top->delay_secs' seconds behind samples.
|
||||
*/
|
||||
static int should_drop(struct ordered_event *qevent, struct perf_top *top)
|
||||
{
|
||||
union perf_event *event = qevent->event;
|
||||
u64 delay_timestamp;
|
||||
|
||||
if (event->header.type != PERF_RECORD_SAMPLE)
|
||||
return false;
|
||||
|
||||
delay_timestamp = qevent->timestamp + top->delay_secs * NSEC_PER_SEC;
|
||||
return delay_timestamp < last_timestamp;
|
||||
}
|
||||
|
||||
static int deliver_event(struct ordered_events *qe,
|
||||
struct ordered_event *qevent)
|
||||
{
|
||||
struct perf_top *top = qe->data;
|
||||
struct perf_evlist *evlist = top->evlist;
|
||||
struct perf_session *session = top->session;
|
||||
union perf_event *event = qevent->event;
|
||||
struct perf_sample sample;
|
||||
struct perf_evsel *evsel;
|
||||
struct machine *machine;
|
||||
int ret = -1;
|
||||
|
||||
if (should_drop(qevent, top)) {
|
||||
top->drop++;
|
||||
top->drop_total++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = perf_evlist__parse_sample(evlist, event, &sample);
|
||||
if (ret) {
|
||||
pr_err("Can't parse sample, err = %d\n", ret);
|
||||
goto next_event;
|
||||
}
|
||||
|
||||
evsel = perf_evlist__id2evsel(session->evlist, sample.id);
|
||||
assert(evsel != NULL);
|
||||
|
||||
if (event->header.type == PERF_RECORD_SAMPLE)
|
||||
++top->samples;
|
||||
|
||||
switch (sample.cpumode) {
|
||||
case PERF_RECORD_MISC_USER:
|
||||
++top->us_samples;
|
||||
if (top->hide_user_symbols)
|
||||
goto next_event;
|
||||
machine = &session->machines.host;
|
||||
break;
|
||||
case PERF_RECORD_MISC_KERNEL:
|
||||
++top->kernel_samples;
|
||||
if (top->hide_kernel_symbols)
|
||||
goto next_event;
|
||||
machine = &session->machines.host;
|
||||
break;
|
||||
case PERF_RECORD_MISC_GUEST_KERNEL:
|
||||
++top->guest_kernel_samples;
|
||||
machine = perf_session__find_machine(session,
|
||||
sample.pid);
|
||||
break;
|
||||
case PERF_RECORD_MISC_GUEST_USER:
|
||||
++top->guest_us_samples;
|
||||
/*
|
||||
* TODO: we don't process guest user from host side
|
||||
* except simple counting.
|
||||
*/
|
||||
goto next_event;
|
||||
default:
|
||||
if (event->header.type == PERF_RECORD_SAMPLE)
|
||||
goto next_event;
|
||||
machine = &session->machines.host;
|
||||
break;
|
||||
}
|
||||
|
||||
if (event->header.type == PERF_RECORD_SAMPLE) {
|
||||
perf_event__process_sample(&top->tool, event, evsel,
|
||||
&sample, machine);
|
||||
} else if (event->header.type == PERF_RECORD_LOST) {
|
||||
perf_top__process_lost(top, event, evsel);
|
||||
} else if (event->header.type == PERF_RECORD_LOST_SAMPLES) {
|
||||
perf_top__process_lost_samples(top, event, evsel);
|
||||
} else if (event->header.type < PERF_RECORD_MAX) {
|
||||
hists__inc_nr_events(evsel__hists(evsel), event->header.type);
|
||||
machine__process_event(machine, event, &sample);
|
||||
} else
|
||||
++session->evlist->stats.nr_unknown_events;
|
||||
|
||||
ret = 0;
|
||||
next_event:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void init_process_thread(struct perf_top *top)
|
||||
{
|
||||
ordered_events__init(&top->qe.data[0], deliver_event, top);
|
||||
ordered_events__init(&top->qe.data[1], deliver_event, top);
|
||||
ordered_events__set_copy_on_queue(&top->qe.data[0], true);
|
||||
ordered_events__set_copy_on_queue(&top->qe.data[1], true);
|
||||
top->qe.in = &top->qe.data[0];
|
||||
pthread_mutex_init(&top->qe.mutex, NULL);
|
||||
pthread_cond_init(&top->qe.cond, NULL);
|
||||
}
|
||||
|
||||
static int __cmd_top(struct perf_top *top)
|
||||
{
|
||||
char msg[512];
|
||||
|
@ -1070,7 +1194,7 @@ static int __cmd_top(struct perf_top *top)
|
|||
struct perf_evsel_config_term *err_term;
|
||||
struct perf_evlist *evlist = top->evlist;
|
||||
struct record_opts *opts = &top->record_opts;
|
||||
pthread_t thread;
|
||||
pthread_t thread, thread_process;
|
||||
int ret;
|
||||
|
||||
top->session = perf_session__new(NULL, false, NULL);
|
||||
|
@ -1094,9 +1218,10 @@ static int __cmd_top(struct perf_top *top)
|
|||
if (top->nr_threads_synthesize > 1)
|
||||
perf_set_multithreaded();
|
||||
|
||||
init_process_thread(top);
|
||||
|
||||
machine__synthesize_threads(&top->session->machines.host, &opts->target,
|
||||
top->evlist->threads, false,
|
||||
opts->proc_map_timeout,
|
||||
top->nr_threads_synthesize);
|
||||
|
||||
if (top->nr_threads_synthesize > 1)
|
||||
|
@ -1135,10 +1260,15 @@ static int __cmd_top(struct perf_top *top)
|
|||
perf_evlist__enable(top->evlist);
|
||||
|
||||
ret = -1;
|
||||
if (pthread_create(&thread_process, NULL, process_thread, top)) {
|
||||
ui__error("Could not create process thread.\n");
|
||||
goto out_delete;
|
||||
}
|
||||
|
||||
if (pthread_create(&thread, NULL, (use_browser > 0 ? display_thread_tui :
|
||||
display_thread), top)) {
|
||||
ui__error("Could not create display thread.\n");
|
||||
goto out_delete;
|
||||
goto out_join_thread;
|
||||
}
|
||||
|
||||
if (top->realtime_prio) {
|
||||
|
@ -1173,6 +1303,9 @@ static int __cmd_top(struct perf_top *top)
|
|||
ret = 0;
|
||||
out_join:
|
||||
pthread_join(thread, NULL);
|
||||
out_join_thread:
|
||||
pthread_cond_signal(&top->qe.cond);
|
||||
pthread_join(thread_process, NULL);
|
||||
out_delete:
|
||||
perf_session__delete(top->session);
|
||||
top->session = NULL;
|
||||
|
@ -1256,7 +1389,6 @@ int cmd_top(int argc, const char **argv)
|
|||
.target = {
|
||||
.uses_mmap = true,
|
||||
},
|
||||
.proc_map_timeout = 500,
|
||||
/*
|
||||
* FIXME: This will lose PERF_RECORD_MMAP and other metadata
|
||||
* when we pause, fix that and reenable. Probably using a
|
||||
|
@ -1265,6 +1397,7 @@ int cmd_top(int argc, const char **argv)
|
|||
* stays in overwrite mode. -acme
|
||||
* */
|
||||
.overwrite = 0,
|
||||
.sample_time = true,
|
||||
},
|
||||
.max_stack = sysctl__max_stack(),
|
||||
.annotation_opts = annotation__default_options,
|
||||
|
@ -1289,6 +1422,8 @@ int cmd_top(int argc, const char **argv)
|
|||
"file", "vmlinux pathname"),
|
||||
OPT_BOOLEAN(0, "ignore-vmlinux", &symbol_conf.ignore_vmlinux,
|
||||
"don't load vmlinux even if found"),
|
||||
OPT_STRING(0, "kallsyms", &symbol_conf.kallsyms_name,
|
||||
"file", "kallsyms pathname"),
|
||||
OPT_BOOLEAN('K', "hide_kernel_symbols", &top.hide_kernel_symbols,
|
||||
"hide kernel symbols"),
|
||||
OPT_CALLBACK('m', "mmap-pages", &opts->mmap_pages, "pages",
|
||||
|
@ -1367,7 +1502,7 @@ int cmd_top(int argc, const char **argv)
|
|||
OPT_STRING('w', "column-widths", &symbol_conf.col_width_list_str,
|
||||
"width[,width...]",
|
||||
"don't try to adjust column width, use these fixed values"),
|
||||
OPT_UINTEGER(0, "proc-map-timeout", &opts->proc_map_timeout,
|
||||
OPT_UINTEGER(0, "proc-map-timeout", &proc_map_timeout,
|
||||
"per thread proc mmap processing timeout in ms"),
|
||||
OPT_CALLBACK_NOOPT('b', "branch-any", &opts->branch_stack,
|
||||
"branch any", "sample any taken branches",
|
||||
|
|
|
@ -127,6 +127,10 @@ struct trace {
|
|||
bool force;
|
||||
bool vfs_getname;
|
||||
int trace_pgfaults;
|
||||
struct {
|
||||
struct ordered_events data;
|
||||
u64 last;
|
||||
} oe;
|
||||
};
|
||||
|
||||
struct tp_field {
|
||||
|
@ -258,7 +262,8 @@ static int perf_evsel__init_syscall_tp(struct perf_evsel *evsel)
|
|||
struct syscall_tp *sc = evsel->priv = malloc(sizeof(struct syscall_tp));
|
||||
|
||||
if (evsel->priv != NULL) {
|
||||
if (perf_evsel__init_tp_uint_field(evsel, &sc->id, "__syscall_nr"))
|
||||
if (perf_evsel__init_tp_uint_field(evsel, &sc->id, "__syscall_nr") &&
|
||||
perf_evsel__init_tp_uint_field(evsel, &sc->id, "nr"))
|
||||
goto out_delete;
|
||||
return 0;
|
||||
}
|
||||
|
@ -885,7 +890,7 @@ static struct syscall_fmt *syscall_fmt__find_by_alias(const char *alias)
|
|||
* args_size: sum of the sizes of the syscall arguments, anything after that is augmented stuff: pathname for openat, etc.
|
||||
*/
|
||||
struct syscall {
|
||||
struct tep_event_format *tp_format;
|
||||
struct tep_event *tp_format;
|
||||
int nr_args;
|
||||
int args_size;
|
||||
bool is_exit;
|
||||
|
@ -1264,7 +1269,7 @@ static int trace__symbols_init(struct trace *trace, struct perf_evlist *evlist)
|
|||
|
||||
err = __machine__synthesize_threads(trace->host, &trace->tool, &trace->opts.target,
|
||||
evlist->threads, trace__tool_process, false,
|
||||
trace->opts.proc_map_timeout, 1);
|
||||
1);
|
||||
out:
|
||||
if (err)
|
||||
symbol__exit();
|
||||
|
@ -2636,6 +2641,57 @@ static int trace__set_filter_pids(struct trace *trace)
|
|||
return err;
|
||||
}
|
||||
|
||||
static int trace__deliver_event(struct trace *trace, union perf_event *event)
|
||||
{
|
||||
struct perf_evlist *evlist = trace->evlist;
|
||||
struct perf_sample sample;
|
||||
int err;
|
||||
|
||||
err = perf_evlist__parse_sample(evlist, event, &sample);
|
||||
if (err)
|
||||
fprintf(trace->output, "Can't parse sample, err = %d, skipping...\n", err);
|
||||
else
|
||||
trace__handle_event(trace, event, &sample);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int trace__flush_ordered_events(struct trace *trace)
|
||||
{
|
||||
u64 first = ordered_events__first_time(&trace->oe.data);
|
||||
u64 flush = trace->oe.last - NSEC_PER_SEC;
|
||||
|
||||
/* Is there some thing to flush.. */
|
||||
if (first && first < flush)
|
||||
return ordered_events__flush_time(&trace->oe.data, flush);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int trace__deliver_ordered_event(struct trace *trace, union perf_event *event)
|
||||
{
|
||||
struct perf_evlist *evlist = trace->evlist;
|
||||
int err;
|
||||
|
||||
err = perf_evlist__parse_sample_timestamp(evlist, event, &trace->oe.last);
|
||||
if (err && err != -1)
|
||||
return err;
|
||||
|
||||
err = ordered_events__queue(&trace->oe.data, event, trace->oe.last, 0);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
return trace__flush_ordered_events(trace);
|
||||
}
|
||||
|
||||
static int ordered_events__deliver_event(struct ordered_events *oe,
|
||||
struct ordered_event *event)
|
||||
{
|
||||
struct trace *trace = container_of(oe, struct trace, oe.data);
|
||||
|
||||
return trace__deliver_event(trace, event->event);
|
||||
}
|
||||
|
||||
static int trace__run(struct trace *trace, int argc, const char **argv)
|
||||
{
|
||||
struct perf_evlist *evlist = trace->evlist;
|
||||
|
@ -2782,7 +2838,7 @@ static int trace__run(struct trace *trace, int argc, const char **argv)
|
|||
* Now that we already used evsel->attr to ask the kernel to setup the
|
||||
* events, lets reuse evsel->attr.sample_max_stack as the limit in
|
||||
* trace__resolve_callchain(), allowing per-event max-stack settings
|
||||
* to override an explicitely set --max-stack global setting.
|
||||
* to override an explicitly set --max-stack global setting.
|
||||
*/
|
||||
evlist__for_each_entry(evlist, evsel) {
|
||||
if (evsel__has_callchain(evsel) &&
|
||||
|
@ -2801,18 +2857,12 @@ static int trace__run(struct trace *trace, int argc, const char **argv)
|
|||
continue;
|
||||
|
||||
while ((event = perf_mmap__read_event(md)) != NULL) {
|
||||
struct perf_sample sample;
|
||||
|
||||
++trace->nr_events;
|
||||
|
||||
err = perf_evlist__parse_sample(evlist, event, &sample);
|
||||
if (err) {
|
||||
fprintf(trace->output, "Can't parse sample, err = %d, skipping...\n", err);
|
||||
goto next_event;
|
||||
}
|
||||
err = trace__deliver_ordered_event(trace, event);
|
||||
if (err)
|
||||
goto out_disable;
|
||||
|
||||
trace__handle_event(trace, event, &sample);
|
||||
next_event:
|
||||
perf_mmap__consume(md);
|
||||
|
||||
if (interrupted)
|
||||
|
@ -2834,6 +2884,9 @@ static int trace__run(struct trace *trace, int argc, const char **argv)
|
|||
draining = true;
|
||||
|
||||
goto again;
|
||||
} else {
|
||||
if (trace__flush_ordered_events(trace))
|
||||
goto out_disable;
|
||||
}
|
||||
} else {
|
||||
goto again;
|
||||
|
@ -2844,6 +2897,8 @@ static int trace__run(struct trace *trace, int argc, const char **argv)
|
|||
|
||||
perf_evlist__disable(evlist);
|
||||
|
||||
ordered_events__flush(&trace->oe.data, OE_FLUSH__FINAL);
|
||||
|
||||
if (!err) {
|
||||
if (trace->summary)
|
||||
trace__fprintf_thread_summary(trace, trace->output);
|
||||
|
@ -3393,7 +3448,6 @@ int cmd_trace(int argc, const char **argv)
|
|||
.user_interval = ULLONG_MAX,
|
||||
.no_buffering = true,
|
||||
.mmap_pages = UINT_MAX,
|
||||
.proc_map_timeout = 500,
|
||||
},
|
||||
.output = stderr,
|
||||
.show_comm = true,
|
||||
|
@ -3464,7 +3518,7 @@ int cmd_trace(int argc, const char **argv)
|
|||
"Default: kernel.perf_event_max_stack or " __stringify(PERF_MAX_STACK_DEPTH)),
|
||||
OPT_BOOLEAN(0, "print-sample", &trace.print_sample,
|
||||
"print the PERF_RECORD_SAMPLE PERF_SAMPLE_ info, for debugging"),
|
||||
OPT_UINTEGER(0, "proc-map-timeout", &trace.opts.proc_map_timeout,
|
||||
OPT_UINTEGER(0, "proc-map-timeout", &proc_map_timeout,
|
||||
"per thread proc mmap processing timeout in ms"),
|
||||
OPT_CALLBACK('G', "cgroup", &trace, "name", "monitor event in cgroup name only",
|
||||
trace__parse_cgroups),
|
||||
|
@ -3555,6 +3609,9 @@ int cmd_trace(int argc, const char **argv)
|
|||
}
|
||||
}
|
||||
|
||||
ordered_events__init(&trace.oe.data, ordered_events__deliver_event, &trace);
|
||||
ordered_events__set_copy_on_queue(&trace.oe.data, true);
|
||||
|
||||
/*
|
||||
* If we are augmenting syscalls, then combine what we put in the
|
||||
* __augmented_syscalls__ BPF map with what is in the
|
||||
|
|
|
@ -82,7 +82,7 @@ struct record_opts {
|
|||
bool use_clockid;
|
||||
clockid_t clockid;
|
||||
u64 clockid_res_ns;
|
||||
unsigned int proc_map_timeout;
|
||||
int nr_cblocks;
|
||||
};
|
||||
|
||||
struct option;
|
||||
|
|
|
@ -433,7 +433,7 @@
|
|||
},
|
||||
{
|
||||
"PEBS": "1",
|
||||
"PublicDescription": "This is a precise version (that is, uses PEBS) of the event that counts line-splitted load uops retired to the architected path. A line split is across 64B cache-line which includes a page split (4K).",
|
||||
"PublicDescription": "This is a precise version (that is, uses PEBS) of the event that counts line-split load uops retired to the architected path. A line split is across 64B cache-line which includes a page split (4K).",
|
||||
"EventCode": "0xD0",
|
||||
"Counter": "0,1,2,3",
|
||||
"UMask": "0x41",
|
||||
|
@ -445,7 +445,7 @@
|
|||
},
|
||||
{
|
||||
"PEBS": "1",
|
||||
"PublicDescription": "This is a precise version (that is, uses PEBS) of the event that counts line-splitted store uops retired to the architected path. A line split is across 64B cache-line which includes a page split (4K).",
|
||||
"PublicDescription": "This is a precise version (that is, uses PEBS) of the event that counts line-split store uops retired to the architected path. A line split is across 64B cache-line which includes a page split (4K).",
|
||||
"EventCode": "0xD0",
|
||||
"Counter": "0,1,2,3",
|
||||
"UMask": "0x42",
|
||||
|
|
|
@ -317,7 +317,7 @@
|
|||
"CounterHTOff": "0,1,2,3,4,5,6,7"
|
||||
},
|
||||
{
|
||||
"PublicDescription": "This event counts stalls occured due to changing prefix length (66, 67 or REX.W when they change the length of the decoded instruction). Occurrences counting is proportional to the number of prefixes in a 16B-line. This may result in the following penalties: three-cycle penalty for each LCP in a 16-byte chunk.",
|
||||
"PublicDescription": "This event counts stalls occurred due to changing prefix length (66, 67 or REX.W when they change the length of the decoded instruction). Occurrences counting is proportional to the number of prefixes in a 16B-line. This may result in the following penalties: three-cycle penalty for each LCP in a 16-byte chunk.",
|
||||
"EventCode": "0x87",
|
||||
"Counter": "0,1,2,3",
|
||||
"UMask": "0x1",
|
||||
|
|
|
@ -439,7 +439,7 @@
|
|||
"PEBS": "1",
|
||||
"Counter": "0,1,2,3",
|
||||
"EventName": "MEM_UOPS_RETIRED.SPLIT_LOADS",
|
||||
"PublicDescription": "This is a precise version (that is, uses PEBS) of the event that counts line-splitted load uops retired to the architected path. A line split is across 64B cache-line which includes a page split (4K).",
|
||||
"PublicDescription": "This is a precise version (that is, uses PEBS) of the event that counts line-split load uops retired to the architected path. A line split is across 64B cache-line which includes a page split (4K).",
|
||||
"SampleAfterValue": "100003",
|
||||
"CounterHTOff": "0,1,2,3"
|
||||
},
|
||||
|
@ -451,7 +451,7 @@
|
|||
"PEBS": "1",
|
||||
"Counter": "0,1,2,3",
|
||||
"EventName": "MEM_UOPS_RETIRED.SPLIT_STORES",
|
||||
"PublicDescription": "This is a precise version (that is, uses PEBS) of the event that counts line-splitted store uops retired to the architected path. A line split is across 64B cache-line which includes a page split (4K).",
|
||||
"PublicDescription": "This is a precise version (that is, uses PEBS) of the event that counts line-split store uops retired to the architected path. A line split is across 64B cache-line which includes a page split (4K).",
|
||||
"SampleAfterValue": "100003",
|
||||
"L1_Hit_Indication": "1",
|
||||
"CounterHTOff": "0,1,2,3"
|
||||
|
|
|
@ -322,7 +322,7 @@
|
|||
"BriefDescription": "Stalls caused by changing prefix length of the instruction.",
|
||||
"Counter": "0,1,2,3",
|
||||
"EventName": "ILD_STALL.LCP",
|
||||
"PublicDescription": "This event counts stalls occured due to changing prefix length (66, 67 or REX.W when they change the length of the decoded instruction). Occurrences counting is proportional to the number of prefixes in a 16B-line. This may result in the following penalties: three-cycle penalty for each LCP in a 16-byte chunk.",
|
||||
"PublicDescription": "This event counts stalls occurred due to changing prefix length (66, 67 or REX.W when they change the length of the decoded instruction). Occurrences counting is proportional to the number of prefixes in a 16B-line. This may result in the following penalties: three-cycle penalty for each LCP in a 16-byte chunk.",
|
||||
"SampleAfterValue": "2000003",
|
||||
"CounterHTOff": "0,1,2,3,4,5,6,7"
|
||||
},
|
||||
|
|
|
@ -439,7 +439,7 @@
|
|||
"PEBS": "1",
|
||||
"Counter": "0,1,2,3",
|
||||
"EventName": "MEM_UOPS_RETIRED.SPLIT_LOADS",
|
||||
"PublicDescription": "This is a precise version (that is, uses PEBS) of the event that counts line-splitted load uops retired to the architected path. A line split is across 64B cache-line which includes a page split (4K).",
|
||||
"PublicDescription": "This is a precise version (that is, uses PEBS) of the event that counts line-split load uops retired to the architected path. A line split is across 64B cache-line which includes a page split (4K).",
|
||||
"SampleAfterValue": "100003",
|
||||
"CounterHTOff": "0,1,2,3"
|
||||
},
|
||||
|
@ -451,7 +451,7 @@
|
|||
"PEBS": "1",
|
||||
"Counter": "0,1,2,3",
|
||||
"EventName": "MEM_UOPS_RETIRED.SPLIT_STORES",
|
||||
"PublicDescription": "This is a precise version (that is, uses PEBS) of the event that counts line-splitted store uops retired to the architected path. A line split is across 64B cache-line which includes a page split (4K).",
|
||||
"PublicDescription": "This is a precise version (that is, uses PEBS) of the event that counts line-split store uops retired to the architected path. A line split is across 64B cache-line which includes a page split (4K).",
|
||||
"SampleAfterValue": "100003",
|
||||
"L1_Hit_Indication": "1",
|
||||
"CounterHTOff": "0,1,2,3"
|
||||
|
|
|
@ -322,7 +322,7 @@
|
|||
"BriefDescription": "Stalls caused by changing prefix length of the instruction.",
|
||||
"Counter": "0,1,2,3",
|
||||
"EventName": "ILD_STALL.LCP",
|
||||
"PublicDescription": "This event counts stalls occured due to changing prefix length (66, 67 or REX.W when they change the length of the decoded instruction). Occurrences counting is proportional to the number of prefixes in a 16B-line. This may result in the following penalties: three-cycle penalty for each LCP in a 16-byte chunk.",
|
||||
"PublicDescription": "This event counts stalls occurred due to changing prefix length (66, 67 or REX.W when they change the length of the decoded instruction). Occurrences counting is proportional to the number of prefixes in a 16B-line. This may result in the following penalties: three-cycle penalty for each LCP in a 16-byte chunk.",
|
||||
"SampleAfterValue": "2000003",
|
||||
"CounterHTOff": "0,1,2,3,4,5,6,7"
|
||||
},
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
},
|
||||
{
|
||||
"PEBS": "1",
|
||||
"PublicDescription": "This event counts line-splitted load uops retired to the architected path. A line split is across 64B cache-line which includes a page split (4K).",
|
||||
"PublicDescription": "This event counts line-split load uops retired to the architected path. A line split is across 64B cache-line which includes a page split (4K).",
|
||||
"EventCode": "0xD0",
|
||||
"Counter": "0,1,2,3",
|
||||
"UMask": "0x41",
|
||||
|
@ -42,7 +42,7 @@
|
|||
},
|
||||
{
|
||||
"PEBS": "1",
|
||||
"PublicDescription": "This event counts line-splitted store uops retired to the architected path. A line split is across 64B cache-line which includes a page split (4K).",
|
||||
"PublicDescription": "This event counts line-split store uops retired to the architected path. A line split is across 64B cache-line which includes a page split (4K).",
|
||||
"EventCode": "0xD0",
|
||||
"Counter": "0,1,2,3",
|
||||
"UMask": "0x42",
|
||||
|
|
|
@ -778,7 +778,7 @@
|
|||
"CounterHTOff": "0,1,2,3,4,5,6,7"
|
||||
},
|
||||
{
|
||||
"PublicDescription": "This event counts loads that followed a store to the same address, where the data could not be forwarded inside the pipeline from the store to the load. The most common reason why store forwarding would be blocked is when a load's address range overlaps with a preceeding smaller uncompleted store. See the table of not supported store forwards in the Intel? 64 and IA-32 Architectures Optimization Reference Manual. The penalty for blocked store forwarding is that the load must wait for the store to complete before it can be issued.",
|
||||
"PublicDescription": "This event counts loads that followed a store to the same address, where the data could not be forwarded inside the pipeline from the store to the load. The most common reason why store forwarding would be blocked is when a load's address range overlaps with a preceding smaller uncompleted store. See the table of not supported store forwards in the Intel? 64 and IA-32 Architectures Optimization Reference Manual. The penalty for blocked store forwarding is that the load must wait for the store to complete before it can be issued.",
|
||||
"EventCode": "0x03",
|
||||
"Counter": "0,1,2,3",
|
||||
"UMask": "0x2",
|
||||
|
|
|
@ -121,7 +121,7 @@
|
|||
"EventName": "OFFCORE_RESPONSE.ANY_PF_L2.OUTSTANDING",
|
||||
"MSRIndex": "0x1a6",
|
||||
"SampleAfterValue": "100007",
|
||||
"BriefDescription": "Counts any Prefetch requests that are outstanding, per weighted cycle, from the time of the request to when any response is received. The oustanding response should be programmed only on PMC0. ",
|
||||
"BriefDescription": "Counts any Prefetch requests that are outstanding, per weighted cycle, from the time of the request to when any response is received. The outstanding response should be programmed only on PMC0. ",
|
||||
"Offcore": "1"
|
||||
},
|
||||
{
|
||||
|
@ -187,7 +187,7 @@
|
|||
"EventName": "OFFCORE_RESPONSE.ANY_READ.OUTSTANDING",
|
||||
"MSRIndex": "0x1a6",
|
||||
"SampleAfterValue": "100007",
|
||||
"BriefDescription": "Counts any Read request that are outstanding, per weighted cycle, from the time of the request to when any response is received. The oustanding response should be programmed only on PMC0. ",
|
||||
"BriefDescription": "Counts any Read request that are outstanding, per weighted cycle, from the time of the request to when any response is received. The outstanding response should be programmed only on PMC0. ",
|
||||
"Offcore": "1"
|
||||
},
|
||||
{
|
||||
|
@ -253,7 +253,7 @@
|
|||
"EventName": "OFFCORE_RESPONSE.ANY_CODE_RD.OUTSTANDING",
|
||||
"MSRIndex": "0x1a6",
|
||||
"SampleAfterValue": "100007",
|
||||
"BriefDescription": "Counts Demand code reads and prefetch code read requests that are outstanding, per weighted cycle, from the time of the request to when any response is received. The oustanding response should be programmed only on PMC0. ",
|
||||
"BriefDescription": "Counts Demand code reads and prefetch code read requests that are outstanding, per weighted cycle, from the time of the request to when any response is received. The outstanding response should be programmed only on PMC0. ",
|
||||
"Offcore": "1"
|
||||
},
|
||||
{
|
||||
|
@ -319,7 +319,7 @@
|
|||
"EventName": "OFFCORE_RESPONSE.ANY_RFO.OUTSTANDING",
|
||||
"MSRIndex": "0x1a6",
|
||||
"SampleAfterValue": "100007",
|
||||
"BriefDescription": "Counts Demand cacheable data write requests that are outstanding, per weighted cycle, from the time of the request to when any response is received. The oustanding response should be programmed only on PMC0. ",
|
||||
"BriefDescription": "Counts Demand cacheable data write requests that are outstanding, per weighted cycle, from the time of the request to when any response is received. The outstanding response should be programmed only on PMC0. ",
|
||||
"Offcore": "1"
|
||||
},
|
||||
{
|
||||
|
@ -385,7 +385,7 @@
|
|||
"EventName": "OFFCORE_RESPONSE.ANY_DATA_RD.OUTSTANDING",
|
||||
"MSRIndex": "0x1a6",
|
||||
"SampleAfterValue": "100007",
|
||||
"BriefDescription": "Counts Demand cacheable data and L1 prefetch data read requests that are outstanding, per weighted cycle, from the time of the request to when any response is received. The oustanding response should be programmed only on PMC0. ",
|
||||
"BriefDescription": "Counts Demand cacheable data and L1 prefetch data read requests that are outstanding, per weighted cycle, from the time of the request to when any response is received. The outstanding response should be programmed only on PMC0. ",
|
||||
"Offcore": "1"
|
||||
},
|
||||
{
|
||||
|
@ -451,7 +451,7 @@
|
|||
"EventName": "OFFCORE_RESPONSE.ANY_REQUEST.OUTSTANDING",
|
||||
"MSRIndex": "0x1a6",
|
||||
"SampleAfterValue": "100007",
|
||||
"BriefDescription": "Counts any request that are outstanding, per weighted cycle, from the time of the request to when any response is received. The oustanding response should be programmed only on PMC0. ",
|
||||
"BriefDescription": "Counts any request that are outstanding, per weighted cycle, from the time of the request to when any response is received. The outstanding response should be programmed only on PMC0. ",
|
||||
"Offcore": "1"
|
||||
},
|
||||
{
|
||||
|
@ -539,7 +539,7 @@
|
|||
"EventName": "OFFCORE_RESPONSE.PF_L1_DATA_RD.OUTSTANDING",
|
||||
"MSRIndex": "0x1a6",
|
||||
"SampleAfterValue": "100007",
|
||||
"BriefDescription": "Counts L1 data HW prefetches that are outstanding, per weighted cycle, from the time of the request to when any response is received. The oustanding response should be programmed only on PMC0. ",
|
||||
"BriefDescription": "Counts L1 data HW prefetches that are outstanding, per weighted cycle, from the time of the request to when any response is received. The outstanding response should be programmed only on PMC0. ",
|
||||
"Offcore": "1"
|
||||
},
|
||||
{
|
||||
|
@ -605,7 +605,7 @@
|
|||
"EventName": "OFFCORE_RESPONSE.PF_SOFTWARE.OUTSTANDING",
|
||||
"MSRIndex": "0x1a6",
|
||||
"SampleAfterValue": "100007",
|
||||
"BriefDescription": "Counts Software Prefetches that are outstanding, per weighted cycle, from the time of the request to when any response is received. The oustanding response should be programmed only on PMC0. ",
|
||||
"BriefDescription": "Counts Software Prefetches that are outstanding, per weighted cycle, from the time of the request to when any response is received. The outstanding response should be programmed only on PMC0. ",
|
||||
"Offcore": "1"
|
||||
},
|
||||
{
|
||||
|
@ -682,7 +682,7 @@
|
|||
"EventName": "OFFCORE_RESPONSE.BUS_LOCKS.OUTSTANDING",
|
||||
"MSRIndex": "0x1a6",
|
||||
"SampleAfterValue": "100007",
|
||||
"BriefDescription": "Counts Bus locks and split lock requests that are outstanding, per weighted cycle, from the time of the request to when any response is received. The oustanding response should be programmed only on PMC0. ",
|
||||
"BriefDescription": "Counts Bus locks and split lock requests that are outstanding, per weighted cycle, from the time of the request to when any response is received. The outstanding response should be programmed only on PMC0. ",
|
||||
"Offcore": "1"
|
||||
},
|
||||
{
|
||||
|
@ -748,7 +748,7 @@
|
|||
"EventName": "OFFCORE_RESPONSE.UC_CODE_READS.OUTSTANDING",
|
||||
"MSRIndex": "0x1a6",
|
||||
"SampleAfterValue": "100007",
|
||||
"BriefDescription": "Counts UC code reads (valid only for Outstanding response type) that are outstanding, per weighted cycle, from the time of the request to when any response is received. The oustanding response should be programmed only on PMC0. ",
|
||||
"BriefDescription": "Counts UC code reads (valid only for Outstanding response type) that are outstanding, per weighted cycle, from the time of the request to when any response is received. The outstanding response should be programmed only on PMC0. ",
|
||||
"Offcore": "1"
|
||||
},
|
||||
{
|
||||
|
@ -869,7 +869,7 @@
|
|||
"EventName": "OFFCORE_RESPONSE.PARTIAL_READS.OUTSTANDING",
|
||||
"MSRIndex": "0x1a6",
|
||||
"SampleAfterValue": "100007",
|
||||
"BriefDescription": "Counts Partial reads (UC or WC and is valid only for Outstanding response type). that are outstanding, per weighted cycle, from the time of the request to when any response is received. The oustanding response should be programmed only on PMC0. ",
|
||||
"BriefDescription": "Counts Partial reads (UC or WC and is valid only for Outstanding response type). that are outstanding, per weighted cycle, from the time of the request to when any response is received. The outstanding response should be programmed only on PMC0. ",
|
||||
"Offcore": "1"
|
||||
},
|
||||
{
|
||||
|
@ -935,7 +935,7 @@
|
|||
"EventName": "OFFCORE_RESPONSE.PF_L2_CODE_RD.OUTSTANDING",
|
||||
"MSRIndex": "0x1a6",
|
||||
"SampleAfterValue": "100007",
|
||||
"BriefDescription": "Counts L2 code HW prefetches that are outstanding, per weighted cycle, from the time of the request to when any response is received. The oustanding response should be programmed only on PMC0. ",
|
||||
"BriefDescription": "Counts L2 code HW prefetches that are outstanding, per weighted cycle, from the time of the request to when any response is received. The outstanding response should be programmed only on PMC0. ",
|
||||
"Offcore": "1"
|
||||
},
|
||||
{
|
||||
|
@ -1067,7 +1067,7 @@
|
|||
"EventName": "OFFCORE_RESPONSE.DEMAND_CODE_RD.OUTSTANDING",
|
||||
"MSRIndex": "0x1a6",
|
||||
"SampleAfterValue": "100007",
|
||||
"BriefDescription": "Counts demand code reads and prefetch code reads that are outstanding, per weighted cycle, from the time of the request to when any response is received. The oustanding response should be programmed only on PMC0. ",
|
||||
"BriefDescription": "Counts demand code reads and prefetch code reads that are outstanding, per weighted cycle, from the time of the request to when any response is received. The outstanding response should be programmed only on PMC0. ",
|
||||
"Offcore": "1"
|
||||
},
|
||||
{
|
||||
|
@ -1133,7 +1133,7 @@
|
|||
"EventName": "OFFCORE_RESPONSE.DEMAND_RFO.OUTSTANDING",
|
||||
"MSRIndex": "0x1a6",
|
||||
"SampleAfterValue": "100007",
|
||||
"BriefDescription": "Counts Demand cacheable data writes that are outstanding, per weighted cycle, from the time of the request to when any response is received. The oustanding response should be programmed only on PMC0. ",
|
||||
"BriefDescription": "Counts Demand cacheable data writes that are outstanding, per weighted cycle, from the time of the request to when any response is received. The outstanding response should be programmed only on PMC0. ",
|
||||
"Offcore": "1"
|
||||
},
|
||||
{
|
||||
|
@ -1199,7 +1199,7 @@
|
|||
"EventName": "OFFCORE_RESPONSE.DEMAND_DATA_RD.OUTSTANDING",
|
||||
"MSRIndex": "0x1a6",
|
||||
"SampleAfterValue": "100007",
|
||||
"BriefDescription": "Counts demand cacheable data and L1 prefetch data reads that are outstanding, per weighted cycle, from the time of the request to when any response is received. The oustanding response should be programmed only on PMC0. ",
|
||||
"BriefDescription": "Counts demand cacheable data and L1 prefetch data reads that are outstanding, per weighted cycle, from the time of the request to when any response is received. The outstanding response should be programmed only on PMC0. ",
|
||||
"Offcore": "1"
|
||||
},
|
||||
{
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
},
|
||||
{
|
||||
"PEBS": "1",
|
||||
"PublicDescription": "This event counts line-splitted load uops retired to the architected path. A line split is across 64B cache-line which includes a page split (4K).",
|
||||
"PublicDescription": "This event counts line-split load uops retired to the architected path. A line split is across 64B cache-line which includes a page split (4K).",
|
||||
"EventCode": "0xD0",
|
||||
"Counter": "0,1,2,3",
|
||||
"UMask": "0x41",
|
||||
|
@ -42,7 +42,7 @@
|
|||
},
|
||||
{
|
||||
"PEBS": "1",
|
||||
"PublicDescription": "This event counts line-splitted store uops retired to the architected path. A line split is across 64B cache-line which includes a page split (4K).",
|
||||
"PublicDescription": "This event counts line-split store uops retired to the architected path. A line split is across 64B cache-line which includes a page split (4K).",
|
||||
"EventCode": "0xD0",
|
||||
"Counter": "0,1,2,3",
|
||||
"UMask": "0x42",
|
||||
|
|
|
@ -778,7 +778,7 @@
|
|||
"CounterHTOff": "0,1,2,3,4,5,6,7"
|
||||
},
|
||||
{
|
||||
"PublicDescription": "This event counts loads that followed a store to the same address, where the data could not be forwarded inside the pipeline from the store to the load. The most common reason why store forwarding would be blocked is when a load's address range overlaps with a preceeding smaller uncompleted store. See the table of not supported store forwards in the Intel? 64 and IA-32 Architectures Optimization Reference Manual. The penalty for blocked store forwarding is that the load must wait for the store to complete before it can be issued.",
|
||||
"PublicDescription": "This event counts loads that followed a store to the same address, where the data could not be forwarded inside the pipeline from the store to the load. The most common reason why store forwarding would be blocked is when a load's address range overlaps with a preceding smaller uncompleted store. See the table of not supported store forwards in the Intel? 64 and IA-32 Architectures Optimization Reference Manual. The penalty for blocked store forwarding is that the load must wait for the store to complete before it can be issued.",
|
||||
"EventCode": "0x03",
|
||||
"Counter": "0,1,2,3",
|
||||
"UMask": "0x2",
|
||||
|
|
|
@ -73,7 +73,7 @@
|
|||
},
|
||||
{
|
||||
"BriefDescription": "Actual Average Latency for L1 data-cache miss demand loads",
|
||||
"MetricExpr": "L1D_PEND_MISS.PENDING / ( MEM_LOAD_RETIRED.L1_MISS_PS + MEM_LOAD_RETIRED.FB_HIT_PS )",
|
||||
"MetricExpr": "L1D_PEND_MISS.PENDING / ( MEM_LOAD_RETIRED.L1_MISS + MEM_LOAD_RETIRED.FB_HIT )",
|
||||
"MetricGroup": "Memory_Bound;Memory_Lat",
|
||||
"MetricName": "Load_Miss_Real_Latency"
|
||||
},
|
||||
|
|
|
@ -73,7 +73,7 @@
|
|||
},
|
||||
{
|
||||
"BriefDescription": "Actual Average Latency for L1 data-cache miss demand loads",
|
||||
"MetricExpr": "L1D_PEND_MISS.PENDING / ( MEM_LOAD_RETIRED.L1_MISS_PS + MEM_LOAD_RETIRED.FB_HIT_PS )",
|
||||
"MetricExpr": "L1D_PEND_MISS.PENDING / ( MEM_LOAD_RETIRED.L1_MISS + MEM_LOAD_RETIRED.FB_HIT )",
|
||||
"MetricGroup": "Memory_Bound;Memory_Lat",
|
||||
"MetricName": "Load_Miss_Real_Latency"
|
||||
},
|
||||
|
|
|
@ -428,7 +428,7 @@
|
|||
"EventCode": "0x5C",
|
||||
"EventName": "UNC_CHA_SNOOP_RESP.RSP_WBWB",
|
||||
"PerPkg": "1",
|
||||
"PublicDescription": "Counts when a transaction with the opcode type Rsp*WB Snoop Response was received which indicates which indicates the data was written back to it's home. This is returned when a non-RFO request hits a cacheline in the Modified state. The Cache can either downgrade the cacheline to a S (Shared) or I (Invalid) state depending on how the system has been configured. This reponse will also be sent when a cache requests E (Exclusive) ownership of a cache line without receiving data, because the cache must acquire ownership.",
|
||||
"PublicDescription": "Counts when a transaction with the opcode type Rsp*WB Snoop Response was received which indicates which indicates the data was written back to it's home. This is returned when a non-RFO request hits a cacheline in the Modified state. The Cache can either downgrade the cacheline to a S (Shared) or I (Invalid) state depending on how the system has been configured. This response will also be sent when a cache requests E (Exclusive) ownership of a cache line without receiving data, because the cache must acquire ownership.",
|
||||
"UMask": "0x10",
|
||||
"Unit": "CHA"
|
||||
},
|
||||
|
@ -967,7 +967,7 @@
|
|||
"EventCode": "0x57",
|
||||
"EventName": "UNC_M2M_PREFCAM_INSERTS",
|
||||
"PerPkg": "1",
|
||||
"PublicDescription": "Counts when the M2M (Mesh to Memory) recieves a prefetch request and inserts it into its outstanding prefetch queue. Explanatory Side Note: the prefect queue is made from CAM: Content Addressable Memory",
|
||||
"PublicDescription": "Counts when the M2M (Mesh to Memory) receives a prefetch request and inserts it into its outstanding prefetch queue. Explanatory Side Note: the prefect queue is made from CAM: Content Addressable Memory",
|
||||
"Unit": "M2M"
|
||||
},
|
||||
{
|
||||
|
@ -1041,7 +1041,7 @@
|
|||
"EventCode": "0x31",
|
||||
"EventName": "UNC_UPI_RxL_BYPASSED.SLOT0",
|
||||
"PerPkg": "1",
|
||||
"PublicDescription": "Counts incoming FLITs (FLow control unITs) which bypassed the slot0 RxQ buffer (Receive Queue) and passed directly to the Egress. This is a latency optimization, and should generally be the common case. If this value is less than the number of FLITs transfered, it implies that there was queueing getting onto the ring, and thus the transactions saw higher latency.",
|
||||
"PublicDescription": "Counts incoming FLITs (FLow control unITs) which bypassed the slot0 RxQ buffer (Receive Queue) and passed directly to the Egress. This is a latency optimization, and should generally be the common case. If this value is less than the number of FLITs transferred, it implies that there was queueing getting onto the ring, and thus the transactions saw higher latency.",
|
||||
"UMask": "0x1",
|
||||
"Unit": "UPI LL"
|
||||
},
|
||||
|
@ -1051,17 +1051,17 @@
|
|||
"EventCode": "0x31",
|
||||
"EventName": "UNC_UPI_RxL_BYPASSED.SLOT1",
|
||||
"PerPkg": "1",
|
||||
"PublicDescription": "Counts incoming FLITs (FLow control unITs) which bypassed the slot1 RxQ buffer (Receive Queue) and passed directly across the BGF and into the Egress. This is a latency optimization, and should generally be the common case. If this value is less than the number of FLITs transfered, it implies that there was queueing getting onto the ring, and thus the transactions saw higher latency.",
|
||||
"PublicDescription": "Counts incoming FLITs (FLow control unITs) which bypassed the slot1 RxQ buffer (Receive Queue) and passed directly across the BGF and into the Egress. This is a latency optimization, and should generally be the common case. If this value is less than the number of FLITs transferred, it implies that there was queueing getting onto the ring, and thus the transactions saw higher latency.",
|
||||
"UMask": "0x2",
|
||||
"Unit": "UPI LL"
|
||||
},
|
||||
{
|
||||
"BriefDescription": "FLITs received which bypassed the Slot0 Recieve Buffer",
|
||||
"BriefDescription": "FLITs received which bypassed the Slot0 Receive Buffer",
|
||||
"Counter": "0,1,2,3",
|
||||
"EventCode": "0x31",
|
||||
"EventName": "UNC_UPI_RxL_BYPASSED.SLOT2",
|
||||
"PerPkg": "1",
|
||||
"PublicDescription": "Counts incoming FLITs (FLow control unITs) whcih bypassed the slot2 RxQ buffer (Receive Queue) and passed directly to the Egress. This is a latency optimization, and should generally be the common case. If this value is less than the number of FLITs transfered, it implies that there was queueing getting onto the ring, and thus the transactions saw higher latency.",
|
||||
"PublicDescription": "Counts incoming FLITs (FLow control unITs) which bypassed the slot2 RxQ buffer (Receive Queue) and passed directly to the Egress. This is a latency optimization, and should generally be the common case. If this value is less than the number of FLITs transferred, it implies that there was queueing getting onto the ring, and thus the transactions saw higher latency.",
|
||||
"UMask": "0x4",
|
||||
"Unit": "UPI LL"
|
||||
},
|
||||
|
|
|
@ -182,7 +182,7 @@ int test__attr(struct test *test __maybe_unused, int subtest __maybe_unused)
|
|||
char path_perf[PATH_MAX];
|
||||
char path_dir[PATH_MAX];
|
||||
|
||||
/* First try developement tree tests. */
|
||||
/* First try development tree tests. */
|
||||
if (!lstat("./tests", &st))
|
||||
return run_dir("./tests", "./perf");
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ class Event(dict):
|
|||
if not self.has_key(t) or not other.has_key(t):
|
||||
continue
|
||||
if not data_equal(self[t], other[t]):
|
||||
log.warning("expected %s=%s, got %s" % (t, self[t], other[t]))
|
||||
log.warning("expected %s=%s, got %s" % (t, self[t], other[t]))
|
||||
|
||||
# Test file description needs to have following sections:
|
||||
# [config]
|
||||
|
|
|
@ -291,12 +291,20 @@ int test__bp_signal(struct test *test __maybe_unused, int subtest __maybe_unused
|
|||
|
||||
bool test__bp_signal_is_supported(void)
|
||||
{
|
||||
/*
|
||||
* The powerpc so far does not have support to even create
|
||||
* instruction breakpoint using the perf event interface.
|
||||
* Once it's there we can release this.
|
||||
*/
|
||||
#if defined(__powerpc__) || defined(__s390x__)
|
||||
/*
|
||||
* PowerPC and S390 do not support creation of instruction
|
||||
* breakpoints using the perf_event interface.
|
||||
*
|
||||
* ARM requires explicit rounding down of the instruction
|
||||
* pointer in Thumb mode, and then requires the single-step
|
||||
* to be handled explicitly in the overflow handler to avoid
|
||||
* stepping into the SIGIO handler and getting stuck on the
|
||||
* breakpointed instruction.
|
||||
*
|
||||
* Just disable the test for these architectures until these
|
||||
* issues are resolved.
|
||||
*/
|
||||
#if defined(__powerpc__) || defined(__s390x__) || defined(__arm__)
|
||||
return false;
|
||||
#else
|
||||
return true;
|
||||
|
|
|
@ -599,7 +599,7 @@ static int do_test_code_reading(bool try_kcore)
|
|||
}
|
||||
|
||||
ret = perf_event__synthesize_thread_map(NULL, threads,
|
||||
perf_event__process, machine, false, 500);
|
||||
perf_event__process, machine, false);
|
||||
if (ret < 0) {
|
||||
pr_debug("perf_event__synthesize_thread_map failed\n");
|
||||
goto out_err;
|
||||
|
|
|
@ -34,7 +34,7 @@ static int init_live_machine(struct machine *machine)
|
|||
pid_t pid = getpid();
|
||||
|
||||
return perf_event__synthesize_mmap_events(NULL, &event, pid, pid,
|
||||
mmap_handler, machine, true, 500);
|
||||
mmap_handler, machine, true);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -132,7 +132,7 @@ static int synth_all(struct machine *machine)
|
|||
{
|
||||
return perf_event__synthesize_threads(NULL,
|
||||
perf_event__process,
|
||||
machine, 0, 500, 1);
|
||||
machine, 0, 1);
|
||||
}
|
||||
|
||||
static int synth_process(struct machine *machine)
|
||||
|
@ -144,7 +144,7 @@ static int synth_process(struct machine *machine)
|
|||
|
||||
err = perf_event__synthesize_thread_map(NULL, map,
|
||||
perf_event__process,
|
||||
machine, 0, 500);
|
||||
machine, 0);
|
||||
|
||||
thread_map__put(map);
|
||||
return err;
|
||||
|
|
|
@ -58,6 +58,7 @@ int test__PERF_RECORD(struct test *test __maybe_unused, int subtest __maybe_unus
|
|||
char *bname, *mmap_filename;
|
||||
u64 prev_time = 0;
|
||||
bool found_cmd_mmap = false,
|
||||
found_coreutils_mmap = false,
|
||||
found_libc_mmap = false,
|
||||
found_vdso_mmap = false,
|
||||
found_ld_mmap = false;
|
||||
|
@ -254,6 +255,8 @@ int test__PERF_RECORD(struct test *test __maybe_unused, int subtest __maybe_unus
|
|||
if (bname != NULL) {
|
||||
if (!found_cmd_mmap)
|
||||
found_cmd_mmap = !strcmp(bname + 1, cmd);
|
||||
if (!found_coreutils_mmap)
|
||||
found_coreutils_mmap = !strcmp(bname + 1, "coreutils");
|
||||
if (!found_libc_mmap)
|
||||
found_libc_mmap = !strncmp(bname + 1, "libc", 4);
|
||||
if (!found_ld_mmap)
|
||||
|
@ -292,7 +295,7 @@ int test__PERF_RECORD(struct test *test __maybe_unused, int subtest __maybe_unus
|
|||
}
|
||||
|
||||
found_exit:
|
||||
if (nr_events[PERF_RECORD_COMM] > 1) {
|
||||
if (nr_events[PERF_RECORD_COMM] > 1 + !!found_coreutils_mmap) {
|
||||
pr_debug("Excessive number of PERF_RECORD_COMM events!\n");
|
||||
++errs;
|
||||
}
|
||||
|
@ -302,7 +305,7 @@ int test__PERF_RECORD(struct test *test __maybe_unused, int subtest __maybe_unus
|
|||
++errs;
|
||||
}
|
||||
|
||||
if (!found_cmd_mmap) {
|
||||
if (!found_cmd_mmap && !found_coreutils_mmap) {
|
||||
pr_debug("PERF_RECORD_MMAP for %s missing!\n", cmd);
|
||||
++errs;
|
||||
}
|
||||
|
|
|
@ -20,12 +20,12 @@ egrep -q $regex ${arch_mman} && \
|
|||
(egrep $regex ${arch_mman} | \
|
||||
sed -r "s/$regex/\2 \1/g" | \
|
||||
xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n")
|
||||
egrep -q '#[[:space:]]*include[[:space:]]+<uapi/asm-generic/mman.*' ${arch_mman} &&
|
||||
([ ! -f ${arch_mman} ] || egrep -q '#[[:space:]]*include[[:space:]]+<uapi/asm-generic/mman.*' ${arch_mman}) &&
|
||||
(egrep $regex ${header_dir}/mman-common.h | \
|
||||
egrep -vw 'MAP_(UNINITIALIZED|TYPE|SHARED_VALIDATE)' | \
|
||||
sed -r "s/$regex/\2 \1/g" | \
|
||||
xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n")
|
||||
egrep -q '#[[:space:]]*include[[:space:]]+<uapi/asm-generic/mman.h>.*' ${arch_mman} &&
|
||||
([ ! -f ${arch_mman} ] || egrep -q '#[[:space:]]*include[[:space:]]+<uapi/asm-generic/mman.h>.*' ${arch_mman}) &&
|
||||
(egrep $regex ${header_dir}/mman.h | \
|
||||
sed -r "s/$regex/\2 \1/g" | \
|
||||
xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n")
|
||||
|
|
|
@ -2219,10 +2219,21 @@ static int hists_browser__scnprintf_title(struct hist_browser *browser, char *bf
|
|||
if (!is_report_browser(hbt)) {
|
||||
struct perf_top *top = hbt->arg;
|
||||
|
||||
printed += scnprintf(bf + printed, size - printed,
|
||||
" lost: %" PRIu64 "/%" PRIu64,
|
||||
top->lost, top->lost_total);
|
||||
|
||||
printed += scnprintf(bf + printed, size - printed,
|
||||
" drop: %" PRIu64 "/%" PRIu64,
|
||||
top->drop, top->drop_total);
|
||||
|
||||
if (top->zero)
|
||||
printed += scnprintf(bf + printed, size - printed, " [z]");
|
||||
|
||||
perf_top__reset_sample_counters(top);
|
||||
}
|
||||
|
||||
|
||||
return printed;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ static void tui_helpline__push(const char *msg)
|
|||
SLsmg_set_color(0);
|
||||
SLsmg_write_nstring((char *)msg, SLtt_Screen_Cols);
|
||||
SLsmg_refresh();
|
||||
strncpy(ui_helpline__current, msg, sz)[sz - 1] = '\0';
|
||||
strlcpy(ui_helpline__current, msg, sz);
|
||||
}
|
||||
|
||||
static int tui_helpline__show(const char *format, va_list ap)
|
||||
|
|
|
@ -77,6 +77,7 @@ libperf-y += stat-shadow.o
|
|||
libperf-y += stat-display.o
|
||||
libperf-y += record.o
|
||||
libperf-y += srcline.o
|
||||
libperf-y += srccode.o
|
||||
libperf-y += data.o
|
||||
libperf-y += tsc.o
|
||||
libperf-y += cloexec.o
|
||||
|
|
|
@ -134,6 +134,7 @@ static int arch__associate_ins_ops(struct arch* arch, const char *name, struct i
|
|||
return 0;
|
||||
}
|
||||
|
||||
#include "arch/arc/annotate/instructions.c"
|
||||
#include "arch/arm/annotate/instructions.c"
|
||||
#include "arch/arm64/annotate/instructions.c"
|
||||
#include "arch/x86/annotate/instructions.c"
|
||||
|
@ -142,6 +143,10 @@ static int arch__associate_ins_ops(struct arch* arch, const char *name, struct i
|
|||
#include "arch/sparc/annotate/instructions.c"
|
||||
|
||||
static struct arch architectures[] = {
|
||||
{
|
||||
.name = "arc",
|
||||
.init = arc__annotate_init,
|
||||
},
|
||||
{
|
||||
.name = "arm",
|
||||
.init = arm__annotate_init,
|
||||
|
@ -1000,6 +1005,7 @@ static unsigned annotation__count_insn(struct annotation *notes, u64 start, u64
|
|||
static void annotation__count_and_fill(struct annotation *notes, u64 start, u64 end, struct cyc_hist *ch)
|
||||
{
|
||||
unsigned n_insn;
|
||||
unsigned int cover_insn = 0;
|
||||
u64 offset;
|
||||
|
||||
n_insn = annotation__count_insn(notes, start, end);
|
||||
|
@ -1013,21 +1019,34 @@ static void annotation__count_and_fill(struct annotation *notes, u64 start, u64
|
|||
for (offset = start; offset <= end; offset++) {
|
||||
struct annotation_line *al = notes->offsets[offset];
|
||||
|
||||
if (al)
|
||||
if (al && al->ipc == 0.0) {
|
||||
al->ipc = ipc;
|
||||
cover_insn++;
|
||||
}
|
||||
}
|
||||
|
||||
if (cover_insn) {
|
||||
notes->hit_cycles += ch->cycles;
|
||||
notes->hit_insn += n_insn * ch->num;
|
||||
notes->cover_insn += cover_insn;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void annotation__compute_ipc(struct annotation *notes, size_t size)
|
||||
{
|
||||
u64 offset;
|
||||
s64 offset;
|
||||
|
||||
if (!notes->src || !notes->src->cycles_hist)
|
||||
return;
|
||||
|
||||
notes->total_insn = annotation__count_insn(notes, 0, size - 1);
|
||||
notes->hit_cycles = 0;
|
||||
notes->hit_insn = 0;
|
||||
notes->cover_insn = 0;
|
||||
|
||||
pthread_mutex_lock(¬es->lock);
|
||||
for (offset = 0; offset < size; ++offset) {
|
||||
for (offset = size - 1; offset >= 0; --offset) {
|
||||
struct cyc_hist *ch;
|
||||
|
||||
ch = ¬es->src->cycles_hist[offset];
|
||||
|
@ -1758,7 +1777,7 @@ static int symbol__disassemble(struct symbol *sym, struct annotate_args *args)
|
|||
while (!feof(file)) {
|
||||
/*
|
||||
* The source code line number (lineno) needs to be kept in
|
||||
* accross calls to symbol__parse_objdump_line(), so that it
|
||||
* across calls to symbol__parse_objdump_line(), so that it
|
||||
* can associate it with the instructions till the next one.
|
||||
* See disasm_line__new() and struct disasm_line::line_nr.
|
||||
*/
|
||||
|
@ -2563,6 +2582,22 @@ static void disasm_line__write(struct disasm_line *dl, struct annotation *notes,
|
|||
disasm_line__scnprintf(dl, bf, size, !notes->options->use_offset);
|
||||
}
|
||||
|
||||
static void ipc_coverage_string(char *bf, int size, struct annotation *notes)
|
||||
{
|
||||
double ipc = 0.0, coverage = 0.0;
|
||||
|
||||
if (notes->hit_cycles)
|
||||
ipc = notes->hit_insn / ((double)notes->hit_cycles);
|
||||
|
||||
if (notes->total_insn) {
|
||||
coverage = notes->cover_insn * 100.0 /
|
||||
((double)notes->total_insn);
|
||||
}
|
||||
|
||||
scnprintf(bf, size, "(Average IPC: %.2f, IPC Coverage: %.1f%%)",
|
||||
ipc, coverage);
|
||||
}
|
||||
|
||||
static void __annotation_line__write(struct annotation_line *al, struct annotation *notes,
|
||||
bool first_line, bool current_entry, bool change_color, int width,
|
||||
void *obj, unsigned int percent_type,
|
||||
|
@ -2658,6 +2693,11 @@ static void __annotation_line__write(struct annotation_line *al, struct annotati
|
|||
ANNOTATION__MINMAX_CYCLES_WIDTH - 1,
|
||||
"Cycle(min/max)");
|
||||
}
|
||||
|
||||
if (show_title && !*al->line) {
|
||||
ipc_coverage_string(bf, sizeof(bf), notes);
|
||||
obj__printf(obj, "%*s", ANNOTATION__AVG_IPC_WIDTH, bf);
|
||||
}
|
||||
}
|
||||
|
||||
obj__printf(obj, " ");
|
||||
|
@ -2763,6 +2803,7 @@ int symbol__annotate2(struct symbol *sym, struct map *map, struct perf_evsel *ev
|
|||
notes->nr_events = nr_pcnt;
|
||||
|
||||
annotation__update_column_widths(notes);
|
||||
sym->annotate2 = true;
|
||||
|
||||
return 0;
|
||||
|
||||
|
|
|
@ -64,6 +64,7 @@ bool ins__is_fused(struct arch *arch, const char *ins1, const char *ins2);
|
|||
#define ANNOTATION__IPC_WIDTH 6
|
||||
#define ANNOTATION__CYCLES_WIDTH 6
|
||||
#define ANNOTATION__MINMAX_CYCLES_WIDTH 19
|
||||
#define ANNOTATION__AVG_IPC_WIDTH 36
|
||||
|
||||
struct annotation_options {
|
||||
bool hide_src_code,
|
||||
|
@ -262,6 +263,10 @@ struct annotation {
|
|||
pthread_mutex_t lock;
|
||||
u64 max_coverage;
|
||||
u64 start;
|
||||
u64 hit_cycles;
|
||||
u64 hit_insn;
|
||||
unsigned int total_insn;
|
||||
unsigned int cover_insn;
|
||||
struct annotation_options *options;
|
||||
struct annotation_line **offsets;
|
||||
int nr_events;
|
||||
|
|
|
@ -99,7 +99,7 @@ struct bpf_object *bpf__prepare_load(const char *filename, bool source)
|
|||
if (err)
|
||||
return ERR_PTR(-BPF_LOADER_ERRNO__COMPILE);
|
||||
} else
|
||||
pr_debug("bpf: successfull builtin compilation\n");
|
||||
pr_debug("bpf: successful builtin compilation\n");
|
||||
obj = bpf_object__open_buffer(obj_buf, obj_buf_sz, filename);
|
||||
|
||||
if (!IS_ERR_OR_NULL(obj) && llvm_param.dump_obj)
|
||||
|
@ -1603,7 +1603,7 @@ struct perf_evsel *bpf__setup_output_event(struct perf_evlist *evlist, const cha
|
|||
|
||||
op = bpf_map__add_newop(map, NULL);
|
||||
if (IS_ERR(op))
|
||||
return ERR_PTR(PTR_ERR(op));
|
||||
return ERR_CAST(op);
|
||||
op->op_type = BPF_MAP_OP_SET_EVSEL;
|
||||
op->v.evsel = evsel;
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "util.h"
|
||||
#include "cache.h"
|
||||
#include <subcmd/exec-cmd.h>
|
||||
#include "util/event.h" /* proc_map_timeout */
|
||||
#include "util/hist.h" /* perf_hist_config */
|
||||
#include "util/llvm-utils.h" /* perf_llvm_config */
|
||||
#include "config.h"
|
||||
|
@ -419,6 +420,9 @@ static int perf_buildid_config(const char *var, const char *value)
|
|||
static int perf_default_core_config(const char *var __maybe_unused,
|
||||
const char *value __maybe_unused)
|
||||
{
|
||||
if (!strcmp(var, "core.proc-map-timeout"))
|
||||
proc_map_timeout = strtoul(value, NULL, 10);
|
||||
|
||||
/* Add other config variables here. */
|
||||
return 0;
|
||||
}
|
||||
|
@ -811,14 +815,14 @@ int config_error_nonbool(const char *var)
|
|||
void set_buildid_dir(const char *dir)
|
||||
{
|
||||
if (dir)
|
||||
scnprintf(buildid_dir, MAXPATHLEN-1, "%s", dir);
|
||||
scnprintf(buildid_dir, MAXPATHLEN, "%s", dir);
|
||||
|
||||
/* default to $HOME/.debug */
|
||||
if (buildid_dir[0] == '\0') {
|
||||
char *home = getenv("HOME");
|
||||
|
||||
if (home) {
|
||||
snprintf(buildid_dir, MAXPATHLEN-1, "%s/%s",
|
||||
snprintf(buildid_dir, MAXPATHLEN, "%s/%s",
|
||||
home, DEBUG_CACHE_DIR);
|
||||
} else {
|
||||
strncpy(buildid_dir, DEBUG_CACHE_DIR, MAXPATHLEN-1);
|
||||
|
|
|
@ -116,6 +116,19 @@ int cs_etm_decoder__get_packet(struct cs_etm_decoder *decoder,
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int cs_etm_decoder__gen_etmv3_config(struct cs_etm_trace_params *params,
|
||||
ocsd_etmv3_cfg *config)
|
||||
{
|
||||
config->reg_idr = params->etmv3.reg_idr;
|
||||
config->reg_ctrl = params->etmv3.reg_ctrl;
|
||||
config->reg_ccer = params->etmv3.reg_ccer;
|
||||
config->reg_trc_id = params->etmv3.reg_trc_id;
|
||||
config->arch_ver = ARCH_V7;
|
||||
config->core_prof = profile_CortexA;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void cs_etm_decoder__gen_etmv4_config(struct cs_etm_trace_params *params,
|
||||
ocsd_etmv4_cfg *config)
|
||||
{
|
||||
|
@ -237,10 +250,19 @@ cs_etm_decoder__create_etm_packet_printer(struct cs_etm_trace_params *t_params,
|
|||
struct cs_etm_decoder *decoder)
|
||||
{
|
||||
const char *decoder_name;
|
||||
ocsd_etmv3_cfg config_etmv3;
|
||||
ocsd_etmv4_cfg trace_config_etmv4;
|
||||
void *trace_config;
|
||||
|
||||
switch (t_params->protocol) {
|
||||
case CS_ETM_PROTO_ETMV3:
|
||||
case CS_ETM_PROTO_PTM:
|
||||
cs_etm_decoder__gen_etmv3_config(t_params, &config_etmv3);
|
||||
decoder_name = (t_params->protocol == CS_ETM_PROTO_ETMV3) ?
|
||||
OCSD_BUILTIN_DCD_ETMV3 :
|
||||
OCSD_BUILTIN_DCD_PTM;
|
||||
trace_config = &config_etmv3;
|
||||
break;
|
||||
case CS_ETM_PROTO_ETMV4i:
|
||||
cs_etm_decoder__gen_etmv4_config(t_params, &trace_config_etmv4);
|
||||
decoder_name = OCSD_BUILTIN_DCD_ETMV4I;
|
||||
|
@ -263,9 +285,12 @@ static void cs_etm_decoder__clear_buffer(struct cs_etm_decoder *decoder)
|
|||
decoder->tail = 0;
|
||||
decoder->packet_count = 0;
|
||||
for (i = 0; i < MAX_BUFFER; i++) {
|
||||
decoder->packet_buffer[i].isa = CS_ETM_ISA_UNKNOWN;
|
||||
decoder->packet_buffer[i].start_addr = CS_ETM_INVAL_ADDR;
|
||||
decoder->packet_buffer[i].end_addr = CS_ETM_INVAL_ADDR;
|
||||
decoder->packet_buffer[i].instr_count = 0;
|
||||
decoder->packet_buffer[i].last_instr_taken_branch = false;
|
||||
decoder->packet_buffer[i].last_instr_size = 0;
|
||||
decoder->packet_buffer[i].exc = false;
|
||||
decoder->packet_buffer[i].exc_ret = false;
|
||||
decoder->packet_buffer[i].cpu = INT_MIN;
|
||||
|
@ -294,11 +319,15 @@ cs_etm_decoder__buffer_packet(struct cs_etm_decoder *decoder,
|
|||
decoder->packet_count++;
|
||||
|
||||
decoder->packet_buffer[et].sample_type = sample_type;
|
||||
decoder->packet_buffer[et].isa = CS_ETM_ISA_UNKNOWN;
|
||||
decoder->packet_buffer[et].exc = false;
|
||||
decoder->packet_buffer[et].exc_ret = false;
|
||||
decoder->packet_buffer[et].cpu = *((int *)inode->priv);
|
||||
decoder->packet_buffer[et].start_addr = CS_ETM_INVAL_ADDR;
|
||||
decoder->packet_buffer[et].end_addr = CS_ETM_INVAL_ADDR;
|
||||
decoder->packet_buffer[et].instr_count = 0;
|
||||
decoder->packet_buffer[et].last_instr_taken_branch = false;
|
||||
decoder->packet_buffer[et].last_instr_size = 0;
|
||||
|
||||
if (decoder->packet_count == MAX_BUFFER - 1)
|
||||
return OCSD_RESP_WAIT;
|
||||
|
@ -321,8 +350,28 @@ cs_etm_decoder__buffer_range(struct cs_etm_decoder *decoder,
|
|||
|
||||
packet = &decoder->packet_buffer[decoder->tail];
|
||||
|
||||
switch (elem->isa) {
|
||||
case ocsd_isa_aarch64:
|
||||
packet->isa = CS_ETM_ISA_A64;
|
||||
break;
|
||||
case ocsd_isa_arm:
|
||||
packet->isa = CS_ETM_ISA_A32;
|
||||
break;
|
||||
case ocsd_isa_thumb2:
|
||||
packet->isa = CS_ETM_ISA_T32;
|
||||
break;
|
||||
case ocsd_isa_tee:
|
||||
case ocsd_isa_jazelle:
|
||||
case ocsd_isa_custom:
|
||||
case ocsd_isa_unknown:
|
||||
default:
|
||||
packet->isa = CS_ETM_ISA_UNKNOWN;
|
||||
}
|
||||
|
||||
packet->start_addr = elem->st_addr;
|
||||
packet->end_addr = elem->en_addr;
|
||||
packet->instr_count = elem->num_instr_range;
|
||||
|
||||
switch (elem->last_i_type) {
|
||||
case OCSD_INSTR_BR:
|
||||
case OCSD_INSTR_BR_INDIRECT:
|
||||
|
@ -336,6 +385,8 @@ cs_etm_decoder__buffer_range(struct cs_etm_decoder *decoder,
|
|||
break;
|
||||
}
|
||||
|
||||
packet->last_instr_size = elem->last_instr_sz;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -398,11 +449,20 @@ static int cs_etm_decoder__create_etm_packet_decoder(
|
|||
struct cs_etm_decoder *decoder)
|
||||
{
|
||||
const char *decoder_name;
|
||||
ocsd_etmv3_cfg config_etmv3;
|
||||
ocsd_etmv4_cfg trace_config_etmv4;
|
||||
void *trace_config;
|
||||
u8 csid;
|
||||
|
||||
switch (t_params->protocol) {
|
||||
case CS_ETM_PROTO_ETMV3:
|
||||
case CS_ETM_PROTO_PTM:
|
||||
cs_etm_decoder__gen_etmv3_config(t_params, &config_etmv3);
|
||||
decoder_name = (t_params->protocol == CS_ETM_PROTO_ETMV3) ?
|
||||
OCSD_BUILTIN_DCD_ETMV3 :
|
||||
OCSD_BUILTIN_DCD_PTM;
|
||||
trace_config = &config_etmv3;
|
||||
break;
|
||||
case CS_ETM_PROTO_ETMV4i:
|
||||
cs_etm_decoder__gen_etmv4_config(t_params, &trace_config_etmv4);
|
||||
decoder_name = OCSD_BUILTIN_DCD_ETMV4I;
|
||||
|
|
|
@ -28,11 +28,21 @@ enum cs_etm_sample_type {
|
|||
CS_ETM_TRACE_ON = 1 << 1,
|
||||
};
|
||||
|
||||
enum cs_etm_isa {
|
||||
CS_ETM_ISA_UNKNOWN,
|
||||
CS_ETM_ISA_A64,
|
||||
CS_ETM_ISA_A32,
|
||||
CS_ETM_ISA_T32,
|
||||
};
|
||||
|
||||
struct cs_etm_packet {
|
||||
enum cs_etm_sample_type sample_type;
|
||||
enum cs_etm_isa isa;
|
||||
u64 start_addr;
|
||||
u64 end_addr;
|
||||
u32 instr_count;
|
||||
u8 last_instr_taken_branch;
|
||||
u8 last_instr_size;
|
||||
u8 exc;
|
||||
u8 exc_ret;
|
||||
int cpu;
|
||||
|
@ -43,6 +53,13 @@ struct cs_etm_queue;
|
|||
typedef u32 (*cs_etm_mem_cb_type)(struct cs_etm_queue *, u64,
|
||||
size_t, u8 *);
|
||||
|
||||
struct cs_etmv3_trace_params {
|
||||
u32 reg_ctrl;
|
||||
u32 reg_trc_id;
|
||||
u32 reg_ccer;
|
||||
u32 reg_idr;
|
||||
};
|
||||
|
||||
struct cs_etmv4_trace_params {
|
||||
u32 reg_idr0;
|
||||
u32 reg_idr1;
|
||||
|
@ -55,6 +72,7 @@ struct cs_etmv4_trace_params {
|
|||
struct cs_etm_trace_params {
|
||||
int protocol;
|
||||
union {
|
||||
struct cs_etmv3_trace_params etmv3;
|
||||
struct cs_etmv4_trace_params etmv4;
|
||||
};
|
||||
};
|
||||
|
@ -78,6 +96,7 @@ enum {
|
|||
CS_ETM_PROTO_ETMV3 = 1,
|
||||
CS_ETM_PROTO_ETMV4i,
|
||||
CS_ETM_PROTO_ETMV4d,
|
||||
CS_ETM_PROTO_PTM,
|
||||
};
|
||||
|
||||
enum {
|
||||
|
|
|
@ -31,14 +31,6 @@
|
|||
|
||||
#define MAX_TIMESTAMP (~0ULL)
|
||||
|
||||
/*
|
||||
* A64 instructions are always 4 bytes
|
||||
*
|
||||
* Only A64 is supported, so can use this constant for converting between
|
||||
* addresses and instruction counts, calculting offsets etc
|
||||
*/
|
||||
#define A64_INSTR_SIZE 4
|
||||
|
||||
struct cs_etm_auxtrace {
|
||||
struct auxtrace auxtrace;
|
||||
struct auxtrace_queues queues;
|
||||
|
@ -91,6 +83,19 @@ static int cs_etm__update_queues(struct cs_etm_auxtrace *etm);
|
|||
static int cs_etm__process_timeless_queues(struct cs_etm_auxtrace *etm,
|
||||
pid_t tid, u64 time_);
|
||||
|
||||
/* PTMs ETMIDR [11:8] set to b0011 */
|
||||
#define ETMIDR_PTM_VERSION 0x00000300
|
||||
|
||||
static u32 cs_etm__get_v7_protocol_version(u32 etmidr)
|
||||
{
|
||||
etmidr &= ETMIDR_PTM_VERSION;
|
||||
|
||||
if (etmidr == ETMIDR_PTM_VERSION)
|
||||
return CS_ETM_PROTO_PTM;
|
||||
|
||||
return CS_ETM_PROTO_ETMV3;
|
||||
}
|
||||
|
||||
static void cs_etm__packet_dump(const char *pkt_string)
|
||||
{
|
||||
const char *color = PERF_COLOR_BLUE;
|
||||
|
@ -122,15 +127,31 @@ static void cs_etm__dump_event(struct cs_etm_auxtrace *etm,
|
|||
/* Use metadata to fill in trace parameters for trace decoder */
|
||||
t_params = zalloc(sizeof(*t_params) * etm->num_cpu);
|
||||
for (i = 0; i < etm->num_cpu; i++) {
|
||||
t_params[i].protocol = CS_ETM_PROTO_ETMV4i;
|
||||
t_params[i].etmv4.reg_idr0 = etm->metadata[i][CS_ETMV4_TRCIDR0];
|
||||
t_params[i].etmv4.reg_idr1 = etm->metadata[i][CS_ETMV4_TRCIDR1];
|
||||
t_params[i].etmv4.reg_idr2 = etm->metadata[i][CS_ETMV4_TRCIDR2];
|
||||
t_params[i].etmv4.reg_idr8 = etm->metadata[i][CS_ETMV4_TRCIDR8];
|
||||
t_params[i].etmv4.reg_configr =
|
||||
if (etm->metadata[i][CS_ETM_MAGIC] == __perf_cs_etmv3_magic) {
|
||||
u32 etmidr = etm->metadata[i][CS_ETM_ETMIDR];
|
||||
|
||||
t_params[i].protocol =
|
||||
cs_etm__get_v7_protocol_version(etmidr);
|
||||
t_params[i].etmv3.reg_ctrl =
|
||||
etm->metadata[i][CS_ETM_ETMCR];
|
||||
t_params[i].etmv3.reg_trc_id =
|
||||
etm->metadata[i][CS_ETM_ETMTRACEIDR];
|
||||
} else if (etm->metadata[i][CS_ETM_MAGIC] ==
|
||||
__perf_cs_etmv4_magic) {
|
||||
t_params[i].protocol = CS_ETM_PROTO_ETMV4i;
|
||||
t_params[i].etmv4.reg_idr0 =
|
||||
etm->metadata[i][CS_ETMV4_TRCIDR0];
|
||||
t_params[i].etmv4.reg_idr1 =
|
||||
etm->metadata[i][CS_ETMV4_TRCIDR1];
|
||||
t_params[i].etmv4.reg_idr2 =
|
||||
etm->metadata[i][CS_ETMV4_TRCIDR2];
|
||||
t_params[i].etmv4.reg_idr8 =
|
||||
etm->metadata[i][CS_ETMV4_TRCIDR8];
|
||||
t_params[i].etmv4.reg_configr =
|
||||
etm->metadata[i][CS_ETMV4_TRCCONFIGR];
|
||||
t_params[i].etmv4.reg_traceidr =
|
||||
t_params[i].etmv4.reg_traceidr =
|
||||
etm->metadata[i][CS_ETMV4_TRCTRACEIDR];
|
||||
}
|
||||
}
|
||||
|
||||
/* Set decoder parameters to simply print the trace packets */
|
||||
|
@ -360,15 +381,31 @@ static struct cs_etm_queue *cs_etm__alloc_queue(struct cs_etm_auxtrace *etm,
|
|||
goto out_free;
|
||||
|
||||
for (i = 0; i < etm->num_cpu; i++) {
|
||||
t_params[i].protocol = CS_ETM_PROTO_ETMV4i;
|
||||
t_params[i].etmv4.reg_idr0 = etm->metadata[i][CS_ETMV4_TRCIDR0];
|
||||
t_params[i].etmv4.reg_idr1 = etm->metadata[i][CS_ETMV4_TRCIDR1];
|
||||
t_params[i].etmv4.reg_idr2 = etm->metadata[i][CS_ETMV4_TRCIDR2];
|
||||
t_params[i].etmv4.reg_idr8 = etm->metadata[i][CS_ETMV4_TRCIDR8];
|
||||
t_params[i].etmv4.reg_configr =
|
||||
if (etm->metadata[i][CS_ETM_MAGIC] == __perf_cs_etmv3_magic) {
|
||||
u32 etmidr = etm->metadata[i][CS_ETM_ETMIDR];
|
||||
|
||||
t_params[i].protocol =
|
||||
cs_etm__get_v7_protocol_version(etmidr);
|
||||
t_params[i].etmv3.reg_ctrl =
|
||||
etm->metadata[i][CS_ETM_ETMCR];
|
||||
t_params[i].etmv3.reg_trc_id =
|
||||
etm->metadata[i][CS_ETM_ETMTRACEIDR];
|
||||
} else if (etm->metadata[i][CS_ETM_MAGIC] ==
|
||||
__perf_cs_etmv4_magic) {
|
||||
t_params[i].protocol = CS_ETM_PROTO_ETMV4i;
|
||||
t_params[i].etmv4.reg_idr0 =
|
||||
etm->metadata[i][CS_ETMV4_TRCIDR0];
|
||||
t_params[i].etmv4.reg_idr1 =
|
||||
etm->metadata[i][CS_ETMV4_TRCIDR1];
|
||||
t_params[i].etmv4.reg_idr2 =
|
||||
etm->metadata[i][CS_ETMV4_TRCIDR2];
|
||||
t_params[i].etmv4.reg_idr8 =
|
||||
etm->metadata[i][CS_ETMV4_TRCIDR8];
|
||||
t_params[i].etmv4.reg_configr =
|
||||
etm->metadata[i][CS_ETMV4_TRCCONFIGR];
|
||||
t_params[i].etmv4.reg_traceidr =
|
||||
t_params[i].etmv4.reg_traceidr =
|
||||
etm->metadata[i][CS_ETMV4_TRCTRACEIDR];
|
||||
}
|
||||
}
|
||||
|
||||
/* Set decoder parameters to simply print the trace packets */
|
||||
|
@ -510,21 +547,17 @@ static inline void cs_etm__reset_last_branch_rb(struct cs_etm_queue *etmq)
|
|||
etmq->last_branch_rb->nr = 0;
|
||||
}
|
||||
|
||||
static inline u64 cs_etm__last_executed_instr(struct cs_etm_packet *packet)
|
||||
{
|
||||
/* Returns 0 for the CS_ETM_TRACE_ON packet */
|
||||
if (packet->sample_type == CS_ETM_TRACE_ON)
|
||||
return 0;
|
||||
static inline int cs_etm__t32_instr_size(struct cs_etm_queue *etmq,
|
||||
u64 addr) {
|
||||
u8 instrBytes[2];
|
||||
|
||||
cs_etm__mem_access(etmq, addr, ARRAY_SIZE(instrBytes), instrBytes);
|
||||
/*
|
||||
* The packet records the execution range with an exclusive end address
|
||||
*
|
||||
* A64 instructions are constant size, so the last executed
|
||||
* instruction is A64_INSTR_SIZE before the end address
|
||||
* Will need to do instruction level decode for T32 instructions as
|
||||
* they can be variable size (not yet supported).
|
||||
* T32 instruction size is indicated by bits[15:11] of the first
|
||||
* 16-bit word of the instruction: 0b11101, 0b11110 and 0b11111
|
||||
* denote a 32-bit instruction.
|
||||
*/
|
||||
return packet->end_addr - A64_INSTR_SIZE;
|
||||
return ((instrBytes[1] & 0xF8) >= 0xE8) ? 4 : 2;
|
||||
}
|
||||
|
||||
static inline u64 cs_etm__first_executed_instr(struct cs_etm_packet *packet)
|
||||
|
@ -536,27 +569,32 @@ static inline u64 cs_etm__first_executed_instr(struct cs_etm_packet *packet)
|
|||
return packet->start_addr;
|
||||
}
|
||||
|
||||
static inline u64 cs_etm__instr_count(const struct cs_etm_packet *packet)
|
||||
static inline
|
||||
u64 cs_etm__last_executed_instr(const struct cs_etm_packet *packet)
|
||||
{
|
||||
/*
|
||||
* Only A64 instructions are currently supported, so can get
|
||||
* instruction count by dividing.
|
||||
* Will need to do instruction level decode for T32 instructions as
|
||||
* they can be variable size (not yet supported).
|
||||
*/
|
||||
return (packet->end_addr - packet->start_addr) / A64_INSTR_SIZE;
|
||||
/* Returns 0 for the CS_ETM_TRACE_ON packet */
|
||||
if (packet->sample_type == CS_ETM_TRACE_ON)
|
||||
return 0;
|
||||
|
||||
return packet->end_addr - packet->last_instr_size;
|
||||
}
|
||||
|
||||
static inline u64 cs_etm__instr_addr(const struct cs_etm_packet *packet,
|
||||
static inline u64 cs_etm__instr_addr(struct cs_etm_queue *etmq,
|
||||
const struct cs_etm_packet *packet,
|
||||
u64 offset)
|
||||
{
|
||||
/*
|
||||
* Only A64 instructions are currently supported, so can get
|
||||
* instruction address by muliplying.
|
||||
* Will need to do instruction level decode for T32 instructions as
|
||||
* they can be variable size (not yet supported).
|
||||
*/
|
||||
return packet->start_addr + offset * A64_INSTR_SIZE;
|
||||
if (packet->isa == CS_ETM_ISA_T32) {
|
||||
u64 addr = packet->start_addr;
|
||||
|
||||
while (offset > 0) {
|
||||
addr += cs_etm__t32_instr_size(etmq, addr);
|
||||
offset--;
|
||||
}
|
||||
return addr;
|
||||
}
|
||||
|
||||
/* Assume a 4 byte instruction size (A32/A64) */
|
||||
return packet->start_addr + offset * 4;
|
||||
}
|
||||
|
||||
static void cs_etm__update_last_branch_rb(struct cs_etm_queue *etmq)
|
||||
|
@ -888,9 +926,8 @@ static int cs_etm__sample(struct cs_etm_queue *etmq)
|
|||
struct cs_etm_auxtrace *etm = etmq->etm;
|
||||
struct cs_etm_packet *tmp;
|
||||
int ret;
|
||||
u64 instrs_executed;
|
||||
u64 instrs_executed = etmq->packet->instr_count;
|
||||
|
||||
instrs_executed = cs_etm__instr_count(etmq->packet);
|
||||
etmq->period_instructions += instrs_executed;
|
||||
|
||||
/*
|
||||
|
@ -920,7 +957,7 @@ static int cs_etm__sample(struct cs_etm_queue *etmq)
|
|||
* executed, but PC has not advanced to next instruction)
|
||||
*/
|
||||
u64 offset = (instrs_executed - instrs_over - 1);
|
||||
u64 addr = cs_etm__instr_addr(etmq->packet, offset);
|
||||
u64 addr = cs_etm__instr_addr(etmq, etmq->packet, offset);
|
||||
|
||||
ret = cs_etm__synth_instruction_sample(
|
||||
etmq, addr, etm->instructions_sample_period);
|
||||
|
|
|
@ -295,7 +295,7 @@ static int decompress_kmodule(struct dso *dso, const char *name,
|
|||
unlink(tmpbuf);
|
||||
|
||||
if (pathname && (fd >= 0))
|
||||
strncpy(pathname, tmpbuf, len);
|
||||
strlcpy(pathname, tmpbuf, len);
|
||||
|
||||
return fd;
|
||||
}
|
||||
|
|
|
@ -166,7 +166,7 @@ const char *perf_env__arch(struct perf_env *env)
|
|||
struct utsname uts;
|
||||
char *arch_name;
|
||||
|
||||
if (!env) { /* Assume local operation */
|
||||
if (!env || !env->arch) { /* Assume local operation */
|
||||
if (uname(&uts) < 0)
|
||||
return NULL;
|
||||
arch_name = uts.machine;
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
#include "asm/bug.h"
|
||||
#include "stat.h"
|
||||
|
||||
#define DEFAULT_PROC_MAP_PARSE_TIMEOUT 500
|
||||
|
||||
static const char *perf_event__names[] = {
|
||||
[0] = "TOTAL",
|
||||
[PERF_RECORD_MMAP] = "MMAP",
|
||||
|
@ -72,6 +74,8 @@ static const char *perf_ns__names[] = {
|
|||
[CGROUP_NS_INDEX] = "cgroup",
|
||||
};
|
||||
|
||||
unsigned int proc_map_timeout = DEFAULT_PROC_MAP_PARSE_TIMEOUT;
|
||||
|
||||
const char *perf_event__name(unsigned int id)
|
||||
{
|
||||
if (id >= ARRAY_SIZE(perf_event__names))
|
||||
|
@ -323,8 +327,7 @@ int perf_event__synthesize_mmap_events(struct perf_tool *tool,
|
|||
pid_t pid, pid_t tgid,
|
||||
perf_event__handler_t process,
|
||||
struct machine *machine,
|
||||
bool mmap_data,
|
||||
unsigned int proc_map_timeout)
|
||||
bool mmap_data)
|
||||
{
|
||||
char filename[PATH_MAX];
|
||||
FILE *fp;
|
||||
|
@ -521,8 +524,7 @@ static int __event__synthesize_thread(union perf_event *comm_event,
|
|||
perf_event__handler_t process,
|
||||
struct perf_tool *tool,
|
||||
struct machine *machine,
|
||||
bool mmap_data,
|
||||
unsigned int proc_map_timeout)
|
||||
bool mmap_data)
|
||||
{
|
||||
char filename[PATH_MAX];
|
||||
DIR *tasks;
|
||||
|
@ -548,8 +550,7 @@ static int __event__synthesize_thread(union perf_event *comm_event,
|
|||
*/
|
||||
if (pid == tgid &&
|
||||
perf_event__synthesize_mmap_events(tool, mmap_event, pid, tgid,
|
||||
process, machine, mmap_data,
|
||||
proc_map_timeout))
|
||||
process, machine, mmap_data))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -598,7 +599,7 @@ static int __event__synthesize_thread(union perf_event *comm_event,
|
|||
if (_pid == pid) {
|
||||
/* process the parent's maps too */
|
||||
rc = perf_event__synthesize_mmap_events(tool, mmap_event, pid, tgid,
|
||||
process, machine, mmap_data, proc_map_timeout);
|
||||
process, machine, mmap_data);
|
||||
if (rc)
|
||||
break;
|
||||
}
|
||||
|
@ -612,8 +613,7 @@ int perf_event__synthesize_thread_map(struct perf_tool *tool,
|
|||
struct thread_map *threads,
|
||||
perf_event__handler_t process,
|
||||
struct machine *machine,
|
||||
bool mmap_data,
|
||||
unsigned int proc_map_timeout)
|
||||
bool mmap_data)
|
||||
{
|
||||
union perf_event *comm_event, *mmap_event, *fork_event;
|
||||
union perf_event *namespaces_event;
|
||||
|
@ -643,7 +643,7 @@ int perf_event__synthesize_thread_map(struct perf_tool *tool,
|
|||
fork_event, namespaces_event,
|
||||
thread_map__pid(threads, thread), 0,
|
||||
process, tool, machine,
|
||||
mmap_data, proc_map_timeout)) {
|
||||
mmap_data)) {
|
||||
err = -1;
|
||||
break;
|
||||
}
|
||||
|
@ -669,7 +669,7 @@ int perf_event__synthesize_thread_map(struct perf_tool *tool,
|
|||
fork_event, namespaces_event,
|
||||
comm_event->comm.pid, 0,
|
||||
process, tool, machine,
|
||||
mmap_data, proc_map_timeout)) {
|
||||
mmap_data)) {
|
||||
err = -1;
|
||||
break;
|
||||
}
|
||||
|
@ -690,7 +690,6 @@ static int __perf_event__synthesize_threads(struct perf_tool *tool,
|
|||
perf_event__handler_t process,
|
||||
struct machine *machine,
|
||||
bool mmap_data,
|
||||
unsigned int proc_map_timeout,
|
||||
struct dirent **dirent,
|
||||
int start,
|
||||
int num)
|
||||
|
@ -734,8 +733,7 @@ static int __perf_event__synthesize_threads(struct perf_tool *tool,
|
|||
*/
|
||||
__event__synthesize_thread(comm_event, mmap_event, fork_event,
|
||||
namespaces_event, pid, 1, process,
|
||||
tool, machine, mmap_data,
|
||||
proc_map_timeout);
|
||||
tool, machine, mmap_data);
|
||||
}
|
||||
err = 0;
|
||||
|
||||
|
@ -755,7 +753,6 @@ struct synthesize_threads_arg {
|
|||
perf_event__handler_t process;
|
||||
struct machine *machine;
|
||||
bool mmap_data;
|
||||
unsigned int proc_map_timeout;
|
||||
struct dirent **dirent;
|
||||
int num;
|
||||
int start;
|
||||
|
@ -767,7 +764,7 @@ static void *synthesize_threads_worker(void *arg)
|
|||
|
||||
__perf_event__synthesize_threads(args->tool, args->process,
|
||||
args->machine, args->mmap_data,
|
||||
args->proc_map_timeout, args->dirent,
|
||||
args->dirent,
|
||||
args->start, args->num);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -776,7 +773,6 @@ int perf_event__synthesize_threads(struct perf_tool *tool,
|
|||
perf_event__handler_t process,
|
||||
struct machine *machine,
|
||||
bool mmap_data,
|
||||
unsigned int proc_map_timeout,
|
||||
unsigned int nr_threads_synthesize)
|
||||
{
|
||||
struct synthesize_threads_arg *args = NULL;
|
||||
|
@ -806,7 +802,6 @@ int perf_event__synthesize_threads(struct perf_tool *tool,
|
|||
if (thread_nr <= 1) {
|
||||
err = __perf_event__synthesize_threads(tool, process,
|
||||
machine, mmap_data,
|
||||
proc_map_timeout,
|
||||
dirent, base, n);
|
||||
goto free_dirent;
|
||||
}
|
||||
|
@ -828,7 +823,6 @@ int perf_event__synthesize_threads(struct perf_tool *tool,
|
|||
args[i].process = process;
|
||||
args[i].machine = machine;
|
||||
args[i].mmap_data = mmap_data;
|
||||
args[i].proc_map_timeout = proc_map_timeout;
|
||||
args[i].dirent = dirent;
|
||||
}
|
||||
for (i = 0; i < m; i++) {
|
||||
|
@ -1577,6 +1571,24 @@ struct map *thread__find_map(struct thread *thread, u8 cpumode, u64 addr,
|
|||
return al->map;
|
||||
}
|
||||
|
||||
/*
|
||||
* For branch stacks or branch samples, the sample cpumode might not be correct
|
||||
* because it applies only to the sample 'ip' and not necessary to 'addr' or
|
||||
* branch stack addresses. If possible, use a fallback to deal with those cases.
|
||||
*/
|
||||
struct map *thread__find_map_fb(struct thread *thread, u8 cpumode, u64 addr,
|
||||
struct addr_location *al)
|
||||
{
|
||||
struct map *map = thread__find_map(thread, cpumode, addr, al);
|
||||
struct machine *machine = thread->mg->machine;
|
||||
u8 addr_cpumode = machine__addr_cpumode(machine, cpumode, addr);
|
||||
|
||||
if (map || addr_cpumode == cpumode)
|
||||
return map;
|
||||
|
||||
return thread__find_map(thread, addr_cpumode, addr, al);
|
||||
}
|
||||
|
||||
struct symbol *thread__find_symbol(struct thread *thread, u8 cpumode,
|
||||
u64 addr, struct addr_location *al)
|
||||
{
|
||||
|
@ -1586,6 +1598,15 @@ struct symbol *thread__find_symbol(struct thread *thread, u8 cpumode,
|
|||
return al->sym;
|
||||
}
|
||||
|
||||
struct symbol *thread__find_symbol_fb(struct thread *thread, u8 cpumode,
|
||||
u64 addr, struct addr_location *al)
|
||||
{
|
||||
al->sym = NULL;
|
||||
if (thread__find_map_fb(thread, cpumode, addr, al))
|
||||
al->sym = map__find_symbol(al->map, al->addr);
|
||||
return al->sym;
|
||||
}
|
||||
|
||||
/*
|
||||
* Callers need to drop the reference to al->thread, obtained in
|
||||
* machine__findnew_thread()
|
||||
|
@ -1679,7 +1700,7 @@ bool sample_addr_correlates_sym(struct perf_event_attr *attr)
|
|||
void thread__resolve(struct thread *thread, struct addr_location *al,
|
||||
struct perf_sample *sample)
|
||||
{
|
||||
thread__find_map(thread, sample->cpumode, sample->addr, al);
|
||||
thread__find_map_fb(thread, sample->cpumode, sample->addr, al);
|
||||
|
||||
al->cpu = sample->cpu;
|
||||
al->sym = NULL;
|
||||
|
|
|
@ -669,8 +669,7 @@ typedef int (*perf_event__handler_t)(struct perf_tool *tool,
|
|||
int perf_event__synthesize_thread_map(struct perf_tool *tool,
|
||||
struct thread_map *threads,
|
||||
perf_event__handler_t process,
|
||||
struct machine *machine, bool mmap_data,
|
||||
unsigned int proc_map_timeout);
|
||||
struct machine *machine, bool mmap_data);
|
||||
int perf_event__synthesize_thread_map2(struct perf_tool *tool,
|
||||
struct thread_map *threads,
|
||||
perf_event__handler_t process,
|
||||
|
@ -682,7 +681,6 @@ int perf_event__synthesize_cpu_map(struct perf_tool *tool,
|
|||
int perf_event__synthesize_threads(struct perf_tool *tool,
|
||||
perf_event__handler_t process,
|
||||
struct machine *machine, bool mmap_data,
|
||||
unsigned int proc_map_timeout,
|
||||
unsigned int nr_threads_synthesize);
|
||||
int perf_event__synthesize_kernel_mmap(struct perf_tool *tool,
|
||||
perf_event__handler_t process,
|
||||
|
@ -797,8 +795,7 @@ int perf_event__synthesize_mmap_events(struct perf_tool *tool,
|
|||
pid_t pid, pid_t tgid,
|
||||
perf_event__handler_t process,
|
||||
struct machine *machine,
|
||||
bool mmap_data,
|
||||
unsigned int proc_map_timeout);
|
||||
bool mmap_data);
|
||||
|
||||
int perf_event__synthesize_extra_kmaps(struct perf_tool *tool,
|
||||
perf_event__handler_t process,
|
||||
|
@ -829,5 +826,6 @@ int perf_event_paranoid(void);
|
|||
|
||||
extern int sysctl_perf_event_max_stack;
|
||||
extern int sysctl_perf_event_max_contexts_per_stack;
|
||||
extern unsigned int proc_map_timeout;
|
||||
|
||||
#endif /* __PERF_RECORD_H */
|
||||
|
|
|
@ -1018,7 +1018,7 @@ int perf_evlist__parse_mmap_pages(const struct option *opt, const char *str,
|
|||
*/
|
||||
int perf_evlist__mmap_ex(struct perf_evlist *evlist, unsigned int pages,
|
||||
unsigned int auxtrace_pages,
|
||||
bool auxtrace_overwrite)
|
||||
bool auxtrace_overwrite, int nr_cblocks)
|
||||
{
|
||||
struct perf_evsel *evsel;
|
||||
const struct cpu_map *cpus = evlist->cpus;
|
||||
|
@ -1028,7 +1028,7 @@ int perf_evlist__mmap_ex(struct perf_evlist *evlist, unsigned int pages,
|
|||
* Its value is decided by evsel's write_backward.
|
||||
* So &mp should not be passed through const pointer.
|
||||
*/
|
||||
struct mmap_params mp;
|
||||
struct mmap_params mp = { .nr_cblocks = nr_cblocks };
|
||||
|
||||
if (!evlist->mmap)
|
||||
evlist->mmap = perf_evlist__alloc_mmap(evlist, false);
|
||||
|
@ -1060,7 +1060,7 @@ int perf_evlist__mmap_ex(struct perf_evlist *evlist, unsigned int pages,
|
|||
|
||||
int perf_evlist__mmap(struct perf_evlist *evlist, unsigned int pages)
|
||||
{
|
||||
return perf_evlist__mmap_ex(evlist, pages, 0, false);
|
||||
return perf_evlist__mmap_ex(evlist, pages, 0, false, 0);
|
||||
}
|
||||
|
||||
int perf_evlist__create_maps(struct perf_evlist *evlist, struct target *target)
|
||||
|
|
|
@ -162,7 +162,7 @@ unsigned long perf_event_mlock_kb_in_pages(void);
|
|||
|
||||
int perf_evlist__mmap_ex(struct perf_evlist *evlist, unsigned int pages,
|
||||
unsigned int auxtrace_pages,
|
||||
bool auxtrace_overwrite);
|
||||
bool auxtrace_overwrite, int nr_cblocks);
|
||||
int perf_evlist__mmap(struct perf_evlist *evlist, unsigned int pages);
|
||||
void perf_evlist__munmap(struct perf_evlist *evlist);
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ struct perf_evsel {
|
|||
char *name;
|
||||
double scale;
|
||||
const char *unit;
|
||||
struct tep_event_format *tp_format;
|
||||
struct tep_event *tp_format;
|
||||
off_t id_offset;
|
||||
struct perf_stat_evsel *stats;
|
||||
void *priv;
|
||||
|
@ -216,7 +216,7 @@ static inline struct perf_evsel *perf_evsel__newtp(const char *sys, const char *
|
|||
|
||||
struct perf_evsel *perf_evsel__new_cycles(bool precise);
|
||||
|
||||
struct tep_event_format *event_format__new(const char *sys, const char *name);
|
||||
struct tep_event *event_format__new(const char *sys, const char *name);
|
||||
|
||||
void perf_evsel__init(struct perf_evsel *evsel,
|
||||
struct perf_event_attr *attr, int idx);
|
||||
|
|
|
@ -173,6 +173,7 @@ int sample__fprintf_callchain(struct perf_sample *sample, int left_alignment,
|
|||
if (!print_oneline)
|
||||
printed += fprintf(fp, "\n");
|
||||
|
||||
/* Add srccode here too? */
|
||||
if (symbol_conf.bt_stop_list &&
|
||||
node->sym &&
|
||||
strlist__has_entry(symbol_conf.bt_stop_list,
|
||||
|
|
|
@ -2798,7 +2798,7 @@ static int perf_header__adds_write(struct perf_header *header,
|
|||
lseek(fd, sec_start, SEEK_SET);
|
||||
/*
|
||||
* may write more than needed due to dropped feature, but
|
||||
* this is okay, reader will skip the mising entries
|
||||
* this is okay, reader will skip the missing entries
|
||||
*/
|
||||
err = do_write(&ff, feat_sec, sec_size);
|
||||
if (err < 0)
|
||||
|
@ -3268,7 +3268,7 @@ static int read_attr(int fd, struct perf_header *ph,
|
|||
static int perf_evsel__prepare_tracepoint_event(struct perf_evsel *evsel,
|
||||
struct tep_handle *pevent)
|
||||
{
|
||||
struct tep_event_format *event;
|
||||
struct tep_event *event;
|
||||
char bf[128];
|
||||
|
||||
/* already prepared */
|
||||
|
@ -3583,7 +3583,7 @@ perf_event__synthesize_event_update_unit(struct perf_tool *tool,
|
|||
if (ev == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
strncpy(ev->data, evsel->unit, size);
|
||||
strlcpy(ev->data, evsel->unit, size + 1);
|
||||
err = process(tool, (union perf_event *)ev, NULL, NULL);
|
||||
free(ev);
|
||||
return err;
|
||||
|
@ -3622,7 +3622,7 @@ perf_event__synthesize_event_update_name(struct perf_tool *tool,
|
|||
if (ev == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
strncpy(ev->data, evsel->name, len);
|
||||
strlcpy(ev->data, evsel->name, len + 1);
|
||||
err = process(tool, (union perf_event*) ev, NULL, NULL);
|
||||
free(ev);
|
||||
return err;
|
||||
|
|
|
@ -1160,7 +1160,7 @@ void hist_entry__delete(struct hist_entry *he)
|
|||
|
||||
/*
|
||||
* If this is not the last column, then we need to pad it according to the
|
||||
* pre-calculated max lenght for this column, otherwise don't bother adding
|
||||
* pre-calculated max length for this column, otherwise don't bother adding
|
||||
* spaces because that would break viewing this with, for instance, 'less',
|
||||
* that would show tons of trailing spaces when a long C++ demangled method
|
||||
* names is sampled.
|
||||
|
|
|
@ -62,6 +62,7 @@ enum hist_column {
|
|||
HISTC_TRACE,
|
||||
HISTC_SYM_SIZE,
|
||||
HISTC_DSO_SIZE,
|
||||
HISTC_SYMBOL_IPC,
|
||||
HISTC_NR_COLS, /* Last entry */
|
||||
};
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ struct jit_buf_desc {
|
|||
uint64_t sample_type;
|
||||
size_t bufsize;
|
||||
FILE *in;
|
||||
bool needs_bswap; /* handles cross-endianess */
|
||||
bool needs_bswap; /* handles cross-endianness */
|
||||
bool use_arch_timestamp;
|
||||
void *debug_data;
|
||||
void *unwinding_data;
|
||||
|
|
|
@ -137,7 +137,7 @@ struct machine *machine__new_kallsyms(void)
|
|||
struct machine *machine = machine__new_host();
|
||||
/*
|
||||
* FIXME:
|
||||
* 1) We should switch to machine__load_kallsyms(), i.e. not explicitely
|
||||
* 1) We should switch to machine__load_kallsyms(), i.e. not explicitly
|
||||
* ask for not using the kcore parsing code, once this one is fixed
|
||||
* to create a map per module.
|
||||
*/
|
||||
|
@ -2493,15 +2493,13 @@ int machines__for_each_thread(struct machines *machines,
|
|||
int __machine__synthesize_threads(struct machine *machine, struct perf_tool *tool,
|
||||
struct target *target, struct thread_map *threads,
|
||||
perf_event__handler_t process, bool data_mmap,
|
||||
unsigned int proc_map_timeout,
|
||||
unsigned int nr_threads_synthesize)
|
||||
{
|
||||
if (target__has_task(target))
|
||||
return perf_event__synthesize_thread_map(tool, threads, process, machine, data_mmap, proc_map_timeout);
|
||||
return perf_event__synthesize_thread_map(tool, threads, process, machine, data_mmap);
|
||||
else if (target__has_cpu(target))
|
||||
return perf_event__synthesize_threads(tool, process,
|
||||
machine, data_mmap,
|
||||
proc_map_timeout,
|
||||
nr_threads_synthesize);
|
||||
/* command specified */
|
||||
return 0;
|
||||
|
@ -2592,6 +2590,33 @@ int machine__get_kernel_start(struct machine *machine)
|
|||
return err;
|
||||
}
|
||||
|
||||
u8 machine__addr_cpumode(struct machine *machine, u8 cpumode, u64 addr)
|
||||
{
|
||||
u8 addr_cpumode = cpumode;
|
||||
bool kernel_ip;
|
||||
|
||||
if (!machine->single_address_space)
|
||||
goto out;
|
||||
|
||||
kernel_ip = machine__kernel_ip(machine, addr);
|
||||
switch (cpumode) {
|
||||
case PERF_RECORD_MISC_KERNEL:
|
||||
case PERF_RECORD_MISC_USER:
|
||||
addr_cpumode = kernel_ip ? PERF_RECORD_MISC_KERNEL :
|
||||
PERF_RECORD_MISC_USER;
|
||||
break;
|
||||
case PERF_RECORD_MISC_GUEST_KERNEL:
|
||||
case PERF_RECORD_MISC_GUEST_USER:
|
||||
addr_cpumode = kernel_ip ? PERF_RECORD_MISC_GUEST_KERNEL :
|
||||
PERF_RECORD_MISC_GUEST_USER;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
out:
|
||||
return addr_cpumode;
|
||||
}
|
||||
|
||||
struct dso *machine__findnew_dso(struct machine *machine, const char *filename)
|
||||
{
|
||||
return dsos__findnew(&machine->dsos, filename);
|
||||
|
|
|
@ -42,6 +42,7 @@ struct machine {
|
|||
u16 id_hdr_size;
|
||||
bool comm_exec;
|
||||
bool kptr_restrict_warned;
|
||||
bool single_address_space;
|
||||
char *root_dir;
|
||||
char *mmap_name;
|
||||
struct threads threads[THREADS__TABLE_SIZE];
|
||||
|
@ -99,6 +100,8 @@ static inline bool machine__kernel_ip(struct machine *machine, u64 ip)
|
|||
return ip >= kernel_start;
|
||||
}
|
||||
|
||||
u8 machine__addr_cpumode(struct machine *machine, u8 cpumode, u64 addr);
|
||||
|
||||
struct thread *machine__find_thread(struct machine *machine, pid_t pid,
|
||||
pid_t tid);
|
||||
struct comm *machine__thread_exec_comm(struct machine *machine,
|
||||
|
@ -247,17 +250,14 @@ int machines__for_each_thread(struct machines *machines,
|
|||
int __machine__synthesize_threads(struct machine *machine, struct perf_tool *tool,
|
||||
struct target *target, struct thread_map *threads,
|
||||
perf_event__handler_t process, bool data_mmap,
|
||||
unsigned int proc_map_timeout,
|
||||
unsigned int nr_threads_synthesize);
|
||||
static inline
|
||||
int machine__synthesize_threads(struct machine *machine, struct target *target,
|
||||
struct thread_map *threads, bool data_mmap,
|
||||
unsigned int proc_map_timeout,
|
||||
unsigned int nr_threads_synthesize)
|
||||
{
|
||||
return __machine__synthesize_threads(machine, NULL, target, threads,
|
||||
perf_event__process, data_mmap,
|
||||
proc_map_timeout,
|
||||
nr_threads_synthesize);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "srcline.h"
|
||||
#include "namespaces.h"
|
||||
#include "unwind.h"
|
||||
#include "srccode.h"
|
||||
|
||||
static void __maps__insert(struct maps *maps, struct map *map);
|
||||
static void __maps__insert_name(struct maps *maps, struct map *map);
|
||||
|
@ -421,6 +422,54 @@ int map__fprintf_srcline(struct map *map, u64 addr, const char *prefix,
|
|||
return ret;
|
||||
}
|
||||
|
||||
int map__fprintf_srccode(struct map *map, u64 addr,
|
||||
FILE *fp,
|
||||
struct srccode_state *state)
|
||||
{
|
||||
char *srcfile;
|
||||
int ret = 0;
|
||||
unsigned line;
|
||||
int len;
|
||||
char *srccode;
|
||||
|
||||
if (!map || !map->dso)
|
||||
return 0;
|
||||
srcfile = get_srcline_split(map->dso,
|
||||
map__rip_2objdump(map, addr),
|
||||
&line);
|
||||
if (!srcfile)
|
||||
return 0;
|
||||
|
||||
/* Avoid redundant printing */
|
||||
if (state &&
|
||||
state->srcfile &&
|
||||
!strcmp(state->srcfile, srcfile) &&
|
||||
state->line == line) {
|
||||
free(srcfile);
|
||||
return 0;
|
||||
}
|
||||
|
||||
srccode = find_sourceline(srcfile, line, &len);
|
||||
if (!srccode)
|
||||
goto out_free_line;
|
||||
|
||||
ret = fprintf(fp, "|%-8d %.*s", line, len, srccode);
|
||||
state->srcfile = srcfile;
|
||||
state->line = line;
|
||||
return ret;
|
||||
|
||||
out_free_line:
|
||||
free(srcfile);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void srccode_state_free(struct srccode_state *state)
|
||||
{
|
||||
zfree(&state->srcfile);
|
||||
state->line = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* map__rip_2objdump - convert symbol start address to objdump address.
|
||||
* @map: memory map
|
||||
|
@ -873,19 +922,18 @@ void maps__remove(struct maps *maps, struct map *map)
|
|||
|
||||
struct map *maps__find(struct maps *maps, u64 ip)
|
||||
{
|
||||
struct rb_node **p, *parent = NULL;
|
||||
struct rb_node *p;
|
||||
struct map *m;
|
||||
|
||||
down_read(&maps->lock);
|
||||
|
||||
p = &maps->entries.rb_node;
|
||||
while (*p != NULL) {
|
||||
parent = *p;
|
||||
m = rb_entry(parent, struct map, rb_node);
|
||||
p = maps->entries.rb_node;
|
||||
while (p != NULL) {
|
||||
m = rb_entry(p, struct map, rb_node);
|
||||
if (ip < m->start)
|
||||
p = &(*p)->rb_left;
|
||||
p = p->rb_left;
|
||||
else if (ip >= m->end)
|
||||
p = &(*p)->rb_right;
|
||||
p = p->rb_right;
|
||||
else
|
||||
goto out;
|
||||
}
|
||||
|
|
|
@ -174,6 +174,22 @@ char *map__srcline(struct map *map, u64 addr, struct symbol *sym);
|
|||
int map__fprintf_srcline(struct map *map, u64 addr, const char *prefix,
|
||||
FILE *fp);
|
||||
|
||||
struct srccode_state {
|
||||
char *srcfile;
|
||||
unsigned line;
|
||||
};
|
||||
|
||||
static inline void srccode_state_init(struct srccode_state *state)
|
||||
{
|
||||
state->srcfile = NULL;
|
||||
state->line = 0;
|
||||
}
|
||||
|
||||
void srccode_state_free(struct srccode_state *state);
|
||||
|
||||
int map__fprintf_srccode(struct map *map, u64 addr,
|
||||
FILE *fp, struct srccode_state *state);
|
||||
|
||||
int map__load(struct map *map);
|
||||
struct symbol *map__find_symbol(struct map *map, u64 addr);
|
||||
struct symbol *map__find_symbol_by_name(struct map *map, const char *name);
|
||||
|
|
|
@ -153,8 +153,158 @@ void __weak auxtrace_mmap_params__set_idx(struct auxtrace_mmap_params *mp __mayb
|
|||
{
|
||||
}
|
||||
|
||||
#ifdef HAVE_AIO_SUPPORT
|
||||
static int perf_mmap__aio_mmap(struct perf_mmap *map, struct mmap_params *mp)
|
||||
{
|
||||
int delta_max, i, prio;
|
||||
|
||||
map->aio.nr_cblocks = mp->nr_cblocks;
|
||||
if (map->aio.nr_cblocks) {
|
||||
map->aio.aiocb = calloc(map->aio.nr_cblocks, sizeof(struct aiocb *));
|
||||
if (!map->aio.aiocb) {
|
||||
pr_debug2("failed to allocate aiocb for data buffer, error %m\n");
|
||||
return -1;
|
||||
}
|
||||
map->aio.cblocks = calloc(map->aio.nr_cblocks, sizeof(struct aiocb));
|
||||
if (!map->aio.cblocks) {
|
||||
pr_debug2("failed to allocate cblocks for data buffer, error %m\n");
|
||||
return -1;
|
||||
}
|
||||
map->aio.data = calloc(map->aio.nr_cblocks, sizeof(void *));
|
||||
if (!map->aio.data) {
|
||||
pr_debug2("failed to allocate data buffer, error %m\n");
|
||||
return -1;
|
||||
}
|
||||
delta_max = sysconf(_SC_AIO_PRIO_DELTA_MAX);
|
||||
for (i = 0; i < map->aio.nr_cblocks; ++i) {
|
||||
map->aio.data[i] = malloc(perf_mmap__mmap_len(map));
|
||||
if (!map->aio.data[i]) {
|
||||
pr_debug2("failed to allocate data buffer area, error %m");
|
||||
return -1;
|
||||
}
|
||||
/*
|
||||
* Use cblock.aio_fildes value different from -1
|
||||
* to denote started aio write operation on the
|
||||
* cblock so it requires explicit record__aio_sync()
|
||||
* call prior the cblock may be reused again.
|
||||
*/
|
||||
map->aio.cblocks[i].aio_fildes = -1;
|
||||
/*
|
||||
* Allocate cblocks with priority delta to have
|
||||
* faster aio write system calls because queued requests
|
||||
* are kept in separate per-prio queues and adding
|
||||
* a new request will iterate thru shorter per-prio
|
||||
* list. Blocks with numbers higher than
|
||||
* _SC_AIO_PRIO_DELTA_MAX go with priority 0.
|
||||
*/
|
||||
prio = delta_max - i;
|
||||
map->aio.cblocks[i].aio_reqprio = prio >= 0 ? prio : 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void perf_mmap__aio_munmap(struct perf_mmap *map)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < map->aio.nr_cblocks; ++i)
|
||||
zfree(&map->aio.data[i]);
|
||||
if (map->aio.data)
|
||||
zfree(&map->aio.data);
|
||||
zfree(&map->aio.cblocks);
|
||||
zfree(&map->aio.aiocb);
|
||||
}
|
||||
|
||||
int perf_mmap__aio_push(struct perf_mmap *md, void *to, int idx,
|
||||
int push(void *to, struct aiocb *cblock, void *buf, size_t size, off_t off),
|
||||
off_t *off)
|
||||
{
|
||||
u64 head = perf_mmap__read_head(md);
|
||||
unsigned char *data = md->base + page_size;
|
||||
unsigned long size, size0 = 0;
|
||||
void *buf;
|
||||
int rc = 0;
|
||||
|
||||
rc = perf_mmap__read_init(md);
|
||||
if (rc < 0)
|
||||
return (rc == -EAGAIN) ? 0 : -1;
|
||||
|
||||
/*
|
||||
* md->base data is copied into md->data[idx] buffer to
|
||||
* release space in the kernel buffer as fast as possible,
|
||||
* thru perf_mmap__consume() below.
|
||||
*
|
||||
* That lets the kernel to proceed with storing more
|
||||
* profiling data into the kernel buffer earlier than other
|
||||
* per-cpu kernel buffers are handled.
|
||||
*
|
||||
* Coping can be done in two steps in case the chunk of
|
||||
* profiling data crosses the upper bound of the kernel buffer.
|
||||
* In this case we first move part of data from md->start
|
||||
* till the upper bound and then the reminder from the
|
||||
* beginning of the kernel buffer till the end of
|
||||
* the data chunk.
|
||||
*/
|
||||
|
||||
size = md->end - md->start;
|
||||
|
||||
if ((md->start & md->mask) + size != (md->end & md->mask)) {
|
||||
buf = &data[md->start & md->mask];
|
||||
size = md->mask + 1 - (md->start & md->mask);
|
||||
md->start += size;
|
||||
memcpy(md->aio.data[idx], buf, size);
|
||||
size0 = size;
|
||||
}
|
||||
|
||||
buf = &data[md->start & md->mask];
|
||||
size = md->end - md->start;
|
||||
md->start += size;
|
||||
memcpy(md->aio.data[idx] + size0, buf, size);
|
||||
|
||||
/*
|
||||
* Increment md->refcount to guard md->data[idx] buffer
|
||||
* from premature deallocation because md object can be
|
||||
* released earlier than aio write request started
|
||||
* on mmap->data[idx] is complete.
|
||||
*
|
||||
* perf_mmap__put() is done at record__aio_complete()
|
||||
* after started request completion.
|
||||
*/
|
||||
perf_mmap__get(md);
|
||||
|
||||
md->prev = head;
|
||||
perf_mmap__consume(md);
|
||||
|
||||
rc = push(to, &md->aio.cblocks[idx], md->aio.data[idx], size0 + size, *off);
|
||||
if (!rc) {
|
||||
*off += size0 + size;
|
||||
} else {
|
||||
/*
|
||||
* Decrement md->refcount back if aio write
|
||||
* operation failed to start.
|
||||
*/
|
||||
perf_mmap__put(md);
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
#else
|
||||
static int perf_mmap__aio_mmap(struct perf_mmap *map __maybe_unused,
|
||||
struct mmap_params *mp __maybe_unused)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void perf_mmap__aio_munmap(struct perf_mmap *map __maybe_unused)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
void perf_mmap__munmap(struct perf_mmap *map)
|
||||
{
|
||||
perf_mmap__aio_munmap(map);
|
||||
if (map->base != NULL) {
|
||||
munmap(map->base, perf_mmap__mmap_len(map));
|
||||
map->base = NULL;
|
||||
|
@ -197,7 +347,7 @@ int perf_mmap__mmap(struct perf_mmap *map, struct mmap_params *mp, int fd, int c
|
|||
&mp->auxtrace_mp, map->base, fd))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
return perf_mmap__aio_mmap(map, mp);
|
||||
}
|
||||
|
||||
static int overwrite_rb_find_range(void *buf, int mask, u64 *start, u64 *end)
|
||||
|
|
|
@ -6,9 +6,13 @@
|
|||
#include <linux/types.h>
|
||||
#include <linux/ring_buffer.h>
|
||||
#include <stdbool.h>
|
||||
#ifdef HAVE_AIO_SUPPORT
|
||||
#include <aio.h>
|
||||
#endif
|
||||
#include "auxtrace.h"
|
||||
#include "event.h"
|
||||
|
||||
struct aiocb;
|
||||
/**
|
||||
* struct perf_mmap - perf's ring buffer mmap details
|
||||
*
|
||||
|
@ -26,6 +30,14 @@ struct perf_mmap {
|
|||
bool overwrite;
|
||||
struct auxtrace_mmap auxtrace_mmap;
|
||||
char event_copy[PERF_SAMPLE_MAX_SIZE] __aligned(8);
|
||||
#ifdef HAVE_AIO_SUPPORT
|
||||
struct {
|
||||
void **data;
|
||||
struct aiocb *cblocks;
|
||||
struct aiocb **aiocb;
|
||||
int nr_cblocks;
|
||||
} aio;
|
||||
#endif
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -57,7 +69,7 @@ enum bkw_mmap_state {
|
|||
};
|
||||
|
||||
struct mmap_params {
|
||||
int prot, mask;
|
||||
int prot, mask, nr_cblocks;
|
||||
struct auxtrace_mmap_params auxtrace_mp;
|
||||
};
|
||||
|
||||
|
@ -85,6 +97,18 @@ union perf_event *perf_mmap__read_event(struct perf_mmap *map);
|
|||
|
||||
int perf_mmap__push(struct perf_mmap *md, void *to,
|
||||
int push(struct perf_mmap *map, void *to, void *buf, size_t size));
|
||||
#ifdef HAVE_AIO_SUPPORT
|
||||
int perf_mmap__aio_push(struct perf_mmap *md, void *to, int idx,
|
||||
int push(void *to, struct aiocb *cblock, void *buf, size_t size, off_t off),
|
||||
off_t *off);
|
||||
#else
|
||||
static inline int perf_mmap__aio_push(struct perf_mmap *md __maybe_unused, void *to __maybe_unused, int idx __maybe_unused,
|
||||
int push(void *to, struct aiocb *cblock, void *buf, size_t size, off_t off) __maybe_unused,
|
||||
off_t *off __maybe_unused)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
size_t perf_mmap__mmap_len(struct perf_mmap *map);
|
||||
|
||||
|
|
|
@ -219,13 +219,12 @@ int ordered_events__queue(struct ordered_events *oe, union perf_event *event,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int __ordered_events__flush(struct ordered_events *oe)
|
||||
static int do_flush(struct ordered_events *oe, bool show_progress)
|
||||
{
|
||||
struct list_head *head = &oe->events;
|
||||
struct ordered_event *tmp, *iter;
|
||||
u64 limit = oe->next_flush;
|
||||
u64 last_ts = oe->last ? oe->last->timestamp : 0ULL;
|
||||
bool show_progress = limit == ULLONG_MAX;
|
||||
struct ui_progress prog;
|
||||
int ret;
|
||||
|
||||
|
@ -263,7 +262,8 @@ static int __ordered_events__flush(struct ordered_events *oe)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int ordered_events__flush(struct ordered_events *oe, enum oe_flush how)
|
||||
static int __ordered_events__flush(struct ordered_events *oe, enum oe_flush how,
|
||||
u64 timestamp)
|
||||
{
|
||||
static const char * const str[] = {
|
||||
"NONE",
|
||||
|
@ -272,12 +272,16 @@ int ordered_events__flush(struct ordered_events *oe, enum oe_flush how)
|
|||
"HALF ",
|
||||
};
|
||||
int err;
|
||||
bool show_progress = false;
|
||||
|
||||
if (oe->nr_events == 0)
|
||||
return 0;
|
||||
|
||||
switch (how) {
|
||||
case OE_FLUSH__FINAL:
|
||||
show_progress = true;
|
||||
__fallthrough;
|
||||
case OE_FLUSH__TOP:
|
||||
oe->next_flush = ULLONG_MAX;
|
||||
break;
|
||||
|
||||
|
@ -298,6 +302,11 @@ int ordered_events__flush(struct ordered_events *oe, enum oe_flush how)
|
|||
break;
|
||||
}
|
||||
|
||||
case OE_FLUSH__TIME:
|
||||
oe->next_flush = timestamp;
|
||||
show_progress = false;
|
||||
break;
|
||||
|
||||
case OE_FLUSH__ROUND:
|
||||
case OE_FLUSH__NONE:
|
||||
default:
|
||||
|
@ -308,7 +317,7 @@ int ordered_events__flush(struct ordered_events *oe, enum oe_flush how)
|
|||
str[how], oe->nr_events);
|
||||
pr_oe_time(oe->max_timestamp, "max_timestamp\n");
|
||||
|
||||
err = __ordered_events__flush(oe);
|
||||
err = do_flush(oe, show_progress);
|
||||
|
||||
if (!err) {
|
||||
if (how == OE_FLUSH__ROUND)
|
||||
|
@ -324,7 +333,29 @@ int ordered_events__flush(struct ordered_events *oe, enum oe_flush how)
|
|||
return err;
|
||||
}
|
||||
|
||||
void ordered_events__init(struct ordered_events *oe, ordered_events__deliver_t deliver)
|
||||
int ordered_events__flush(struct ordered_events *oe, enum oe_flush how)
|
||||
{
|
||||
return __ordered_events__flush(oe, how, 0);
|
||||
}
|
||||
|
||||
int ordered_events__flush_time(struct ordered_events *oe, u64 timestamp)
|
||||
{
|
||||
return __ordered_events__flush(oe, OE_FLUSH__TIME, timestamp);
|
||||
}
|
||||
|
||||
u64 ordered_events__first_time(struct ordered_events *oe)
|
||||
{
|
||||
struct ordered_event *event;
|
||||
|
||||
if (list_empty(&oe->events))
|
||||
return 0;
|
||||
|
||||
event = list_first_entry(&oe->events, struct ordered_event, list);
|
||||
return event->timestamp;
|
||||
}
|
||||
|
||||
void ordered_events__init(struct ordered_events *oe, ordered_events__deliver_t deliver,
|
||||
void *data)
|
||||
{
|
||||
INIT_LIST_HEAD(&oe->events);
|
||||
INIT_LIST_HEAD(&oe->cache);
|
||||
|
@ -332,6 +363,7 @@ void ordered_events__init(struct ordered_events *oe, ordered_events__deliver_t d
|
|||
oe->max_alloc_size = (u64) -1;
|
||||
oe->cur_alloc_size = 0;
|
||||
oe->deliver = deliver;
|
||||
oe->data = data;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -375,5 +407,5 @@ void ordered_events__reinit(struct ordered_events *oe)
|
|||
|
||||
ordered_events__free(oe);
|
||||
memset(oe, '\0', sizeof(*oe));
|
||||
ordered_events__init(oe, old_deliver);
|
||||
ordered_events__init(oe, old_deliver, oe->data);
|
||||
}
|
||||
|
|
|
@ -18,6 +18,8 @@ enum oe_flush {
|
|||
OE_FLUSH__FINAL,
|
||||
OE_FLUSH__ROUND,
|
||||
OE_FLUSH__HALF,
|
||||
OE_FLUSH__TOP,
|
||||
OE_FLUSH__TIME,
|
||||
};
|
||||
|
||||
struct ordered_events;
|
||||
|
@ -47,15 +49,19 @@ struct ordered_events {
|
|||
enum oe_flush last_flush_type;
|
||||
u32 nr_unordered_events;
|
||||
bool copy_on_queue;
|
||||
void *data;
|
||||
};
|
||||
|
||||
int ordered_events__queue(struct ordered_events *oe, union perf_event *event,
|
||||
u64 timestamp, u64 file_offset);
|
||||
void ordered_events__delete(struct ordered_events *oe, struct ordered_event *event);
|
||||
int ordered_events__flush(struct ordered_events *oe, enum oe_flush how);
|
||||
void ordered_events__init(struct ordered_events *oe, ordered_events__deliver_t deliver);
|
||||
int ordered_events__flush_time(struct ordered_events *oe, u64 timestamp);
|
||||
void ordered_events__init(struct ordered_events *oe, ordered_events__deliver_t deliver,
|
||||
void *data);
|
||||
void ordered_events__free(struct ordered_events *oe);
|
||||
void ordered_events__reinit(struct ordered_events *oe);
|
||||
u64 ordered_events__first_time(struct ordered_events *oe);
|
||||
|
||||
static inline
|
||||
void ordered_events__set_alloc_size(struct ordered_events *oe, u64 size)
|
||||
|
|
|
@ -2462,7 +2462,7 @@ void print_symbol_events(const char *event_glob, unsigned type,
|
|||
if (!name_only && strlen(syms->alias))
|
||||
snprintf(name, MAX_NAME_LEN, "%s OR %s", syms->symbol, syms->alias);
|
||||
else
|
||||
strncpy(name, syms->symbol, MAX_NAME_LEN);
|
||||
strlcpy(name, syms->symbol, MAX_NAME_LEN);
|
||||
|
||||
evt_list[evt_i] = strdup(name);
|
||||
if (evt_list[evt_i] == NULL)
|
||||
|
|
|
@ -692,7 +692,7 @@ static int add_exec_to_probe_trace_events(struct probe_trace_event *tevs,
|
|||
return ret;
|
||||
|
||||
for (i = 0; i < ntevs && ret >= 0; i++) {
|
||||
/* point.address is the addres of point.symbol + point.offset */
|
||||
/* point.address is the address of point.symbol + point.offset */
|
||||
tevs[i].point.address -= stext;
|
||||
tevs[i].point.module = strdup(exec);
|
||||
if (!tevs[i].point.module) {
|
||||
|
@ -3062,7 +3062,7 @@ static int try_to_find_absolute_address(struct perf_probe_event *pev,
|
|||
/*
|
||||
* Give it a '0x' leading symbol name.
|
||||
* In __add_probe_trace_events, a NULL symbol is interpreted as
|
||||
* invalud.
|
||||
* invalid.
|
||||
*/
|
||||
if (asprintf(&tp->symbol, "0x%lx", tp->address) < 0)
|
||||
goto errout;
|
||||
|
|
|
@ -424,7 +424,7 @@ static int probe_cache__open(struct probe_cache *pcache, const char *target,
|
|||
|
||||
if (target && build_id_cache__cached(target)) {
|
||||
/* This is a cached buildid */
|
||||
strncpy(sbuildid, target, SBUILD_ID_SIZE);
|
||||
strlcpy(sbuildid, target, SBUILD_ID_SIZE);
|
||||
dir_name = build_id_cache__linkname(sbuildid, NULL, 0);
|
||||
goto found;
|
||||
}
|
||||
|
|
|
@ -386,7 +386,7 @@ get_tracepoint_field(struct pyrf_event *pevent, PyObject *attr_name)
|
|||
struct tep_format_field *field;
|
||||
|
||||
if (!evsel->tp_format) {
|
||||
struct tep_event_format *tp_format;
|
||||
struct tep_event *tp_format;
|
||||
|
||||
tp_format = trace_event__tp_format_id(evsel->attr.config);
|
||||
if (!tp_format)
|
||||
|
@ -1240,7 +1240,7 @@ static struct {
|
|||
static PyObject *pyrf__tracepoint(struct pyrf_evsel *pevsel,
|
||||
PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
struct tep_event_format *tp_format;
|
||||
struct tep_event *tp_format;
|
||||
static char *kwlist[] = { "sys", "name", NULL };
|
||||
char *sys = NULL;
|
||||
char *name = NULL;
|
||||
|
|
|
@ -189,7 +189,7 @@ static void define_flag_field(const char *ev_name,
|
|||
LEAVE;
|
||||
}
|
||||
|
||||
static void define_event_symbols(struct tep_event_format *event,
|
||||
static void define_event_symbols(struct tep_event *event,
|
||||
const char *ev_name,
|
||||
struct tep_print_arg *args)
|
||||
{
|
||||
|
@ -338,7 +338,7 @@ static void perl_process_tracepoint(struct perf_sample *sample,
|
|||
struct addr_location *al)
|
||||
{
|
||||
struct thread *thread = al->thread;
|
||||
struct tep_event_format *event = evsel->tp_format;
|
||||
struct tep_event *event = evsel->tp_format;
|
||||
struct tep_format_field *field;
|
||||
static char handler[256];
|
||||
unsigned long long val;
|
||||
|
@ -537,7 +537,7 @@ static int perl_stop_script(void)
|
|||
|
||||
static int perl_generate_script(struct tep_handle *pevent, const char *outfile)
|
||||
{
|
||||
struct tep_event_format *event = NULL;
|
||||
struct tep_event *event = NULL;
|
||||
struct tep_format_field *f;
|
||||
char fname[PATH_MAX];
|
||||
int not_first, count;
|
||||
|
|
|
@ -264,7 +264,7 @@ static void define_field(enum tep_print_arg_type field_type,
|
|||
Py_DECREF(t);
|
||||
}
|
||||
|
||||
static void define_event_symbols(struct tep_event_format *event,
|
||||
static void define_event_symbols(struct tep_event *event,
|
||||
const char *ev_name,
|
||||
struct tep_print_arg *args)
|
||||
{
|
||||
|
@ -332,7 +332,7 @@ static void define_event_symbols(struct tep_event_format *event,
|
|||
define_event_symbols(event, ev_name, args->next);
|
||||
}
|
||||
|
||||
static PyObject *get_field_numeric_entry(struct tep_event_format *event,
|
||||
static PyObject *get_field_numeric_entry(struct tep_event *event,
|
||||
struct tep_format_field *field, void *data)
|
||||
{
|
||||
bool is_array = field->flags & TEP_FIELD_IS_ARRAY;
|
||||
|
@ -494,14 +494,14 @@ static PyObject *python_process_brstack(struct perf_sample *sample,
|
|||
pydict_set_item_string_decref(pyelem, "cycles",
|
||||
PyLong_FromUnsignedLongLong(br->entries[i].flags.cycles));
|
||||
|
||||
thread__find_map(thread, sample->cpumode,
|
||||
br->entries[i].from, &al);
|
||||
thread__find_map_fb(thread, sample->cpumode,
|
||||
br->entries[i].from, &al);
|
||||
dsoname = get_dsoname(al.map);
|
||||
pydict_set_item_string_decref(pyelem, "from_dsoname",
|
||||
_PyUnicode_FromString(dsoname));
|
||||
|
||||
thread__find_map(thread, sample->cpumode,
|
||||
br->entries[i].to, &al);
|
||||
thread__find_map_fb(thread, sample->cpumode,
|
||||
br->entries[i].to, &al);
|
||||
dsoname = get_dsoname(al.map);
|
||||
pydict_set_item_string_decref(pyelem, "to_dsoname",
|
||||
_PyUnicode_FromString(dsoname));
|
||||
|
@ -576,14 +576,14 @@ static PyObject *python_process_brstacksym(struct perf_sample *sample,
|
|||
if (!pyelem)
|
||||
Py_FatalError("couldn't create Python dictionary");
|
||||
|
||||
thread__find_symbol(thread, sample->cpumode,
|
||||
br->entries[i].from, &al);
|
||||
thread__find_symbol_fb(thread, sample->cpumode,
|
||||
br->entries[i].from, &al);
|
||||
get_symoff(al.sym, &al, true, bf, sizeof(bf));
|
||||
pydict_set_item_string_decref(pyelem, "from",
|
||||
_PyUnicode_FromString(bf));
|
||||
|
||||
thread__find_symbol(thread, sample->cpumode,
|
||||
br->entries[i].to, &al);
|
||||
thread__find_symbol_fb(thread, sample->cpumode,
|
||||
br->entries[i].to, &al);
|
||||
get_symoff(al.sym, &al, true, bf, sizeof(bf));
|
||||
pydict_set_item_string_decref(pyelem, "to",
|
||||
_PyUnicode_FromString(bf));
|
||||
|
@ -790,7 +790,7 @@ static void python_process_tracepoint(struct perf_sample *sample,
|
|||
struct perf_evsel *evsel,
|
||||
struct addr_location *al)
|
||||
{
|
||||
struct tep_event_format *event = evsel->tp_format;
|
||||
struct tep_event *event = evsel->tp_format;
|
||||
PyObject *handler, *context, *t, *obj = NULL, *callchain;
|
||||
PyObject *dict = NULL, *all_entries_dict = NULL;
|
||||
static char handler_name[256];
|
||||
|
@ -1590,7 +1590,7 @@ static int python_stop_script(void)
|
|||
|
||||
static int python_generate_script(struct tep_handle *pevent, const char *outfile)
|
||||
{
|
||||
struct tep_event_format *event = NULL;
|
||||
struct tep_event *event = NULL;
|
||||
struct tep_format_field *f;
|
||||
char fname[PATH_MAX];
|
||||
int not_first, count;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue