perf updates
Subsystems (2)
Linus,
Please pull the latest perf-core-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-core-for-linus
HEAD: ab0cce560ef177bdc7a8f73e9962be9d829a7b2c Revert "sched, perf: Use a single callback into the scheduler"
These are late tools/perf/ changes that missed the first round:
- endianness fixes
- event parsing improvements
- libtraceevent fixes factored out from trace-cmd
- perl scripting engine fixes related to libtraceevent,
- testcase improvements
- perf inject / pipe mode fixes
- plus a kernel side fix
Thanks,
Ingo
------------------>
Anshuman Khandual (1):
perf record: Fix documentation for branch stack sampling
Arnaldo Carvalho de Melo (2):
perf tools: Bump default sample freq to 4 kHz perf evlist: Show event attribute details
Frederic Weisbecker (2):
perf script: Explicitly handle known default print arg type perf script: Rename struct event to struct event_format in perl engine
Jiri Olsa (8):
perf test: Move parse event automated tests to separated object perf tools: Add support for displaying event parser debug info perf tools: Use allocated list for each parsed event
perf tools: Separate 'mem:' event scanner bits
perf tools: Add hardcoded name term for pmu events
perf tools: Carry perf_event_attr bitfield throught different endians perf tools: Add union u64_swap type for swapping u64 data Revert "sched, perf: Use a single callback into the scheduler"
Namhyung Kim (3):
perf tools: Rename libparsevent to libtraceevent in Makefile perf tools: Always try to build libtraceevent perf target: Add cpu flag to sample_type if target has cpu
Stephane Eranian (4):
perf tools: rename HEADER_TRACE_INFO to HEADER_TRACING_DATA perf inject: Fix broken perf inject -b
perf tools: Fix piped mode read code
perf buildid-list: Work better with pipe mode
include/linux/perf_event.h | 24 +- kernel/events/core.c | 14 +- kernel/sched/core.c | 9 +- tools/perf/Documentation/perf-evlist.txt | 8 + tools/perf/Documentation/perf-record.txt | 2 +- tools/perf/Makefile | 37 +- tools/perf/builtin-buildid-list.c | 6 +- tools/perf/builtin-evlist.c | 103 +++- tools/perf/builtin-inject.c | 5 + tools/perf/builtin-record.c | 6 +- tools/perf/builtin-test.c | 552 +----------------- tools/perf/builtin-top.c | 5 +- tools/perf/util/build-id.c | 2 + tools/perf/util/evsel.c | 12 +- tools/perf/util/header.c | 10 +- tools/perf/util/header.h | 2 +- tools/perf/util/parse-events-test.c | 625 +++++++++++++++++++++ tools/perf/util/parse-events.c | 69 ++- tools/perf/util/parse-events.h | 20 +- tools/perf/util/parse-events.l | 26 +- tools/perf/util/parse-events.y | 77 ++- tools/perf/util/pmu.c | 4 +- .../perf/util/scripting-engines/trace-event-perl.c | 16 +- tools/perf/util/session.c | 68 ++- tools/perf/util/types.h | 5 + 25 files changed, 1032 insertions(+), 675 deletions(-) create mode 100644 tools/perf/util/parse-events-test.c
include/linux/perf_event.h +18 -6
@@ -1084,8 +1084,10 @@ extern void perf_pmu_unregister(struct pmu *pmu);extern int perf_num_counters (void );extern const char *perf_pmu_name (void ); -extern void __perf_event_task_sched (struct task_struct *prev, -struct task_struct *next); +extern void __perf_event_task_sched_in (struct task_struct *prev, +struct task_struct *task); +extern void __perf_event_task_sched_out (struct task_struct *prev, +struct task_struct *next);extern int perf_event_init_task (struct task_struct *child);extern void perf_event_exit_task (struct task_struct *child);extern void perf_event_free_task (struct task_struct *task);
@@ -1205,13 +1207,20 @@ perf_sw_event(u32 event_id, u64 nr, struct pt_regs *regs, u64 addr)extern struct static_key_deferred perf_sched_events; -static inline void perf_event_task_sched (struct task_struct *prev, +static inline void perf_event_task_sched_in (struct task_struct *prev,struct task_struct *task) { +if (static_key_false (&perf_sched_events.key)) +__perf_event_task_sched_in (prev, task); +} + +static inline void perf_event_task_sched_out (struct task_struct *prev, +struct task_struct *next) +{perf_sw_event (PERF_COUNT_SW_CONTEXT_SWITCHES ,1 ,NULL ,0 );if (static_key_false (&perf_sched_events.key)) -__perf_event_task_sched (prev, task); +__perf_event_task_sched_out (prev, next); }extern void perf_event_mmap (struct vm_area_struct *vma);
@@ -1286,8 +1295,11 @@ extern void perf_event_disable(struct perf_event *event);extern void perf_event_task_tick (void );#else static inline void -perf_event_task_sched (struct task_struct *prev, -struct task_struct *task) { } +perf_event_task_sched_in (struct task_struct *prev, +struct task_struct *task) { } +static inline void +perf_event_task_sched_out (struct task_struct *prev, +struct task_struct *next) { }static inline int perf_event_init_task (struct task_struct *child) {return 0 ; }static inline void perf_event_exit_task (struct task_struct *child) { }static inline void perf_event_free_task (struct task_struct *task) { }
kernel/events/core.c +4 -10
@@ -2039,8 +2039,8 @@ static void perf_event_context_sched_out(struct task_struct *task, int ctxn,* accessing the event control register. If a NMI hits, then it will * not restart the event. */ -static void __perf_event_task_sched_out (struct task_struct *task, -struct task_struct *next) +void __perf_event_task_sched_out (struct task_struct *task, +struct task_struct *next) {int ctxn;
@@ -2279,8 +2279,8 @@ static void perf_branch_stack_sched_in(struct task_struct *prev,* accessing the event control register. If a NMI hits, then it will * keep the event running. */ -static void __perf_event_task_sched_in (struct task_struct *prev, -struct task_struct *task) +void __perf_event_task_sched_in (struct task_struct *prev, +struct task_struct *task) {struct perf_event_context *ctx;int ctxn;
@@ -2305,12 +2305,6 @@ static void __perf_event_task_sched_in(struct task_struct *prev,perf_branch_stack_sched_in (prev, task); } -void __perf_event_task_sched (struct task_struct *prev,struct task_struct *next) -{ -__perf_event_task_sched_out (prev, next); -__perf_event_task_sched_in (prev, next); -} -static u64 perf_calculate_period (struct perf_event *event,u64 nsec,u64 count) {u64 frequency = event->attr.sample_freq;
kernel/sched/core.c +8 -1
@@ -1913,7 +1913,7 @@ prepare_task_switch(struct rq *rq, struct task_struct *prev, struct task_struct *next) {sched_info_switch (prev, next); -perf_event_task_sched (prev, next); +perf_event_task_sched_out (prev, next);fire_sched_out_preempt_notifiers (prev, next);prepare_lock_switch (rq, next);prepare_arch_switch (next);
@@ -1956,6 +1956,13 @@ static void finish_task_switch(struct rq *rq, struct task_struct *prev)*/ prev_state = prev->state;finish_arch_switch (prev); +#ifdef __ARCH_WANT_INTERRUPTS_ON_CTXSW +local_irq_disable (); +#endif /* __ARCH_WANT_INTERRUPTS_ON_CTXSW */ +perf_event_task_sched_in (prev, current); +#ifdef __ARCH_WANT_INTERRUPTS_ON_CTXSW +local_irq_enable (); +#endif /* __ARCH_WANT_INTERRUPTS_ON_CTXSW */ finish_lock_switch (rq, prev);finish_arch_post_lock_switch ();
tools/perf/Documentation/perf-evlist.txt +8 -0
@@ -20,6 +20,14 @@ OPTIONS --input=:: Input file name. (default: perf.data unless stdin is a fifo) +-F:: +--freq=:: + Show just the sample frequency used for each event. + +-v:: +--verbose=:: + Show all fields. + SEE ALSO -------- linkperf:perf-record[1], linkperf:perf-list[1],
tools/perf/Documentation/perf-record.txt +1 -1
@@ -168,7 +168,7 @@ following filters are defined: - any: any type of branches - any_call: any function call or system call - any_ret: any function return or system call return - - any_ind: any indirect branch + - ind_call: any indirect branch - u: only when the branch target is at the user level - k: only when the branch target is in the kernel - hv: only when the target is at the hypervisor level
tools/perf/Makefile +22 -15
@@ -83,7 +83,13 @@ ifndef PERF_DEBUG CFLAGS_OPTIMIZE = -O6 endif -CFLAGS = -fno-omit-frame-pointer -ggdb3 -Wall -Wextra -std=gnu99 $(CFLAGS_WERROR) $(CFLAGS_OPTIMIZE) -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) +ifdef PARSER_DEBUG + PARSER_DEBUG_BISON := -t + PARSER_DEBUG_FLEX := -d + PARSER_DEBUG_CFLAGS := -DPARSER_DEBUG +endif + +CFLAGS = -fno-omit-frame-pointer -ggdb3 -Wall -Wextra -std=gnu99 $(CFLAGS_WERROR) $(CFLAGS_OPTIMIZE) -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) $(PARSER_DEBUG_CFLAGS) EXTLIBS = -lpthread -lrt -lelf -lm ALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE ALL_LDFLAGS = $(LDFLAGS)
@@ -149,7 +155,7 @@ endif ### --- END CONFIGURATION SECTION --- -BASIC_CFLAGS = -Iutil/include -Iarch/$(ARCH)/include -I$(OUTPUT)/util -I$(EVENT_PARSE_DIR) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE +BASIC_CFLAGS = -Iutil/include -Iarch/$(ARCH)/include -I$(OUTPUT)/util -I$(TRACE_EVENT_DIR) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE BASIC_LDFLAGS = # Guard against environment variables
@@ -178,16 +184,16 @@ $(OUTPUT)python/perf.so: $(PYRF_OBJS) $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS) SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) -EVENT_PARSE_DIR = ../lib/traceevent/ +TRACE_EVENT_DIR = ../lib/traceevent/ ifeq ("$(origin O)", "command line") - EP_PATH=$(OUTPUT)/ + TE_PATH=$(OUTPUT)/ else - EP_PATH=$(EVENT_PARSE_DIR)/ + TE_PATH=$(TRACE_EVENT_DIR)/ endif -LIBPARSEVENT = $(EP_PATH)libtraceevent.a -EP_LIB := -L$(EP_PATH) -ltraceevent +LIBTRACEEVENT = $(TE_PATH)libtraceevent.a +TE_LIB := -L$(TE_PATH) -ltraceevent # # Single 'perf' binary right now:
@@ -216,10 +222,10 @@ FLEX = flex BISON= bison $(OUTPUT)util/parse-events-flex.c: util/parse-events.l - $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/parse-events-flex.h -t util/parse-events.l > $(OUTPUT)util/parse-events-flex.c + $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/parse-events-flex.h $(PARSER_DEBUG_FLEX) -t util/parse-events.l > $(OUTPUT)util/parse-events-flex.c $(OUTPUT)util/parse-events-bison.c: util/parse-events.y - $(QUIET_BISON)$(BISON) -v util/parse-events.y -d -o $(OUTPUT)util/parse-events-bison.c + $(QUIET_BISON)$(BISON) -v util/parse-events.y -d $(PARSER_DEBUG_BISON) -o $(OUTPUT)util/parse-events-bison.c $(OUTPUT)util/pmu-flex.c: util/pmu.l $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/pmu-flex.h -t util/pmu.l > $(OUTPUT)util/pmu-flex.c
@@ -311,7 +317,7 @@ LIB_H += util/cpumap.h LIB_H += util/top.h LIB_H += $(ARCH_INCLUDE) LIB_H += util/cgroup.h -LIB_H += $(EVENT_PARSE_DIR)event-parse.h +LIB_H += $(TRACE_EVENT_DIR)event-parse.h LIB_H += util/target.h LIB_OBJS += $(OUTPUT)util/abspath.o
@@ -332,6 +338,7 @@ LIB_OBJS += $(OUTPUT)util/help.o LIB_OBJS += $(OUTPUT)util/levenshtein.o LIB_OBJS += $(OUTPUT)util/parse-options.o LIB_OBJS += $(OUTPUT)util/parse-events.o +LIB_OBJS += $(OUTPUT)util/parse-events-test.o LIB_OBJS += $(OUTPUT)util/path.o LIB_OBJS += $(OUTPUT)util/rbtree.o LIB_OBJS += $(OUTPUT)util/bitmap.o
@@ -410,7 +417,7 @@ BUILTIN_OBJS += $(OUTPUT)builtin-kvm.o BUILTIN_OBJS += $(OUTPUT)builtin-test.o BUILTIN_OBJS += $(OUTPUT)builtin-inject.o -PERFLIBS = $(LIB_FILE) $(LIBPARSEVENT) +PERFLIBS = $(LIB_FILE) $(LIBTRACEEVENT) # Files needed for the python binding, perf.so # pyrf is just an internal name needed for all those wrappers.
@@ -819,9 +826,9 @@ $(sort $(dir $(DIRECTORY_DEPS))): $(LIB_FILE): $(LIB_OBJS) $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIB_OBJS) -# libparsevent.a -$(LIBPARSEVENT): - make -C $(EVENT_PARSE_DIR) $(COMMAND_O) libtraceevent.a +# libtraceevent.a +$(LIBTRACEEVENT): + $(QUIET_SUBDIR0)$(TRACE_EVENT_DIR) $(QUIET_SUBDIR1) $(COMMAND_O) libtraceevent.a help: @echo 'Perf make targets:'
@@ -969,6 +976,6 @@ clean: $(RM) $(OUTPUT)util/*-{bison,flex}* $(python-clean) -.PHONY: all install clean strip +.PHONY: all install clean strip $(LIBTRACEEVENT) .PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell .PHONY: .FORCE-PERF-VERSION-FILE TAGS tags cscope .FORCE-PERF-CFLAGS
tools/perf/builtin-buildid-list.c +5 -1
@@ -84,7 +84,11 @@ static int perf_session__list_build_ids(void)if (filename__fprintf_build_id (session->filename, stdout)) goto out; -if (with_hits) +/* +* in pipe-mode, the only way to get the buildids is to parse +* the record stream. Buildids are stored as RECORD_HEADER_BUILD_ID +*/ +if (with_hits || session->fd_pipe)perf_session__process_events (session, &build_id__mark_dso_hit_ops);perf_session__fprintf_dsos_buildid (session, stdout, with_hits);
tools/perf/builtin-evlist.c +92 -11
126 lines not on this page · raw message
tools/perf/builtin-inject.c +5 -0
@@ -60,6 +60,11 @@ static int perf_event__repipe_tracing_data_synth(union perf_event *event,static int perf_event__repipe_attr (union perf_event *event,struct perf_evlist **pevlist__used ) { +int ret; + ret =perf_event__process_attr (event, pevlist); +if (ret) +return ret; +return perf_event__repipe_synth (NULL , event,NULL ); }
tools/perf/builtin-record.c +3 -3
@@ -396,7 +396,7 @@ static void perf_record__mmap_read_all(struct perf_record *rec)perf_record__mmap_read (rec, &rec->evlist->mmap[i]); } -if (perf_header__has_feat (&rec->session->header,HEADER_TRACE_INFO )) +if (perf_header__has_feat (&rec->session->header,HEADER_TRACING_DATA ))write_output (rec, &finished_round_event,sizeof (finished_round_event)); }
@@ -478,7 +478,7 @@ static int __cmd_record(struct perf_record *rec, int argc, const char **argv)perf_header__clear_feat (&session->header,HEADER_BUILD_ID );if (!have_tracepoints (&evsel_list->entries)) -perf_header__clear_feat (&session->header,HEADER_TRACE_INFO ); +perf_header__clear_feat (&session->header,HEADER_TRACING_DATA );if (!rec->opts.branch_stack)perf_header__clear_feat (&session->header,HEADER_BRANCH_STACK );
@@ -753,7 +753,7 @@ static struct perf_record record = { .mmap_pages = UINT_MAX, .user_freq = UINT_MAX, .user_interval = ULLONG_MAX, - .freq = 1000, + .freq = 4000, .target = { .uses_mmap = true, },
tools/perf/builtin-test.c +1 -551
564 lines not on this page · raw message
tools/perf/builtin-top.c +4 -1
@@ -900,6 +900,9 @@ static void perf_top__start_counters(struct perf_top *top) attr->read_format |=PERF_FORMAT_ID ; } +if (perf_target__has_cpu (&top->target)) + attr->sample_type |=PERF_SAMPLE_CPU ; +if (symbol_conf.use_callchain) attr->sample_type |=PERF_SAMPLE_CALLCHAIN ;
@@ -1159,7 +1162,7 @@ int cmd_top(int argc, const char **argv, const char *prefix __used)struct perf_top top = { .count_filter =5 , .delay_secs =2 , - .freq =1000 ,/* 1 KHz */ + .freq =4000 ,/* 4 KHz */ .mmap_pages =128 , .sym_pcnt_filter =5 , .target = {
tools/perf/util/build-id.c +2 -0
@@ -65,6 +65,8 @@ struct perf_tool build_id__mark_dso_hit_ops = { .mmap = perf_event__process_mmap, .fork = perf_event__process_task, .exit = perf_event__exit_del_thread, + .attr = perf_event__process_attr, + .build_id = perf_event__process_build_id, };char *dso__build_id_filename (struct dso *self,char *bf,size_t size)
tools/perf/util/evsel.c +3 -9
@@ -108,7 +108,7 @@ void perf_evsel__config(struct perf_evsel *evsel, struct perf_record_opts *opts,if (opts->call_graph) attr->sample_type |=PERF_SAMPLE_CALLCHAIN ; -if (opts->target.system_wide) +if (perf_target__has_cpu (&opts->target)) attr->sample_type |=PERF_SAMPLE_CPU ;if (opts->period)
@@ -462,10 +462,7 @@ int perf_event__parse_sample(const union perf_event *event, u64 type,* used for cross-endian analysis. See git commit 65014ab3 * for why this goofiness is needed. */ -union { -u64 val64; -u32 val32[2 ]; - } u; +union u64_swap u;memset (data,0 ,sizeof (*data)); data->cpu = data->pid = data->tid =-1 ;
@@ -608,10 +605,7 @@ int perf_event__synthesize_sample(union perf_event *event, u64 type,* used for cross-endian analysis. See git commit 65014ab3 * for why this goofiness is needed. */ -union { -u64 val64; -u32 val32[2 ]; - } u; +union u64_swap u; array = event->sample.array;
tools/perf/util/header.c +5 -5
@@ -437,7 +437,7 @@ static bool perf_session__read_build_ids(struct perf_session *session, bool withreturn ret; } -static int write_trace_info (int fd,struct perf_header *h__used , +static int write_tracing_data (int fd,struct perf_header *h__used ,struct perf_evlist *evlist) {return read_tracing_data (fd, &evlist->entries);
@@ -1472,7 +1472,7 @@ out:return err; } -static int process_trace_info(struct perf_file_section *section __unused, +static int process_tracing_data(struct perf_file_section *section __unused, struct perf_header *ph __unused, int feat __unused, int fd) {
@@ -1508,11 +1508,11 @@ struct feature_ops { .full_only = true }/* feature_ops not implemented: */ -#define print_trace_info NULL -#define print_build_id NULL +#define print_tracing_data NULL +#define print_build_id NULLstatic const struct feature_ops feat_ops[HEADER_LAST_FEATURE ] = { -FEAT_OPP (HEADER_TRACE_INFO , trace_info), +FEAT_OPP (HEADER_TRACING_DATA , tracing_data),FEAT_OPP (HEADER_BUILD_ID , build_id),FEAT_OPA (HEADER_HOSTNAME , hostname),FEAT_OPA (HEADER_OSRELEASE , osrelease),
tools/perf/util/header.h +1 -1
@@ -12,7 +12,7 @@enum {HEADER_RESERVED =0 ,/* always cleared */ HEADER_FIRST_FEATURE =1 , -HEADER_TRACE_INFO =1 , +HEADER_TRACING_DATA =1 ,HEADER_BUILD_ID ,HEADER_HOSTNAME ,
tools/perf/util/parse-events-test.c new file +625 -0
625 lines not on this page · raw message
tools/perf/util/parse-events.c +53 -16
160 lines not on this page · raw message
tools/perf/util/parse-events.h +10 -10
@@ -4,7 +4,9 @@* Parse symbolic events/counts passed in as options: */ +#include <linux/list.h> #include <stdbool.h> +#include "types.h" #include "../../../include/linux/perf_event.h" #include "types.h"
@@ -45,6 +47,7 @@ enum {PARSE_EVENTS__TERM_TYPE_CONFIG ,PARSE_EVENTS__TERM_TYPE_CONFIG1 ,PARSE_EVENTS__TERM_TYPE_CONFIG2 , +PARSE_EVENTS__TERM_TYPE_NAME ,PARSE_EVENTS__TERM_TYPE_SAMPLE_PERIOD , PARSE_EVENTS__TERM_TYPE_BRANCH_SAMPLE_TYPE, };
@@ -66,26 +69,23 @@ int parse_events__term_num(struct parse_events__term **_term,int parse_events__term_str (struct parse_events__term **_term,int type_term,char *config,char *str);void parse_events__free_terms (struct list_head *terms); -int parse_events_modifier (struct list_head *list__used ,char *str__used ); -int parse_events_add_tracepoint (struct list_head *list,int *idx, +int parse_events_modifier (struct list_head *list,char *str); +int parse_events_add_tracepoint (struct list_head **list,int *idx,char *sys,char *event); -int parse_events_add_raw (struct perf_evlist *evlist,unsigned long config, -unsigned long config1,unsigned long config2, -char *mod); -int parse_events_add_numeric (struct list_head *list,int *idx, +int parse_events_add_numeric (struct list_head **list,int *idx,unsigned long type,unsigned long config,struct list_head *head_config); -int parse_events_add_cache (struct list_head *list,int *idx, +int parse_events_add_cache (struct list_head **list,int *idx,char *type,char *op_result1,char *op_result2); -int parse_events_add_breakpoint (struct list_head *list,int *idx, +int parse_events_add_breakpoint (struct list_head **list,int *idx,void *ptr,char *type); -int parse_events_add_pmu (struct list_head *list,int *idx, +int parse_events_add_pmu (struct list_head **list,int *idx,char *pmu ,struct list_head *head_config);void parse_events_update_lists (struct list_head *list_event,struct list_head *list_all);void parse_events_error (struct list_head *list_all, -struct list_head *list_event,int *idx,char const *msg); +int parse_events__test (void );void print_events (const char *event_glob);void print_events_type (u8 type);
tools/perf/util/parse-events.l +24 -2
@@ -1,5 +1,6 @@ %option prefix="parse_events_" +%option stack %{ #include <errno.h>
@@ -50,6 +51,8 @@ static int term(int type) %} +%x mem + num_dec [0-9]+ num_hex 0x[a-fA-F0-9]+ num_raw_hex [a-fA-F0-9]+
@@ -102,16 +105,16 @@ misses|miss { return str(PE_NAME_CACHE_OP_RESULT); } config { return term(PARSE_EVENTS__TERM_TYPE_CONFIG); } config1 { return term(PARSE_EVENTS__TERM_TYPE_CONFIG1); } config2 { return term(PARSE_EVENTS__TERM_TYPE_CONFIG2); } +name { return term(PARSE_EVENTS__TERM_TYPE_NAME); } period { return term(PARSE_EVENTS__TERM_TYPE_SAMPLE_PERIOD); } branch_type { return term(PARSE_EVENTS__TERM_TYPE_BRANCH_SAMPLE_TYPE); } -mem: { return PE_PREFIX_MEM; } +mem: { BEGIN(mem); return PE_PREFIX_MEM; } r{num_raw_hex} { return raw(); } {num_dec} { return value(10); } {num_hex} { return value(16); } {modifier_event} { return str(PE_MODIFIER_EVENT); } -{modifier_bp} { return str(PE_MODIFIER_BP); } {name} { return str(PE_NAME); } "/" { return '/'; } - { return '-'; }
@@ -119,6 +122,25 @@ r{num_raw_hex} { return raw(); } : { return ':'; } = { return '='; } +<mem>{ +{modifier_bp} { return str(PE_MODIFIER_BP); } +: { return ':'; } +{num_dec} { return value(10); } +{num_hex} { return value(16); } + /* + * We need to separate 'mem:' scanner part, in order to get specific + * modifier bits parsed out. Otherwise we would need to handle PE_NAME + * and we'd need to parse it manually. During the escape from <mem> + * state we need to put the escaping char back, so we dont miss it. + */ +. { unput(*parse_events_text); BEGIN(INITIAL); } + /* + * We destroy the scanner after reaching EOF, + * but anyway just to be sure get back to INIT state. + */ +<<EOF>> { BEGIN(INITIAL); } +} + %% int parse_events_wrap(void)
tools/perf/util/parse-events.y +61 -16
171 lines not on this page · raw message
tools/perf/util/pmu.c +2 -2
@@ -258,9 +258,9 @@ static int pmu_config_term(struct list_head *formats,static int pmu_config (struct list_head *formats,struct perf_event_attr *attr,struct list_head *head_terms) { -struct parse_events__term *term, *h; +struct parse_events__term *term; -list_for_each_entry_safe (term, h, head_terms, list) +list_for_each_entry (term, head_terms, list)if (pmu_config_term (formats, attr, term))return -EINVAL ;
tools/perf/util/scripting-engines/trace-event-perl.c +10 -6
@@ -56,7 +56,7 @@ INTERP my_perl;#define FTRACE_MAX_EVENT \ ((1 << (sizeof(unsigned short) * 8)) - 1) -struct event *events[FTRACE_MAX_EVENT ]; +struct event_format *events[FTRACE_MAX_EVENT ];extern struct scripting_context *scripting_context;
@@ -181,7 +181,7 @@ static void define_flag_field(const char *ev_name,LEAVE ; } -static void define_event_symbols (struct event *event, +static void define_event_symbols (struct event_format *event,const char *ev_name,struct print_arg *args) {
@@ -209,6 +209,8 @@ static void define_event_symbols(struct event *event,define_symbolic_values (args->symbol.symbols, ev_name, cur_field_name);break ; +case PRINT_BSTRING : +case PRINT_DYNAMIC_ARRAY :case PRINT_STRING :break ;case PRINT_TYPE :
@@ -220,7 +222,9 @@ static void define_event_symbols(struct event *event,define_event_symbols (event, ev_name, args->op.left);define_event_symbols (event, ev_name, args->op.right);break ; +case PRINT_FUNC :default : +pr_err ("Unsupported print arg type\n" );/* we should warn... */ return ; }
@@ -229,10 +233,10 @@ static void define_event_symbols(struct event *event,define_event_symbols (event, ev_name, args->next); } -static inline struct event *find_cache_event (int type) +static inline struct event_format *find_cache_event (int type) {static char ev_name[256 ]; -struct event *event; +struct event_format *event;if (events[type])return events[type];
@@ -258,7 +262,7 @@ static void perl_process_tracepoint(union perf_event *pevent __unused,static char handler[256 ];unsigned long long val;unsigned long s, ns; -struct event *event; +struct event_format *event;int type;int pid;int cpu = sample->cpu;
@@ -446,7 +450,7 @@ static int perl_stop_script(void)static int perl_generate_script (const char *outfile) { -struct event *event =NULL ; +struct event_format *event =NULL ;struct format_field *f;char fname[PATH_MAX ];int not_first, count;
tools/perf/util/session.c +60 -8
116 lines not on this page · raw message
tools/perf/util/types.h +5 -0
@@ -16,4 +16,9 @@ typedef signed short s16;typedef unsigned char u8 ;typedef signed char s8 ; +union u64_swap { +u64 val64; +u32 val32[2 ]; +}; +#endif /* __PERF_TYPES_H */