perf/core improvements ad fixes:

kernel:
 
 . kallsyms, x86: Export addresses of PTI entry trampolines (Alexander Shishkin)
 
 . kallsyms: Simplify update_iter_mod() (Adrian Hunter)
 
 . x86: Add entry trampolines to kcore (Adrian Hunter)
 
 Hardware tracing:
 
 . Fix auxtrace queue resize (Adrian Hunter)
 
 Arch specific:
 
 . Fix uninitialized ARM SPE record error variable (Kim Phillips)
 
 . Fix trace event post-processing in powerpc (Sandipan Das)
 
 Build:
 
 . Fix check-headers.sh AND list path of execution (Alexander Kapshuk)
 
 . Remove -mcet and -fcf-protection when building the python binding
   with older clang versions (Arnaldo Carvalho de Melo)
 
 . Make check-headers.sh check based on kernel dir (Jiri Olsa)
 
 . Move syscall_64.tbl check into check-headers.sh (Jiri Olsa)
 
 Infrastructure:
 
 . Check for null when copying nsinfo.  (Benno Evers)
 
 Libraries:
 
 . Rename libtraceevent prefixes, prep work for making it a shared
   library generaly available (Tzvetomir Stoyanov (VMware))
 
 Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEELb9bqkb7Te0zijNb1lAW81NSqkAFAlt0OP8ACgkQ1lAW81NS
 qkD0lg/8Dcjd6bCgHzrRJYcR4VUNgHq4LnpJEp3VVvtV29AmptVW3hOCF6siuwDI
 H8rtMzE0gflMVHae310qTaUIzo1A6/ugoRwxUKLKU8aWkA1ikl9iJn6uaTttOCIG
 H4a/mExILDicGfxMk6kAPdyDbYr7r+1UoF58asrWVjPQNPxoJSALJCPtMnLK7Cn8
 qMZN68TqIL5zifbRe6UHKCH/SmDuowVmEIz4Nin3QtwKFPH+I02TtSdYkNWTC5WK
 o469/zy9cceA6a8Q+bVEUP0OD1mU8BvRnZogOiZ5SdMiYZlDkFSqG5MzgTtJUXQC
 DxOKkANdWu7zON/KywGDX8kcIBySzd5toTiXLvsHNNhxR8pT3bU57QvrscqLIMX+
 SVbCR03h5EwLeJopvDKZjwtcSwCWp1aCXCrmLP04tcB1zi+mUIRohbzf2vZDPfwo
 IRtoHvPAgV9UAA7M+UAAtNc7G0Gg/K2c6LlfiuxDhgjk9Jqg4NbOz3cn6rvXtGQX
 B4RM9pdhoNi9tqrXNYCnLzinzKtPhWjyEbb0FBlgvXTNQNiDVjhrkt3pC1fH1zK9
 GX1F6L78x24z3bZl5hUyYXmxOkktpAeprjICXAikYvwwige6aNENVLhCI/fVFHcx
 ByxXbFMom/dSIgU0tBfdqktd7ZmSLm94obSuA6BW8/htf2JIztM=
 =W1go
 -----END PGP SIGNATURE-----

Merge tag 'perf-core-for-mingo-4.19-20180815' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent

Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:

kernel:

- kallsyms, x86: Export addresses of PTI entry trampolines (Alexander Shishkin)

- kallsyms: Simplify update_iter_mod() (Adrian Hunter)

- x86: Add entry trampolines to kcore (Adrian Hunter)

Hardware tracing:

- Fix auxtrace queue resize (Adrian Hunter)

Arch specific:

- Fix uninitialized ARM SPE record error variable (Kim Phillips)

- Fix trace event post-processing in powerpc (Sandipan Das)

Build:

- Fix check-headers.sh AND list path of execution (Alexander Kapshuk)

- Remove -mcet and -fcf-protection when building the python binding
  with older clang versions (Arnaldo Carvalho de Melo)

- Make check-headers.sh check based on kernel dir (Jiri Olsa)

- Move syscall_64.tbl check into check-headers.sh (Jiri Olsa)

Infrastructure:

- Check for null when copying nsinfo.  (Benno Evers)

Libraries:

- Rename libtraceevent prefixes, prep work for making it a shared
  library generaly available (Tzvetomir Stoyanov (VMware))

Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
This commit is contained in:
Ingo Molnar 2018-08-18 13:11:51 +02:00
commit 5804b11034
72 changed files with 3003 additions and 1362 deletions

View file

@ -129,12 +129,12 @@ $(OUTPUT)liblockdep.a: $(LIB_IN)
tags: force
$(RM) tags
find . -name '*.[ch]' | xargs ctags --extra=+f --c-kinds=+px \
--regex-c++='/_PE\(([^,)]*).*/PEVENT_ERRNO__\1/'
--regex-c++='/_PE\(([^,)]*).*/TEP_ERRNO__\1/'
TAGS: force
$(RM) TAGS
find . -name '*.[ch]' | xargs etags \
--regex='/_PE(\([^,)]*\).*/PEVENT_ERRNO__\1/'
--regex='/_PE(\([^,)]*\).*/TEP_ERRNO__\1/'
define do_install
$(print_install) \

View file

@ -233,12 +233,12 @@ endef
tags: force
$(RM) tags
find . -name '*.[ch]' | xargs ctags --extra=+f --c-kinds=+px \
--regex-c++='/_PE\(([^,)]*).*/PEVENT_ERRNO__\1/'
--regex-c++='/_PE\(([^,)]*).*/TEP_ERRNO__\1/'
TAGS: force
$(RM) TAGS
find . -name '*.[ch]' | xargs etags \
--regex='/_PE(\([^,)]*\).*/PEVENT_ERRNO__\1/'
--regex='/_PE(\([^,)]*\).*/TEP_ERRNO__\1/'
define do_install_mkdir
if [ ! -d '$(DESTDIR_SQ)$1' ]; then \

File diff suppressed because it is too large Load diff

View file

@ -41,7 +41,7 @@
#define DEBUG_RECORD 0
#endif
struct pevent_record {
struct tep_record {
unsigned long long ts;
unsigned long long offset;
long long missed_events; /* buffer dropped events before */
@ -53,8 +53,8 @@ struct pevent_record {
int locked; /* Do not free, even if ref_count is zero */
void *priv;
#if DEBUG_RECORD
struct pevent_record *prev;
struct pevent_record *next;
struct tep_record *prev;
struct tep_record *next;
long alloc_addr;
#endif
};
@ -98,19 +98,19 @@ extern int trace_seq_do_printf(struct trace_seq *s);
/* ----------------------- pevent ----------------------- */
struct pevent;
struct tep_handle;
struct event_format;
typedef int (*pevent_event_handler_func)(struct trace_seq *s,
struct pevent_record *record,
struct event_format *event,
void *context);
typedef int (*tep_event_handler_func)(struct trace_seq *s,
struct tep_record *record,
struct event_format *event,
void *context);
typedef int (*pevent_plugin_load_func)(struct pevent *pevent);
typedef int (*pevent_plugin_unload_func)(struct pevent *pevent);
typedef int (*tep_plugin_load_func)(struct tep_handle *pevent);
typedef int (*tep_plugin_unload_func)(struct tep_handle *pevent);
struct pevent_plugin_option {
struct pevent_plugin_option *next;
struct tep_plugin_option {
struct tep_plugin_option *next;
void *handle;
char *file;
char *name;
@ -124,20 +124,20 @@ struct pevent_plugin_option {
/*
* Plugin hooks that can be called:
*
* PEVENT_PLUGIN_LOADER: (required)
* TEP_PLUGIN_LOADER: (required)
* The function name to initialized the plugin.
*
* int PEVENT_PLUGIN_LOADER(struct pevent *pevent)
* int TEP_PLUGIN_LOADER(struct tep_handle *pevent)
*
* PEVENT_PLUGIN_UNLOADER: (optional)
* TEP_PLUGIN_UNLOADER: (optional)
* The function called just before unloading
*
* int PEVENT_PLUGIN_UNLOADER(struct pevent *pevent)
* int TEP_PLUGIN_UNLOADER(struct tep_handle *pevent)
*
* PEVENT_PLUGIN_OPTIONS: (optional)
* TEP_PLUGIN_OPTIONS: (optional)
* Plugin options that can be set before loading
*
* struct pevent_plugin_option PEVENT_PLUGIN_OPTIONS[] = {
* struct tep_plugin_option TEP_PLUGIN_OPTIONS[] = {
* {
* .name = "option-name",
* .plugin_alias = "override-file-name", (optional)
@ -158,19 +158,19 @@ struct pevent_plugin_option {
* .set will be processed. If .value is defined, then it is considered
* a string option and .set will be ignored.
*
* PEVENT_PLUGIN_ALIAS: (optional)
* TEP_PLUGIN_ALIAS: (optional)
* The name to use for finding options (uses filename if not defined)
*/
#define PEVENT_PLUGIN_LOADER pevent_plugin_loader
#define PEVENT_PLUGIN_UNLOADER pevent_plugin_unloader
#define PEVENT_PLUGIN_OPTIONS pevent_plugin_options
#define PEVENT_PLUGIN_ALIAS pevent_plugin_alias
#define TEP_PLUGIN_LOADER tep_plugin_loader
#define TEP_PLUGIN_UNLOADER tep_plugin_unloader
#define TEP_PLUGIN_OPTIONS tep_plugin_options
#define TEP_PLUGIN_ALIAS tep_plugin_alias
#define _MAKE_STR(x) #x
#define MAKE_STR(x) _MAKE_STR(x)
#define PEVENT_PLUGIN_LOADER_NAME MAKE_STR(PEVENT_PLUGIN_LOADER)
#define PEVENT_PLUGIN_UNLOADER_NAME MAKE_STR(PEVENT_PLUGIN_UNLOADER)
#define PEVENT_PLUGIN_OPTIONS_NAME MAKE_STR(PEVENT_PLUGIN_OPTIONS)
#define PEVENT_PLUGIN_ALIAS_NAME MAKE_STR(PEVENT_PLUGIN_ALIAS)
#define TEP_PLUGIN_LOADER_NAME MAKE_STR(TEP_PLUGIN_LOADER)
#define TEP_PLUGIN_UNLOADER_NAME MAKE_STR(TEP_PLUGIN_UNLOADER)
#define TEP_PLUGIN_OPTIONS_NAME MAKE_STR(TEP_PLUGIN_OPTIONS)
#define TEP_PLUGIN_ALIAS_NAME MAKE_STR(TEP_PLUGIN_ALIAS)
enum format_flags {
FIELD_IS_ARRAY = 1,
@ -269,10 +269,10 @@ struct print_arg_op {
struct print_arg *right;
};
struct pevent_function_handler;
struct tep_function_handler;
struct print_arg_func {
struct pevent_function_handler *func;
struct tep_function_handler *func;
struct print_arg *args;
};
@ -320,14 +320,14 @@ struct print_fmt {
};
struct event_format {
struct pevent *pevent;
struct tep_handle *pevent;
char *name;
int id;
int flags;
struct format format;
struct print_fmt print_fmt;
char *system;
pevent_event_handler_func handler;
tep_event_handler_func handler;
void *context;
};
@ -361,25 +361,25 @@ enum event_type {
EVENT_SQUOTE,
};
typedef unsigned long long (*pevent_func_handler)(struct trace_seq *s,
unsigned long long *args);
typedef unsigned long long (*tep_func_handler)(struct trace_seq *s,
unsigned long long *args);
enum pevent_func_arg_type {
PEVENT_FUNC_ARG_VOID,
PEVENT_FUNC_ARG_INT,
PEVENT_FUNC_ARG_LONG,
PEVENT_FUNC_ARG_STRING,
PEVENT_FUNC_ARG_PTR,
PEVENT_FUNC_ARG_MAX_TYPES
enum tep_func_arg_type {
TEP_FUNC_ARG_VOID,
TEP_FUNC_ARG_INT,
TEP_FUNC_ARG_LONG,
TEP_FUNC_ARG_STRING,
TEP_FUNC_ARG_PTR,
TEP_FUNC_ARG_MAX_TYPES
};
enum pevent_flag {
PEVENT_NSEC_OUTPUT = 1, /* output in NSECS */
PEVENT_DISABLE_SYS_PLUGINS = 1 << 1,
PEVENT_DISABLE_PLUGINS = 1 << 2,
enum tep_flag {
TEP_NSEC_OUTPUT = 1, /* output in NSECS */
TEP_DISABLE_SYS_PLUGINS = 1 << 1,
TEP_DISABLE_PLUGINS = 1 << 2,
};
#define PEVENT_ERRORS \
#define TEP_ERRORS \
_PE(MEM_ALLOC_FAILED, "failed to allocate memory"), \
_PE(PARSE_EVENT_FAILED, "failed to parse event"), \
_PE(READ_ID_FAILED, "failed to read event id"), \
@ -411,10 +411,10 @@ enum pevent_flag {
_PE(FILTER_MISS, "record does not match to filter")
#undef _PE
#define _PE(__code, __str) PEVENT_ERRNO__ ## __code
enum pevent_errno {
PEVENT_ERRNO__SUCCESS = 0,
PEVENT_ERRNO__FILTER_MATCH = PEVENT_ERRNO__SUCCESS,
#define _PE(__code, __str) TEP_ERRNO__ ## __code
enum tep_errno {
TEP_ERRNO__SUCCESS = 0,
TEP_ERRNO__FILTER_MATCH = TEP_ERRNO__SUCCESS,
/*
* Choose an arbitrary negative big number not to clash with standard
@ -423,11 +423,11 @@ enum pevent_errno {
*
* http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html
*/
__PEVENT_ERRNO__START = -100000,
__TEP_ERRNO__START = -100000,
PEVENT_ERRORS,
TEP_ERRORS,
__PEVENT_ERRNO__END,
__TEP_ERRNO__END,
};
#undef _PE
@ -435,17 +435,17 @@ struct plugin_list;
#define INVALID_PLUGIN_LIST_OPTION ((char **)((unsigned long)-1))
struct plugin_list *traceevent_load_plugins(struct pevent *pevent);
void traceevent_unload_plugins(struct plugin_list *plugin_list,
struct pevent *pevent);
char **traceevent_plugin_list_options(void);
void traceevent_plugin_free_options_list(char **list);
int traceevent_plugin_add_options(const char *name,
struct pevent_plugin_option *options);
void traceevent_plugin_remove_options(struct pevent_plugin_option *options);
void traceevent_print_plugins(struct trace_seq *s,
const char *prefix, const char *suffix,
const struct plugin_list *list);
struct plugin_list *tep_load_plugins(struct tep_handle *pevent);
void tep_unload_plugins(struct plugin_list *plugin_list,
struct tep_handle *pevent);
char **tep_plugin_list_options(void);
void tep_plugin_free_options_list(char **list);
int tep_plugin_add_options(const char *name,
struct tep_plugin_option *options);
void tep_plugin_remove_options(struct tep_plugin_option *options);
void tep_print_plugins(struct trace_seq *s,
const char *prefix, const char *suffix,
const struct plugin_list *list);
struct cmdline;
struct cmdline_list;
@ -454,10 +454,10 @@ struct func_list;
struct event_handler;
struct func_resolver;
typedef char *(pevent_func_resolver_t)(void *priv,
unsigned long long *addrp, char **modp);
typedef char *(tep_func_resolver_t)(void *priv,
unsigned long long *addrp, char **modp);
struct pevent {
struct tep_handle {
int ref_count;
int header_page_ts_offset;
@ -524,7 +524,7 @@ struct pevent {
struct format_field *bprint_buf_field;
struct event_handler *handlers;
struct pevent_function_handler *func_handlers;
struct tep_function_handler *func_handlers;
/* cache */
struct event_format *last_event;
@ -532,13 +532,13 @@ struct pevent {
char *trace_clock;
};
static inline void pevent_set_flag(struct pevent *pevent, int flag)
static inline void tep_set_flag(struct tep_handle *pevent, int flag)
{
pevent->flags |= flag;
}
static inline unsigned short
__data2host2(struct pevent *pevent, unsigned short data)
__data2host2(struct tep_handle *pevent, unsigned short data)
{
unsigned short swap;
@ -552,7 +552,7 @@ __data2host2(struct pevent *pevent, unsigned short data)
}
static inline unsigned int
__data2host4(struct pevent *pevent, unsigned int data)
__data2host4(struct tep_handle *pevent, unsigned int data)
{
unsigned int swap;
@ -568,7 +568,7 @@ __data2host4(struct pevent *pevent, unsigned int data)
}
static inline unsigned long long
__data2host8(struct pevent *pevent, unsigned long long data)
__data2host8(struct tep_handle *pevent, unsigned long long data)
{
unsigned long long swap;
@ -597,7 +597,7 @@ __data2host8(struct pevent *pevent, unsigned long long data)
__data2host8(pevent, __val); \
})
static inline int traceevent_host_bigendian(void)
static inline int tep_host_bigendian(void)
{
unsigned char str[] = { 0x1, 0x2, 0x3, 0x4 };
unsigned int val;
@ -615,198 +615,198 @@ enum trace_flag_type {
TRACE_FLAG_SOFTIRQ = 0x10,
};
int pevent_set_function_resolver(struct pevent *pevent,
pevent_func_resolver_t *func, void *priv);
void pevent_reset_function_resolver(struct pevent *pevent);
int pevent_register_comm(struct pevent *pevent, const char *comm, int pid);
int pevent_register_trace_clock(struct pevent *pevent, const char *trace_clock);
int pevent_register_function(struct pevent *pevent, char *name,
unsigned long long addr, char *mod);
int pevent_register_print_string(struct pevent *pevent, const char *fmt,
unsigned long long addr);
int pevent_pid_is_registered(struct pevent *pevent, int pid);
int tep_set_function_resolver(struct tep_handle *pevent,
tep_func_resolver_t *func, void *priv);
void tep_reset_function_resolver(struct tep_handle *pevent);
int tep_register_comm(struct tep_handle *pevent, const char *comm, int pid);
int tep_register_trace_clock(struct tep_handle *pevent, const char *trace_clock);
int tep_register_function(struct tep_handle *pevent, char *name,
unsigned long long addr, char *mod);
int tep_register_print_string(struct tep_handle *pevent, const char *fmt,
unsigned long long addr);
int tep_pid_is_registered(struct tep_handle *pevent, int pid);
void pevent_print_event_task(struct pevent *pevent, struct trace_seq *s,
struct event_format *event,
struct pevent_record *record);
void pevent_print_event_time(struct pevent *pevent, struct trace_seq *s,
struct event_format *event,
struct pevent_record *record,
bool use_trace_clock);
void pevent_print_event_data(struct pevent *pevent, struct trace_seq *s,
struct event_format *event,
struct pevent_record *record);
void pevent_print_event(struct pevent *pevent, struct trace_seq *s,
struct pevent_record *record, bool use_trace_clock);
void tep_print_event_task(struct tep_handle *pevent, struct trace_seq *s,
struct event_format *event,
struct tep_record *record);
void tep_print_event_time(struct tep_handle *pevent, struct trace_seq *s,
struct event_format *event,
struct tep_record *record,
bool use_trace_clock);
void tep_print_event_data(struct tep_handle *pevent, struct trace_seq *s,
struct event_format *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);
int pevent_parse_header_page(struct pevent *pevent, char *buf, unsigned long size,
int long_size);
int tep_parse_header_page(struct tep_handle *pevent, char *buf, unsigned long size,
int long_size);
enum pevent_errno pevent_parse_event(struct pevent *pevent, const char *buf,
unsigned long size, const char *sys);
enum pevent_errno pevent_parse_format(struct pevent *pevent,
struct event_format **eventp,
const char *buf,
unsigned long size, const char *sys);
void pevent_free_format(struct event_format *event);
void pevent_free_format_field(struct format_field *field);
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 event_format **eventp,
const char *buf,
unsigned long size, const char *sys);
void tep_free_format(struct event_format *event);
void tep_free_format_field(struct format_field *field);
void *pevent_get_field_raw(struct trace_seq *s, struct event_format *event,
const char *name, struct pevent_record *record,
int *len, int err);
void *tep_get_field_raw(struct trace_seq *s, struct event_format *event,
const char *name, struct tep_record *record,
int *len, int err);
int pevent_get_field_val(struct trace_seq *s, struct event_format *event,
const char *name, struct pevent_record *record,
unsigned long long *val, int err);
int pevent_get_common_field_val(struct trace_seq *s, struct event_format *event,
const char *name, struct pevent_record *record,
unsigned long long *val, int err);
int pevent_get_any_field_val(struct trace_seq *s, struct event_format *event,
const char *name, struct pevent_record *record,
int tep_get_field_val(struct trace_seq *s, struct event_format *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 event_format *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 event_format *event,
const char *name, struct tep_record *record,
unsigned long long *val, int err);
int pevent_print_num_field(struct trace_seq *s, const char *fmt,
int tep_print_num_field(struct trace_seq *s, const char *fmt,
struct event_format *event, const char *name,
struct pevent_record *record, int err);
struct tep_record *record, int err);
int pevent_print_func_field(struct trace_seq *s, const char *fmt,
struct event_format *event, const char *name,
struct pevent_record *record, int err);
int tep_print_func_field(struct trace_seq *s, const char *fmt,
struct event_format *event, const char *name,
struct tep_record *record, int err);
int pevent_register_event_handler(struct pevent *pevent, int id,
const char *sys_name, const char *event_name,
pevent_event_handler_func func, void *context);
int pevent_unregister_event_handler(struct pevent *pevent, int id,
const char *sys_name, const char *event_name,
pevent_event_handler_func func, void *context);
int pevent_register_print_function(struct pevent *pevent,
pevent_func_handler func,
enum pevent_func_arg_type ret_type,
char *name, ...);
int pevent_unregister_print_function(struct pevent *pevent,
pevent_func_handler func, char *name);
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);
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);
int tep_register_print_function(struct tep_handle *pevent,
tep_func_handler func,
enum tep_func_arg_type ret_type,
char *name, ...);
int tep_unregister_print_function(struct tep_handle *pevent,
tep_func_handler func, char *name);
struct format_field *pevent_find_common_field(struct event_format *event, const char *name);
struct format_field *pevent_find_field(struct event_format *event, const char *name);
struct format_field *pevent_find_any_field(struct event_format *event, const char *name);
struct format_field *tep_find_common_field(struct event_format *event, const char *name);
struct format_field *tep_find_field(struct event_format *event, const char *name);
struct format_field *tep_find_any_field(struct event_format *event, const char *name);
const char *pevent_find_function(struct pevent *pevent, unsigned long long addr);
const char *tep_find_function(struct tep_handle *pevent, unsigned long long addr);
unsigned long long
pevent_find_function_address(struct pevent *pevent, unsigned long long addr);
unsigned long long pevent_read_number(struct pevent *pevent, const void *ptr, int size);
int pevent_read_number_field(struct format_field *field, const void *data,
unsigned long long *value);
tep_find_function_address(struct tep_handle *pevent, unsigned long long addr);
unsigned long long tep_read_number(struct tep_handle *pevent, const void *ptr, int size);
int tep_read_number_field(struct format_field *field, const void *data,
unsigned long long *value);
struct event_format *pevent_find_event(struct pevent *pevent, int id);
struct event_format *tep_find_event(struct tep_handle *pevent, int id);
struct event_format *
pevent_find_event_by_name(struct pevent *pevent, const char *sys, const char *name);
tep_find_event_by_name(struct tep_handle *pevent, const char *sys, const char *name);
struct event_format *
pevent_find_event_by_record(struct pevent *pevent, struct pevent_record *record);
tep_find_event_by_record(struct tep_handle *pevent, struct tep_record *record);
void pevent_data_lat_fmt(struct pevent *pevent,
struct trace_seq *s, struct pevent_record *record);
int pevent_data_type(struct pevent *pevent, struct pevent_record *rec);
struct event_format *pevent_data_event_from_type(struct pevent *pevent, int type);
int pevent_data_pid(struct pevent *pevent, struct pevent_record *rec);
int pevent_data_preempt_count(struct pevent *pevent, struct pevent_record *rec);
int pevent_data_flags(struct pevent *pevent, struct pevent_record *rec);
const char *pevent_data_comm_from_pid(struct pevent *pevent, int pid);
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 event_format *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);
const char *tep_data_comm_from_pid(struct tep_handle *pevent, int pid);
struct cmdline;
struct cmdline *pevent_data_pid_from_comm(struct pevent *pevent, const char *comm,
struct cmdline *next);
int pevent_cmdline_pid(struct pevent *pevent, struct cmdline *cmdline);
struct cmdline *tep_data_pid_from_comm(struct tep_handle *pevent, const char *comm,
struct cmdline *next);
int tep_cmdline_pid(struct tep_handle *pevent, struct cmdline *cmdline);
void pevent_print_field(struct trace_seq *s, void *data,
struct format_field *field);
void pevent_print_fields(struct trace_seq *s, void *data,
int size __maybe_unused, struct event_format *event);
void pevent_event_info(struct trace_seq *s, struct event_format *event,
struct pevent_record *record);
int pevent_strerror(struct pevent *pevent, enum pevent_errno errnum,
void tep_print_field(struct trace_seq *s, void *data,
struct format_field *field);
void tep_print_fields(struct trace_seq *s, void *data,
int size __maybe_unused, struct event_format *event);
void tep_event_info(struct trace_seq *s, struct event_format *event,
struct tep_record *record);
int tep_strerror(struct tep_handle *pevent, enum tep_errno errnum,
char *buf, size_t buflen);
struct event_format **pevent_list_events(struct pevent *pevent, enum event_sort_type);
struct format_field **pevent_event_common_fields(struct event_format *event);
struct format_field **pevent_event_fields(struct event_format *event);
struct event_format **tep_list_events(struct tep_handle *pevent, enum event_sort_type);
struct format_field **tep_event_common_fields(struct event_format *event);
struct format_field **tep_event_fields(struct event_format *event);
static inline int pevent_get_cpus(struct pevent *pevent)
static inline int tep_get_cpus(struct tep_handle *pevent)
{
return pevent->cpus;
}
static inline void pevent_set_cpus(struct pevent *pevent, int cpus)
static inline void tep_set_cpus(struct tep_handle *pevent, int cpus)
{
pevent->cpus = cpus;
}
static inline int pevent_get_long_size(struct pevent *pevent)
static inline int tep_get_long_size(struct tep_handle *pevent)
{
return pevent->long_size;
}
static inline void pevent_set_long_size(struct pevent *pevent, int long_size)
static inline void tep_set_long_size(struct tep_handle *pevent, int long_size)
{
pevent->long_size = long_size;
}
static inline int pevent_get_page_size(struct pevent *pevent)
static inline int tep_get_page_size(struct tep_handle *pevent)
{
return pevent->page_size;
}
static inline void pevent_set_page_size(struct pevent *pevent, int _page_size)
static inline void tep_set_page_size(struct tep_handle *pevent, int _page_size)
{
pevent->page_size = _page_size;
}
static inline int pevent_is_file_bigendian(struct pevent *pevent)
static inline int tep_is_file_bigendian(struct tep_handle *pevent)
{
return pevent->file_bigendian;
}
static inline void pevent_set_file_bigendian(struct pevent *pevent, int endian)
static inline void tep_set_file_bigendian(struct tep_handle *pevent, int endian)
{
pevent->file_bigendian = endian;
}
static inline int pevent_is_host_bigendian(struct pevent *pevent)
static inline int tep_is_host_bigendian(struct tep_handle *pevent)
{
return pevent->host_bigendian;
}
static inline void pevent_set_host_bigendian(struct pevent *pevent, int endian)
static inline void tep_set_host_bigendian(struct tep_handle *pevent, int endian)
{
pevent->host_bigendian = endian;
}
static inline int pevent_is_latency_format(struct pevent *pevent)
static inline int tep_is_latency_format(struct tep_handle *pevent)
{
return pevent->latency_format;
}
static inline void pevent_set_latency_format(struct pevent *pevent, int lat)
static inline void tep_set_latency_format(struct tep_handle *pevent, int lat)
{
pevent->latency_format = lat;
}
struct pevent *pevent_alloc(void);
void pevent_free(struct pevent *pevent);
void pevent_ref(struct pevent *pevent);
void pevent_unref(struct pevent *pevent);
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);
/* access to the internal parser */
void pevent_buffer_init(const char *buf, unsigned long long size);
enum event_type pevent_read_token(char **tok);
void pevent_free_token(char *token);
int pevent_peek_char(void);
const char *pevent_get_input_buf(void);
unsigned long long pevent_get_input_buf_ptr(void);
void tep_buffer_init(const char *buf, unsigned long long size);
enum event_type tep_read_token(char **tok);
void tep_free_token(char *token);
int tep_peek_char(void);
const char *tep_get_input_buf(void);
unsigned long long tep_get_input_buf_ptr(void);
/* for debugging */
void pevent_print_funcs(struct pevent *pevent);
void pevent_print_printk(struct pevent *pevent);
void tep_print_funcs(struct tep_handle *pevent);
void tep_print_printk(struct tep_handle *pevent);
/* ----------------------- filtering ----------------------- */
@ -930,22 +930,22 @@ struct filter_type {
struct filter_arg *filter;
};
#define PEVENT_FILTER_ERROR_BUFSZ 1024
#define TEP_FILTER_ERROR_BUFSZ 1024
struct event_filter {
struct pevent *pevent;
struct tep_handle *pevent;
int filters;
struct filter_type *event_filters;
char error_buffer[PEVENT_FILTER_ERROR_BUFSZ];
char error_buffer[TEP_FILTER_ERROR_BUFSZ];
};
struct event_filter *pevent_filter_alloc(struct pevent *pevent);
struct event_filter *tep_filter_alloc(struct tep_handle *pevent);
/* for backward compatibility */
#define FILTER_NONE PEVENT_ERRNO__NO_FILTER
#define FILTER_NOEXIST PEVENT_ERRNO__FILTER_NOT_FOUND
#define FILTER_MISS PEVENT_ERRNO__FILTER_MISS
#define FILTER_MATCH PEVENT_ERRNO__FILTER_MATCH
#define FILTER_NONE TEP_ERRNO__NO_FILTER
#define FILTER_NOEXIST TEP_ERRNO__FILTER_NOT_FOUND
#define FILTER_MISS TEP_ERRNO__FILTER_MISS
#define FILTER_MATCH TEP_ERRNO__FILTER_MATCH
enum filter_trivial_type {
FILTER_TRIVIAL_FALSE,
@ -953,39 +953,39 @@ enum filter_trivial_type {
FILTER_TRIVIAL_BOTH,
};
enum pevent_errno pevent_filter_add_filter_str(struct event_filter *filter,
const char *filter_str);
enum tep_errno tep_filter_add_filter_str(struct event_filter *filter,
const char *filter_str);
enum pevent_errno pevent_filter_match(struct event_filter *filter,
struct pevent_record *record);
enum tep_errno tep_filter_match(struct event_filter *filter,
struct tep_record *record);
int pevent_filter_strerror(struct event_filter *filter, enum pevent_errno err,
char *buf, size_t buflen);
int tep_filter_strerror(struct event_filter *filter, enum tep_errno err,
char *buf, size_t buflen);
int pevent_event_filtered(struct event_filter *filter,
int event_id);
int tep_event_filtered(struct event_filter *filter,
int event_id);
void pevent_filter_reset(struct event_filter *filter);
void tep_filter_reset(struct event_filter *filter);
int pevent_filter_clear_trivial(struct event_filter *filter,
int tep_filter_clear_trivial(struct event_filter *filter,
enum filter_trivial_type type);
void tep_filter_free(struct event_filter *filter);
char *tep_filter_make_string(struct event_filter *filter, int event_id);
int tep_filter_remove_event(struct event_filter *filter,
int event_id);
int tep_filter_event_has_trivial(struct event_filter *filter,
int event_id,
enum filter_trivial_type type);
void pevent_filter_free(struct event_filter *filter);
int tep_filter_copy(struct event_filter *dest, struct event_filter *source);
char *pevent_filter_make_string(struct event_filter *filter, int event_id);
int tep_update_trivial(struct event_filter *dest, struct event_filter *source,
enum filter_trivial_type type);
int pevent_filter_remove_event(struct event_filter *filter,
int event_id);
int pevent_filter_event_has_trivial(struct event_filter *filter,
int event_id,
enum filter_trivial_type type);
int pevent_filter_copy(struct event_filter *dest, struct event_filter *source);
int pevent_update_trivial(struct event_filter *dest, struct event_filter *source,
enum filter_trivial_type type);
int pevent_filter_compare(struct event_filter *filter1, struct event_filter *filter2);
int tep_filter_compare(struct event_filter *filter1, struct event_filter *filter2);
#endif /* _PARSE_EVENTS_H */

View file

@ -34,7 +34,7 @@
static struct registered_plugin_options {
struct registered_plugin_options *next;
struct pevent_plugin_option *options;
struct tep_plugin_option *options;
} *registered_options;
static struct trace_plugin_options {
@ -58,7 +58,7 @@ static void lower_case(char *str)
*str = tolower(*str);
}
static int update_option_value(struct pevent_plugin_option *op, const char *val)
static int update_option_value(struct tep_plugin_option *op, const char *val)
{
char *op_val;
@ -97,7 +97,7 @@ static int update_option_value(struct pevent_plugin_option *op, const char *val)
}
/**
* traceevent_plugin_list_options - get list of plugin options
* tep_plugin_list_options - get list of plugin options
*
* Returns an array of char strings that list the currently registered
* plugin options in the format of <plugin>:<option>. This list can be
@ -106,12 +106,12 @@ static int update_option_value(struct pevent_plugin_option *op, const char *val)
* Returns NULL if there's no options registered. On error it returns
* INVALID_PLUGIN_LIST_OPTION
*
* Must be freed with traceevent_plugin_free_options_list().
* Must be freed with tep_plugin_free_options_list().
*/
char **traceevent_plugin_list_options(void)
char **tep_plugin_list_options(void)
{
struct registered_plugin_options *reg;
struct pevent_plugin_option *op;
struct tep_plugin_option *op;
char **list = NULL;
char *name;
int count = 0;
@ -146,7 +146,7 @@ char **traceevent_plugin_list_options(void)
return INVALID_PLUGIN_LIST_OPTION;
}
void traceevent_plugin_free_options_list(char **list)
void tep_plugin_free_options_list(char **list)
{
int i;
@ -163,7 +163,7 @@ void traceevent_plugin_free_options_list(char **list)
}
static int
update_option(const char *file, struct pevent_plugin_option *option)
update_option(const char *file, struct tep_plugin_option *option)
{
struct trace_plugin_options *op;
char *plugin;
@ -215,14 +215,14 @@ update_option(const char *file, struct pevent_plugin_option *option)
}
/**
* traceevent_plugin_add_options - Add a set of options by a plugin
* tep_plugin_add_options - Add a set of options by a plugin
* @name: The name of the plugin adding the options
* @options: The set of options being loaded
*
* Sets the options with the values that have been added by user.
*/
int traceevent_plugin_add_options(const char *name,
struct pevent_plugin_option *options)
int tep_plugin_add_options(const char *name,
struct tep_plugin_option *options)
{
struct registered_plugin_options *reg;
@ -241,10 +241,10 @@ int traceevent_plugin_add_options(const char *name,
}
/**
* traceevent_plugin_remove_options - remove plugin options that were registered
* @options: Options to removed that were registered with traceevent_plugin_add_options
* tep_plugin_remove_options - remove plugin options that were registered
* @options: Options to removed that were registered with tep_plugin_add_options
*/
void traceevent_plugin_remove_options(struct pevent_plugin_option *options)
void tep_plugin_remove_options(struct tep_plugin_option *options)
{
struct registered_plugin_options **last;
struct registered_plugin_options *reg;
@ -260,19 +260,19 @@ void traceevent_plugin_remove_options(struct pevent_plugin_option *options)
}
/**
* traceevent_print_plugins - print out the list of plugins loaded
* tep_print_plugins - print out the list of plugins loaded
* @s: the trace_seq descripter to write to
* @prefix: The prefix string to add before listing the option name
* @suffix: The suffix string ot append after the option name
* @list: The list of plugins (usually returned by traceevent_load_plugins()
* @list: The list of plugins (usually returned by tep_load_plugins()
*
* Writes to the trace_seq @s the list of plugins (files) that is
* returned by traceevent_load_plugins(). Use @prefix and @suffix for formating:
* returned by tep_load_plugins(). Use @prefix and @suffix for formating:
* @prefix = " ", @suffix = "\n".
*/
void traceevent_print_plugins(struct trace_seq *s,
const char *prefix, const char *suffix,
const struct plugin_list *list)
void tep_print_plugins(struct trace_seq *s,
const char *prefix, const char *suffix,
const struct plugin_list *list)
{
while (list) {
trace_seq_printf(s, "%s%s%s", prefix, list->name, suffix);
@ -281,11 +281,11 @@ void traceevent_print_plugins(struct trace_seq *s,
}
static void
load_plugin(struct pevent *pevent, const char *path,
load_plugin(struct tep_handle *pevent, const char *path,
const char *file, void *data)
{
struct plugin_list **plugin_list = data;
pevent_plugin_load_func func;
tep_plugin_load_func func;
struct plugin_list *list;
const char *alias;
char *plugin;
@ -305,14 +305,14 @@ load_plugin(struct pevent *pevent, const char *path,
goto out_free;
}
alias = dlsym(handle, PEVENT_PLUGIN_ALIAS_NAME);
alias = dlsym(handle, TEP_PLUGIN_ALIAS_NAME);
if (!alias)
alias = file;
func = dlsym(handle, PEVENT_PLUGIN_LOADER_NAME);
func = dlsym(handle, TEP_PLUGIN_LOADER_NAME);
if (!func) {
warning("could not find func '%s' in plugin '%s'\n%s\n",
PEVENT_PLUGIN_LOADER_NAME, plugin, dlerror());
TEP_PLUGIN_LOADER_NAME, plugin, dlerror());
goto out_free;
}
@ -336,9 +336,9 @@ load_plugin(struct pevent *pevent, const char *path,
}
static void
load_plugins_dir(struct pevent *pevent, const char *suffix,
load_plugins_dir(struct tep_handle *pevent, const char *suffix,
const char *path,
void (*load_plugin)(struct pevent *pevent,
void (*load_plugin)(struct tep_handle *pevent,
const char *path,
const char *name,
void *data),
@ -378,8 +378,8 @@ load_plugins_dir(struct pevent *pevent, const char *suffix,
}
static void
load_plugins(struct pevent *pevent, const char *suffix,
void (*load_plugin)(struct pevent *pevent,
load_plugins(struct tep_handle *pevent, const char *suffix,
void (*load_plugin)(struct tep_handle *pevent,
const char *path,
const char *name,
void *data),
@ -390,7 +390,7 @@ load_plugins(struct pevent *pevent, const char *suffix,
char *envdir;
int ret;
if (pevent->flags & PEVENT_DISABLE_PLUGINS)
if (pevent->flags & TEP_DISABLE_PLUGINS)
return;
/*
@ -398,7 +398,7 @@ load_plugins(struct pevent *pevent, const char *suffix,
* check that first.
*/
#ifdef PLUGIN_DIR
if (!(pevent->flags & PEVENT_DISABLE_SYS_PLUGINS))
if (!(pevent->flags & TEP_DISABLE_SYS_PLUGINS))
load_plugins_dir(pevent, suffix, PLUGIN_DIR,
load_plugin, data);
#endif
@ -431,7 +431,7 @@ load_plugins(struct pevent *pevent, const char *suffix,
}
struct plugin_list*
traceevent_load_plugins(struct pevent *pevent)
tep_load_plugins(struct tep_handle *pevent)
{
struct plugin_list *list = NULL;
@ -440,15 +440,15 @@ traceevent_load_plugins(struct pevent *pevent)
}
void
traceevent_unload_plugins(struct plugin_list *plugin_list, struct pevent *pevent)
tep_unload_plugins(struct plugin_list *plugin_list, struct tep_handle *pevent)
{
pevent_plugin_unload_func func;
tep_plugin_unload_func func;
struct plugin_list *list;
while (plugin_list) {
list = plugin_list;
plugin_list = list->next;
func = dlsym(list->handle, PEVENT_PLUGIN_UNLOADER_NAME);
func = dlsym(list->handle, TEP_PLUGIN_UNLOADER_NAME);
if (func)
func(pevent);
dlclose(list->handle);

View file

@ -51,8 +51,8 @@ static void show_error(char *error_buf, const char *fmt, ...)
int len;
int i;
input = pevent_get_input_buf();
index = pevent_get_input_buf_ptr();
input = tep_get_input_buf();
index = tep_get_input_buf_ptr();
len = input ? strlen(input) : 0;
if (len) {
@ -66,13 +66,13 @@ static void show_error(char *error_buf, const char *fmt, ...)
}
va_start(ap, fmt);
vsnprintf(error_buf + len, PEVENT_FILTER_ERROR_BUFSZ - len, fmt, ap);
vsnprintf(error_buf + len, TEP_FILTER_ERROR_BUFSZ - len, fmt, ap);
va_end(ap);
}
static void free_token(char *token)
{
pevent_free_token(token);
tep_free_token(token);
}
static enum event_type read_token(char **tok)
@ -82,13 +82,13 @@ static enum event_type read_token(char **tok)
do {
free_token(token);
type = pevent_read_token(&token);
type = tep_read_token(&token);
} while (type == EVENT_NEWLINE || type == EVENT_SPACE);
/* If token is = or ! check to see if the next char is ~ */
if (token &&
(strcmp(token, "=") == 0 || strcmp(token, "!") == 0) &&
pevent_peek_char() == '~') {
tep_peek_char() == '~') {
/* append it */
*tok = malloc(3);
if (*tok == NULL) {
@ -98,7 +98,7 @@ static enum event_type read_token(char **tok)
sprintf(*tok, "%c%c", *token, '~');
free_token(token);
/* Now remove the '~' from the buffer */
pevent_read_token(&token);
tep_read_token(&token);
free_token(token);
} else
*tok = token;
@ -167,7 +167,7 @@ add_filter_type(struct event_filter *filter, int id)
filter_type = &filter->event_filters[i];
filter_type->event_id = id;
filter_type->event = pevent_find_event(filter->pevent, id);
filter_type->event = tep_find_event(filter->pevent, id);
filter_type->filter = NULL;
filter->filters++;
@ -176,10 +176,10 @@ add_filter_type(struct event_filter *filter, int id)
}
/**
* pevent_filter_alloc - create a new event filter
* tep_filter_alloc - create a new event filter
* @pevent: The pevent that this filter is associated with
*/
struct event_filter *pevent_filter_alloc(struct pevent *pevent)
struct event_filter *tep_filter_alloc(struct tep_handle *pevent)
{
struct event_filter *filter;
@ -189,7 +189,7 @@ struct event_filter *pevent_filter_alloc(struct pevent *pevent)
memset(filter, 0, sizeof(*filter));
filter->pevent = pevent;
pevent_ref(pevent);
tep_ref(pevent);
return filter;
}
@ -268,8 +268,8 @@ static int event_match(struct event_format *event,
!regexec(ereg, event->name, 0, NULL, 0);
}
static enum pevent_errno
find_event(struct pevent *pevent, struct event_list **events,
static enum tep_errno
find_event(struct tep_handle *pevent, struct event_list **events,
char *sys_name, char *event_name)
{
struct event_format *event;
@ -289,26 +289,26 @@ find_event(struct pevent *pevent, struct event_list **events,
ret = asprintf(&reg, "^%s$", event_name);
if (ret < 0)
return PEVENT_ERRNO__MEM_ALLOC_FAILED;
return TEP_ERRNO__MEM_ALLOC_FAILED;
ret = regcomp(&ereg, reg, REG_ICASE|REG_NOSUB);
free(reg);
if (ret)
return PEVENT_ERRNO__INVALID_EVENT_NAME;
return TEP_ERRNO__INVALID_EVENT_NAME;
if (sys_name) {
ret = asprintf(&reg, "^%s$", sys_name);
if (ret < 0) {
regfree(&ereg);
return PEVENT_ERRNO__MEM_ALLOC_FAILED;
return TEP_ERRNO__MEM_ALLOC_FAILED;
}
ret = regcomp(&sreg, reg, REG_ICASE|REG_NOSUB);
free(reg);
if (ret) {
regfree(&ereg);
return PEVENT_ERRNO__INVALID_EVENT_NAME;
return TEP_ERRNO__INVALID_EVENT_NAME;
}
}
@ -328,9 +328,9 @@ find_event(struct pevent *pevent, struct event_list **events,
regfree(&sreg);
if (!match)
return PEVENT_ERRNO__EVENT_NOT_FOUND;
return TEP_ERRNO__EVENT_NOT_FOUND;
if (fail)
return PEVENT_ERRNO__MEM_ALLOC_FAILED;
return TEP_ERRNO__MEM_ALLOC_FAILED;
return 0;
}
@ -346,7 +346,7 @@ static void free_events(struct event_list *events)
}
}
static enum pevent_errno
static enum tep_errno
create_arg_item(struct event_format *event, const char *token,
enum event_type type, struct filter_arg **parg, char *error_str)
{
@ -356,7 +356,7 @@ create_arg_item(struct event_format *event, const char *token,
arg = allocate_arg();
if (arg == NULL) {
show_error(error_str, "failed to allocate filter arg");
return PEVENT_ERRNO__MEM_ALLOC_FAILED;
return TEP_ERRNO__MEM_ALLOC_FAILED;
}
switch (type) {
@ -370,7 +370,7 @@ create_arg_item(struct event_format *event, const char *token,
if (!arg->value.str) {
free_arg(arg);
show_error(error_str, "failed to allocate string filter arg");
return PEVENT_ERRNO__MEM_ALLOC_FAILED;
return TEP_ERRNO__MEM_ALLOC_FAILED;
}
break;
case EVENT_ITEM:
@ -382,7 +382,7 @@ create_arg_item(struct event_format *event, const char *token,
break;
}
/* Consider this a field */
field = pevent_find_any_field(event, token);
field = tep_find_any_field(event, token);
if (!field) {
/* If token is 'COMM' or 'CPU' then it is special */
if (strcmp(token, COMM) == 0) {
@ -402,7 +402,7 @@ create_arg_item(struct event_format *event, const char *token,
default:
free_arg(arg);
show_error(error_str, "expected a value but found %s", token);
return PEVENT_ERRNO__UNEXPECTED_TYPE;
return TEP_ERRNO__UNEXPECTED_TYPE;
}
*parg = arg;
return 0;
@ -454,7 +454,7 @@ create_arg_cmp(enum filter_cmp_type ctype)
return arg;
}
static enum pevent_errno
static enum tep_errno
add_right(struct filter_arg *op, struct filter_arg *arg, char *error_str)
{
struct filter_arg *left;
@ -487,7 +487,7 @@ add_right(struct filter_arg *op, struct filter_arg *arg, char *error_str)
break;
default:
show_error(error_str, "Illegal rvalue");
return PEVENT_ERRNO__ILLEGAL_RVALUE;
return TEP_ERRNO__ILLEGAL_RVALUE;
}
/*
@ -534,7 +534,7 @@ add_right(struct filter_arg *op, struct filter_arg *arg, char *error_str)
if (left->type != FILTER_ARG_FIELD) {
show_error(error_str,
"Illegal lvalue for string comparison");
return PEVENT_ERRNO__ILLEGAL_LVALUE;
return TEP_ERRNO__ILLEGAL_LVALUE;
}
/* Make sure this is a valid string compare */
@ -553,13 +553,13 @@ add_right(struct filter_arg *op, struct filter_arg *arg, char *error_str)
show_error(error_str,
"RegEx '%s' did not compute",
str);
return PEVENT_ERRNO__INVALID_REGEX;
return TEP_ERRNO__INVALID_REGEX;
}
break;
default:
show_error(error_str,
"Illegal comparison for string");
return PEVENT_ERRNO__ILLEGAL_STRING_CMP;
return TEP_ERRNO__ILLEGAL_STRING_CMP;
}
op->type = FILTER_ARG_STR;
@ -568,7 +568,7 @@ add_right(struct filter_arg *op, struct filter_arg *arg, char *error_str)
op->str.val = strdup(str);
if (!op->str.val) {
show_error(error_str, "Failed to allocate string filter");
return PEVENT_ERRNO__MEM_ALLOC_FAILED;
return TEP_ERRNO__MEM_ALLOC_FAILED;
}
/*
* Need a buffer to copy data for tests
@ -576,7 +576,7 @@ add_right(struct filter_arg *op, struct filter_arg *arg, char *error_str)
op->str.buffer = malloc(op->str.field->size + 1);
if (!op->str.buffer) {
show_error(error_str, "Failed to allocate string filter");
return PEVENT_ERRNO__MEM_ALLOC_FAILED;
return TEP_ERRNO__MEM_ALLOC_FAILED;
}
/* Null terminate this buffer */
op->str.buffer[op->str.field->size] = 0;
@ -595,7 +595,7 @@ add_right(struct filter_arg *op, struct filter_arg *arg, char *error_str)
case FILTER_CMP_NOT_REGEX:
show_error(error_str,
"Op not allowed with integers");
return PEVENT_ERRNO__ILLEGAL_INTEGER_CMP;
return TEP_ERRNO__ILLEGAL_INTEGER_CMP;
default:
break;
@ -616,7 +616,7 @@ add_right(struct filter_arg *op, struct filter_arg *arg, char *error_str)
out_fail:
show_error(error_str, "Syntax error");
return PEVENT_ERRNO__SYNTAX_ERROR;
return TEP_ERRNO__SYNTAX_ERROR;
}
static struct filter_arg *
@ -629,7 +629,7 @@ rotate_op_right(struct filter_arg *a, struct filter_arg *b)
return arg;
}
static enum pevent_errno add_left(struct filter_arg *op, struct filter_arg *arg)
static enum tep_errno add_left(struct filter_arg *op, struct filter_arg *arg)
{
switch (op->type) {
case FILTER_ARG_EXP:
@ -648,11 +648,11 @@ static enum pevent_errno add_left(struct filter_arg *op, struct filter_arg *arg)
/* left arg of compares must be a field */
if (arg->type != FILTER_ARG_FIELD &&
arg->type != FILTER_ARG_BOOLEAN)
return PEVENT_ERRNO__INVALID_ARG_TYPE;
return TEP_ERRNO__INVALID_ARG_TYPE;
op->num.left = arg;
break;
default:
return PEVENT_ERRNO__INVALID_ARG_TYPE;
return TEP_ERRNO__INVALID_ARG_TYPE;
}
return 0;
}
@ -765,7 +765,7 @@ enum filter_vals {
FILTER_VAL_TRUE,
};
static enum pevent_errno
static enum tep_errno
reparent_op_arg(struct filter_arg *parent, struct filter_arg *old_child,
struct filter_arg *arg, char *error_str)
{
@ -775,7 +775,7 @@ reparent_op_arg(struct filter_arg *parent, struct filter_arg *old_child,
if (parent->type != FILTER_ARG_OP &&
arg->type != FILTER_ARG_OP) {
show_error(error_str, "can not reparent other than OP");
return PEVENT_ERRNO__REPARENT_NOT_OP;
return TEP_ERRNO__REPARENT_NOT_OP;
}
/* Get the sibling */
@ -787,7 +787,7 @@ reparent_op_arg(struct filter_arg *parent, struct filter_arg *old_child,
other_child = old_child->op.right;
} else {
show_error(error_str, "Error in reparent op, find other child");
return PEVENT_ERRNO__REPARENT_FAILED;
return TEP_ERRNO__REPARENT_FAILED;
}
/* Detach arg from old_child */
@ -808,7 +808,7 @@ reparent_op_arg(struct filter_arg *parent, struct filter_arg *old_child,
ptr = &parent->op.left;
else {
show_error(error_str, "Error in reparent op");
return PEVENT_ERRNO__REPARENT_FAILED;
return TEP_ERRNO__REPARENT_FAILED;
}
*ptr = arg;
@ -817,7 +817,7 @@ reparent_op_arg(struct filter_arg *parent, struct filter_arg *old_child,
return 0;
}
/* Returns either filter_vals (success) or pevent_errno (failfure) */
/* Returns either filter_vals (success) or tep_errno (failfure) */
static int test_arg(struct filter_arg *parent, struct filter_arg *arg,
char *error_str)
{
@ -912,7 +912,7 @@ static int test_arg(struct filter_arg *parent, struct filter_arg *arg,
return rval;
default:
show_error(error_str, "bad arg in filter tree");
return PEVENT_ERRNO__BAD_FILTER_ARG;
return TEP_ERRNO__BAD_FILTER_ARG;
}
return FILTER_VAL_NORM;
}
@ -937,7 +937,7 @@ static int collapse_tree(struct filter_arg *arg,
arg->boolean.value = ret == FILTER_VAL_TRUE;
} else {
show_error(error_str, "Failed to allocate filter arg");
ret = PEVENT_ERRNO__MEM_ALLOC_FAILED;
ret = TEP_ERRNO__MEM_ALLOC_FAILED;
}
break;
@ -952,7 +952,7 @@ static int collapse_tree(struct filter_arg *arg,
return ret;
}
static enum pevent_errno
static enum tep_errno
process_filter(struct event_format *event, struct filter_arg **parg,
char *error_str, int not)
{
@ -966,7 +966,7 @@ process_filter(struct event_format *event, struct filter_arg **parg,
enum filter_op_type btype;
enum filter_exp_type etype;
enum filter_cmp_type ctype;
enum pevent_errno ret;
enum tep_errno ret;
*parg = NULL;
@ -1004,7 +1004,7 @@ process_filter(struct event_format *event, struct filter_arg **parg,
case EVENT_DELIM:
if (*token == ',') {
show_error(error_str, "Illegal token ','");
ret = PEVENT_ERRNO__ILLEGAL_TOKEN;
ret = TEP_ERRNO__ILLEGAL_TOKEN;
goto fail;
}
@ -1012,22 +1012,22 @@ process_filter(struct event_format *event, struct filter_arg **parg,
if (left_item) {
show_error(error_str,
"Open paren can not come after item");
ret = PEVENT_ERRNO__INVALID_PAREN;
ret = TEP_ERRNO__INVALID_PAREN;
goto fail;
}
if (current_exp) {
show_error(error_str,
"Open paren can not come after expression");
ret = PEVENT_ERRNO__INVALID_PAREN;
ret = TEP_ERRNO__INVALID_PAREN;
goto fail;
}
ret = process_filter(event, &arg, error_str, 0);
if (ret != PEVENT_ERRNO__UNBALANCED_PAREN) {
if (ret != TEP_ERRNO__UNBALANCED_PAREN) {
if (ret == 0) {
show_error(error_str,
"Unbalanced number of '('");
ret = PEVENT_ERRNO__UNBALANCED_PAREN;
ret = TEP_ERRNO__UNBALANCED_PAREN;
}
goto fail;
}
@ -1064,7 +1064,7 @@ process_filter(struct event_format *event, struct filter_arg **parg,
else
*parg = current_exp;
free(token);
return PEVENT_ERRNO__UNBALANCED_PAREN;
return TEP_ERRNO__UNBALANCED_PAREN;
}
break;
@ -1091,7 +1091,7 @@ process_filter(struct event_format *event, struct filter_arg **parg,
case OP_NONE:
show_error(error_str,
"Unknown op token %s", token);
ret = PEVENT_ERRNO__UNKNOWN_TOKEN;
ret = TEP_ERRNO__UNKNOWN_TOKEN;
goto fail;
}
@ -1179,11 +1179,11 @@ process_filter(struct event_format *event, struct filter_arg **parg,
fail_alloc:
show_error(error_str, "failed to allocate filter arg");
ret = PEVENT_ERRNO__MEM_ALLOC_FAILED;
ret = TEP_ERRNO__MEM_ALLOC_FAILED;
goto fail;
fail_syntax:
show_error(error_str, "Syntax error");
ret = PEVENT_ERRNO__SYNTAX_ERROR;
ret = TEP_ERRNO__SYNTAX_ERROR;
fail:
free_arg(current_op);
free_arg(current_exp);
@ -1192,13 +1192,13 @@ process_filter(struct event_format *event, struct filter_arg **parg,
return ret;
}
static enum pevent_errno
static enum tep_errno
process_event(struct event_format *event, const char *filter_str,
struct filter_arg **parg, char *error_str)
{
int ret;
pevent_buffer_init(filter_str, strlen(filter_str));
tep_buffer_init(filter_str, strlen(filter_str));
ret = process_filter(event, parg, error_str, 0);
if (ret < 0)
@ -1208,7 +1208,7 @@ process_event(struct event_format *event, const char *filter_str,
if (!*parg) {
*parg = allocate_arg();
if (*parg == NULL)
return PEVENT_ERRNO__MEM_ALLOC_FAILED;
return TEP_ERRNO__MEM_ALLOC_FAILED;
(*parg)->type = FILTER_ARG_BOOLEAN;
(*parg)->boolean.value = FILTER_FALSE;
@ -1217,13 +1217,13 @@ process_event(struct event_format *event, const char *filter_str,
return 0;
}
static enum pevent_errno
static enum tep_errno
filter_event(struct event_filter *filter, struct event_format *event,
const char *filter_str, char *error_str)
{
struct filter_type *filter_type;
struct filter_arg *arg;
enum pevent_errno ret;
enum tep_errno ret;
if (filter_str) {
ret = process_event(event, filter_str, &arg, error_str);
@ -1234,7 +1234,7 @@ filter_event(struct event_filter *filter, struct event_format *event,
/* just add a TRUE arg */
arg = allocate_arg();
if (arg == NULL)
return PEVENT_ERRNO__MEM_ALLOC_FAILED;
return TEP_ERRNO__MEM_ALLOC_FAILED;
arg->type = FILTER_ARG_BOOLEAN;
arg->boolean.value = FILTER_TRUE;
@ -1242,7 +1242,7 @@ filter_event(struct event_filter *filter, struct event_format *event,
filter_type = add_filter_type(filter, event->id);
if (filter_type == NULL)
return PEVENT_ERRNO__MEM_ALLOC_FAILED;
return TEP_ERRNO__MEM_ALLOC_FAILED;
if (filter_type->filter)
free_arg(filter_type->filter);
@ -1254,23 +1254,23 @@ filter_event(struct event_filter *filter, struct event_format *event,
static void filter_init_error_buf(struct event_filter *filter)
{
/* clear buffer to reset show error */
pevent_buffer_init("", 0);
tep_buffer_init("", 0);
filter->error_buffer[0] = '\0';
}
/**
* pevent_filter_add_filter_str - add a new filter
* tep_filter_add_filter_str - add a new filter
* @filter: the event filter to add to
* @filter_str: the filter string that contains the filter
*
* Returns 0 if the filter was successfully added or a
* negative error code. Use pevent_filter_strerror() to see
* negative error code. Use tep_filter_strerror() to see
* actual error message in case of error.
*/
enum pevent_errno pevent_filter_add_filter_str(struct event_filter *filter,
const char *filter_str)
enum tep_errno tep_filter_add_filter_str(struct event_filter *filter,
const char *filter_str)
{
struct pevent *pevent = filter->pevent;
struct tep_handle *pevent = filter->pevent;
struct event_list *event;
struct event_list *events = NULL;
const char *filter_start;
@ -1279,7 +1279,7 @@ enum pevent_errno pevent_filter_add_filter_str(struct event_filter *filter,
char *event_name = NULL;
char *sys_name = NULL;
char *sp;
enum pevent_errno rtn = 0; /* PEVENT_ERRNO__SUCCESS */
enum tep_errno rtn = 0; /* TEP_ERRNO__SUCCESS */
int len;
int ret;
@ -1305,7 +1305,7 @@ enum pevent_errno pevent_filter_add_filter_str(struct event_filter *filter,
if (this_event == NULL) {
/* This can only happen when events is NULL, but still */
free_events(events);
return PEVENT_ERRNO__MEM_ALLOC_FAILED;
return TEP_ERRNO__MEM_ALLOC_FAILED;
}
memcpy(this_event, filter_str, len);
this_event[len] = 0;
@ -1322,7 +1322,7 @@ enum pevent_errno pevent_filter_add_filter_str(struct event_filter *filter,
/* This can only happen when events is NULL, but still */
free_events(events);
free(this_event);
return PEVENT_ERRNO__FILTER_NOT_FOUND;
return TEP_ERRNO__FILTER_NOT_FOUND;
}
/* Find this event */
@ -1349,7 +1349,7 @@ enum pevent_errno pevent_filter_add_filter_str(struct event_filter *filter,
if (ret >= 0 && pevent->test_filters) {
char *test;
test = pevent_filter_make_string(filter, event->event->id);
test = tep_filter_make_string(filter, event->event->id);
if (test) {
printf(" '%s: %s'\n", event->event->name, test);
free(test);
@ -1371,7 +1371,7 @@ static void free_filter_type(struct filter_type *filter_type)
}
/**
* pevent_filter_strerror - fill error message in a buffer
* tep_filter_strerror - fill error message in a buffer
* @filter: the event filter contains error
* @err: the error code
* @buf: the buffer to be filled in
@ -1379,10 +1379,10 @@ static void free_filter_type(struct filter_type *filter_type)
*
* Returns 0 if message was filled successfully, -1 if error
*/
int pevent_filter_strerror(struct event_filter *filter, enum pevent_errno err,
char *buf, size_t buflen)
int tep_filter_strerror(struct event_filter *filter, enum tep_errno err,
char *buf, size_t buflen)
{
if (err <= __PEVENT_ERRNO__START || err >= __PEVENT_ERRNO__END)
if (err <= __TEP_ERRNO__START || err >= __TEP_ERRNO__END)
return -1;
if (strlen(filter->error_buffer) > 0) {
@ -1393,11 +1393,11 @@ int pevent_filter_strerror(struct event_filter *filter, enum pevent_errno err,
return 0;
}
return pevent_strerror(filter->pevent, err, buf, buflen);
return tep_strerror(filter->pevent, err, buf, buflen);
}
/**
* pevent_filter_remove_event - remove a filter for an event
* tep_filter_remove_event - remove a filter for an event
* @filter: the event filter to remove from
* @event_id: the event to remove a filter for
*
@ -1407,8 +1407,8 @@ int pevent_filter_strerror(struct event_filter *filter, enum pevent_errno err,
* Returns 1: if an event was removed
* 0: if the event was not found
*/
int pevent_filter_remove_event(struct event_filter *filter,
int event_id)
int tep_filter_remove_event(struct event_filter *filter,
int event_id)
{
struct filter_type *filter_type;
unsigned long len;
@ -1437,12 +1437,12 @@ int pevent_filter_remove_event(struct event_filter *filter,
}
/**
* pevent_filter_reset - clear all filters in a filter
* tep_filter_reset - clear all filters in a filter
* @filter: the event filter to reset
*
* Removes all filters from a filter and resets it.
*/
void pevent_filter_reset(struct event_filter *filter)
void tep_filter_reset(struct event_filter *filter)
{
int i;
@ -1454,11 +1454,11 @@ void pevent_filter_reset(struct event_filter *filter)
filter->event_filters = NULL;
}
void pevent_filter_free(struct event_filter *filter)
void tep_filter_free(struct event_filter *filter)
{
pevent_unref(filter->pevent);
tep_unref(filter->pevent);
pevent_filter_reset(filter);
tep_filter_reset(filter);
free(filter);
}
@ -1478,7 +1478,7 @@ static int copy_filter_type(struct event_filter *filter,
/* Can't assume that the pevent's are the same */
sys = filter_type->event->system;
name = filter_type->event->name;
event = pevent_find_event_by_name(filter->pevent, sys, name);
event = tep_find_event_by_name(filter->pevent, sys, name);
if (!event)
return -1;
@ -1515,18 +1515,18 @@ static int copy_filter_type(struct event_filter *filter,
}
/**
* pevent_filter_copy - copy a filter using another filter
* tep_filter_copy - copy a filter using another filter
* @dest - the filter to copy to
* @source - the filter to copy from
*
* Returns 0 on success and -1 if not all filters were copied
*/
int pevent_filter_copy(struct event_filter *dest, struct event_filter *source)
int tep_filter_copy(struct event_filter *dest, struct event_filter *source)
{
int ret = 0;
int i;
pevent_filter_reset(dest);
tep_filter_reset(dest);
for (i = 0; i < source->filters; i++) {
if (copy_filter_type(dest, source, &source->event_filters[i]))
@ -1537,7 +1537,7 @@ int pevent_filter_copy(struct event_filter *dest, struct event_filter *source)
/**
* pevent_update_trivial - update the trivial filters with the given filter
* tep_update_trivial - update the trivial filters with the given filter
* @dest - the filter to update
* @source - the filter as the source of the update
* @type - the type of trivial filter to update.
@ -1547,11 +1547,11 @@ int pevent_filter_copy(struct event_filter *dest, struct event_filter *source)
* Returns 0 on success and -1 if there was a problem updating, but
* events may have still been updated on error.
*/
int pevent_update_trivial(struct event_filter *dest, struct event_filter *source,
enum filter_trivial_type type)
int tep_update_trivial(struct event_filter *dest, struct event_filter *source,
enum filter_trivial_type type)
{
struct pevent *src_pevent;
struct pevent *dest_pevent;
struct tep_handle *src_pevent;
struct tep_handle *dest_pevent;
struct event_format *event;
struct filter_type *filter_type;
struct filter_arg *arg;
@ -1578,14 +1578,14 @@ int pevent_update_trivial(struct event_filter *dest, struct event_filter *source
if (src_pevent != dest_pevent) {
/* do a look up */
event = pevent_find_event_by_name(src_pevent,
event->system,
event->name);
event = tep_find_event_by_name(src_pevent,
event->system,
event->name);
if (!event)
return -1;
}
str = pevent_filter_make_string(source, event->id);
str = tep_filter_make_string(source, event->id);
if (!str)
continue;
@ -1598,7 +1598,7 @@ int pevent_update_trivial(struct event_filter *dest, struct event_filter *source
}
/**
* pevent_filter_clear_trivial - clear TRUE and FALSE filters
* tep_filter_clear_trivial - clear TRUE and FALSE filters
* @filter: the filter to remove trivial filters from
* @type: remove only true, false, or both
*
@ -1606,8 +1606,8 @@ int pevent_update_trivial(struct event_filter *dest, struct event_filter *source
*
* Returns 0 on success and -1 if there was a problem.
*/
int pevent_filter_clear_trivial(struct event_filter *filter,
enum filter_trivial_type type)
int tep_filter_clear_trivial(struct event_filter *filter,
enum filter_trivial_type type)
{
struct filter_type *filter_type;
int count = 0;
@ -1653,14 +1653,14 @@ int pevent_filter_clear_trivial(struct event_filter *filter,
return 0;
for (i = 0; i < count; i++)
pevent_filter_remove_event(filter, ids[i]);
tep_filter_remove_event(filter, ids[i]);
free(ids);
return 0;
}
/**
* pevent_filter_event_has_trivial - return true event contains trivial filter
* tep_filter_event_has_trivial - return true event contains trivial filter
* @filter: the filter with the information
* @event_id: the id of the event to test
* @type: trivial type to test for (TRUE, FALSE, EITHER)
@ -1668,9 +1668,9 @@ int pevent_filter_clear_trivial(struct event_filter *filter,
* Returns 1 if the event contains a matching trivial type
* otherwise 0.
*/
int pevent_filter_event_has_trivial(struct event_filter *filter,
int event_id,
enum filter_trivial_type type)
int tep_filter_event_has_trivial(struct event_filter *filter,
int event_id,
enum filter_trivial_type type)
{
struct filter_type *filter_type;
@ -1697,22 +1697,22 @@ int pevent_filter_event_has_trivial(struct event_filter *filter,
}
static int test_filter(struct event_format *event, struct filter_arg *arg,
struct pevent_record *record, enum pevent_errno *err);
struct tep_record *record, enum tep_errno *err);
static const char *
get_comm(struct event_format *event, struct pevent_record *record)
get_comm(struct event_format *event, struct tep_record *record)
{
const char *comm;
int pid;
pid = pevent_data_pid(event->pevent, record);
comm = pevent_data_comm_from_pid(event->pevent, pid);
pid = tep_data_pid(event->pevent, record);
comm = tep_data_comm_from_pid(event->pevent, pid);
return comm;
}
static unsigned long long
get_value(struct event_format *event,
struct format_field *field, struct pevent_record *record)
struct format_field *field, struct tep_record *record)
{
unsigned long long val;
@ -1728,7 +1728,7 @@ get_value(struct event_format *event,
if (field == &cpu)
return record->cpu;
pevent_read_number_field(field, record->data, &val);
tep_read_number_field(field, record->data, &val);
if (!(field->flags & FIELD_IS_SIGNED))
return val;
@ -1748,11 +1748,11 @@ get_value(struct event_format *event,
static unsigned long long
get_arg_value(struct event_format *event, struct filter_arg *arg,
struct pevent_record *record, enum pevent_errno *err);
struct tep_record *record, enum tep_errno *err);
static unsigned long long
get_exp_value(struct event_format *event, struct filter_arg *arg,
struct pevent_record *record, enum pevent_errno *err)
struct tep_record *record, enum tep_errno *err)
{
unsigned long long lval, rval;
@ -1800,14 +1800,14 @@ get_exp_value(struct event_format *event, struct filter_arg *arg,
case FILTER_EXP_NOT:
default:
if (!*err)
*err = PEVENT_ERRNO__INVALID_EXP_TYPE;
*err = TEP_ERRNO__INVALID_EXP_TYPE;
}
return 0;
}
static unsigned long long
get_arg_value(struct event_format *event, struct filter_arg *arg,
struct pevent_record *record, enum pevent_errno *err)
struct tep_record *record, enum tep_errno *err)
{
switch (arg->type) {
case FILTER_ARG_FIELD:
@ -1816,7 +1816,7 @@ get_arg_value(struct event_format *event, struct filter_arg *arg,
case FILTER_ARG_VALUE:
if (arg->value.type != FILTER_NUMBER) {
if (!*err)
*err = PEVENT_ERRNO__NOT_A_NUMBER;
*err = TEP_ERRNO__NOT_A_NUMBER;
}
return arg->value.val;
@ -1825,13 +1825,13 @@ get_arg_value(struct event_format *event, struct filter_arg *arg,
default:
if (!*err)
*err = PEVENT_ERRNO__INVALID_ARG_TYPE;
*err = TEP_ERRNO__INVALID_ARG_TYPE;
}
return 0;
}
static int test_num(struct event_format *event, struct filter_arg *arg,
struct pevent_record *record, enum pevent_errno *err)
struct tep_record *record, enum tep_errno *err)
{
unsigned long long lval, rval;
@ -1866,15 +1866,15 @@ static int test_num(struct event_format *event, struct filter_arg *arg,
default:
if (!*err)
*err = PEVENT_ERRNO__ILLEGAL_INTEGER_CMP;
*err = TEP_ERRNO__ILLEGAL_INTEGER_CMP;
return 0;
}
}
static const char *get_field_str(struct filter_arg *arg, struct pevent_record *record)
static const char *get_field_str(struct filter_arg *arg, struct tep_record *record)
{
struct event_format *event;
struct pevent *pevent;
struct tep_handle *pevent;
unsigned long long addr;
const char *val = NULL;
unsigned int size;
@ -1909,7 +1909,7 @@ static const char *get_field_str(struct filter_arg *arg, struct pevent_record *r
if (arg->str.field->flags & (FIELD_IS_POINTER | FIELD_IS_LONG))
/* convert to a kernel symbol */
val = pevent_find_function(pevent, addr);
val = tep_find_function(pevent, addr);
if (val == NULL) {
/* just use the hex of the string name */
@ -1922,7 +1922,7 @@ static const char *get_field_str(struct filter_arg *arg, struct pevent_record *r
}
static int test_str(struct event_format *event, struct filter_arg *arg,
struct pevent_record *record, enum pevent_errno *err)
struct tep_record *record, enum tep_errno *err)
{
const char *val;
@ -1947,13 +1947,13 @@ static int test_str(struct event_format *event, struct filter_arg *arg,
default:
if (!*err)
*err = PEVENT_ERRNO__ILLEGAL_STRING_CMP;
*err = TEP_ERRNO__ILLEGAL_STRING_CMP;
return 0;
}
}
static int test_op(struct event_format *event, struct filter_arg *arg,
struct pevent_record *record, enum pevent_errno *err)
struct tep_record *record, enum tep_errno *err)
{
switch (arg->op.type) {
case FILTER_OP_AND:
@ -1969,13 +1969,13 @@ static int test_op(struct event_format *event, struct filter_arg *arg,
default:
if (!*err)
*err = PEVENT_ERRNO__INVALID_OP_TYPE;
*err = TEP_ERRNO__INVALID_OP_TYPE;
return 0;
}
}
static int test_filter(struct event_format *event, struct filter_arg *arg,
struct pevent_record *record, enum pevent_errno *err)
struct tep_record *record, enum tep_errno *err)
{
if (*err) {
/*
@ -2009,20 +2009,20 @@ static int test_filter(struct event_format *event, struct filter_arg *arg,
default:
if (!*err)
*err = PEVENT_ERRNO__INVALID_ARG_TYPE;
*err = TEP_ERRNO__INVALID_ARG_TYPE;
return 0;
}
}
/**
* pevent_event_filtered - return true if event has filter
* tep_event_filtered - return true if event has filter
* @filter: filter struct with filter information
* @event_id: event id to test if filter exists
*
* Returns 1 if filter found for @event_id
* otherwise 0;
*/
int pevent_event_filtered(struct event_filter *filter, int event_id)
int tep_event_filtered(struct event_filter *filter, int event_id)
{
struct filter_type *filter_type;
@ -2035,42 +2035,42 @@ int pevent_event_filtered(struct event_filter *filter, int event_id)
}
/**
* pevent_filter_match - test if a record matches a filter
* tep_filter_match - test if a record matches a filter
* @filter: filter struct with filter information
* @record: the record to test against the filter
*
* Returns: match result or error code (prefixed with PEVENT_ERRNO__)
* Returns: match result or error code (prefixed with TEP_ERRNO__)
* FILTER_MATCH - filter found for event and @record matches
* FILTER_MISS - filter found for event and @record does not match
* FILTER_NOT_FOUND - no filter found for @record's event
* NO_FILTER - if no filters exist
* otherwise - error occurred during test
*/
enum pevent_errno pevent_filter_match(struct event_filter *filter,
struct pevent_record *record)
enum tep_errno tep_filter_match(struct event_filter *filter,
struct tep_record *record)
{
struct pevent *pevent = filter->pevent;
struct tep_handle *pevent = filter->pevent;
struct filter_type *filter_type;
int event_id;
int ret;
enum pevent_errno err = 0;
enum tep_errno err = 0;
filter_init_error_buf(filter);
if (!filter->filters)
return PEVENT_ERRNO__NO_FILTER;
return TEP_ERRNO__NO_FILTER;
event_id = pevent_data_type(pevent, record);
event_id = tep_data_type(pevent, record);
filter_type = find_filter_type(filter, event_id);
if (!filter_type)
return PEVENT_ERRNO__FILTER_NOT_FOUND;
return TEP_ERRNO__FILTER_NOT_FOUND;
ret = test_filter(filter_type->event, filter_type->filter, record, &err);
if (err)
return err;
return ret ? PEVENT_ERRNO__FILTER_MATCH : PEVENT_ERRNO__FILTER_MISS;
return ret ? TEP_ERRNO__FILTER_MATCH : TEP_ERRNO__FILTER_MISS;
}
static char *op_to_str(struct event_filter *filter, struct filter_arg *arg)
@ -2364,7 +2364,7 @@ static char *arg_to_str(struct event_filter *filter, struct filter_arg *arg)
}
/**
* pevent_filter_make_string - return a string showing the filter
* tep_filter_make_string - return a string showing the filter
* @filter: filter struct with filter information
* @event_id: the event id to return the filter string with
*
@ -2373,7 +2373,7 @@ static char *arg_to_str(struct event_filter *filter, struct filter_arg *arg)
* NULL is returned if no filter is found or allocation failed.
*/
char *
pevent_filter_make_string(struct event_filter *filter, int event_id)
tep_filter_make_string(struct event_filter *filter, int event_id)
{
struct filter_type *filter_type;
@ -2389,7 +2389,7 @@ pevent_filter_make_string(struct event_filter *filter, int event_id)
}
/**
* pevent_filter_compare - compare two filters and return if they are the same
* tep_filter_compare - compare two filters and return if they are the same
* @filter1: Filter to compare with @filter2
* @filter2: Filter to compare with @filter1
*
@ -2397,7 +2397,7 @@ pevent_filter_make_string(struct event_filter *filter, int event_id)
* 1 if the two filters hold the same content.
* 0 if they do not.
*/
int pevent_filter_compare(struct event_filter *filter1, struct event_filter *filter2)
int tep_filter_compare(struct event_filter *filter1, struct event_filter *filter2)
{
struct filter_type *filter_type1;
struct filter_type *filter_type2;

View file

@ -25,19 +25,19 @@ process___le16_to_cpup(struct trace_seq *s, unsigned long long *args)
return val ? (long long) le16toh(*val) : 0;
}
int PEVENT_PLUGIN_LOADER(struct pevent *pevent)
int TEP_PLUGIN_LOADER(struct tep_handle *pevent)
{
pevent_register_print_function(pevent,
process___le16_to_cpup,
PEVENT_FUNC_ARG_INT,
"__le16_to_cpup",
PEVENT_FUNC_ARG_PTR,
PEVENT_FUNC_ARG_VOID);
tep_register_print_function(pevent,
process___le16_to_cpup,
TEP_FUNC_ARG_INT,
"__le16_to_cpup",
TEP_FUNC_ARG_PTR,
TEP_FUNC_ARG_VOID);
return 0;
}
void PEVENT_PLUGIN_UNLOADER(struct pevent *pevent)
void TEP_PLUGIN_UNLOADER(struct tep_handle *pevent)
{
pevent_unregister_print_function(pevent, process___le16_to_cpup,
"__le16_to_cpup");
tep_unregister_print_function(pevent, process___le16_to_cpup,
"__le16_to_cpup");
}

View file

@ -33,7 +33,7 @@ static int cpus = -1;
#define STK_BLK 10
struct pevent_plugin_option plugin_options[] =
struct tep_plugin_option plugin_options[] =
{
{
.name = "parent",
@ -53,8 +53,8 @@ struct pevent_plugin_option plugin_options[] =
}
};
static struct pevent_plugin_option *ftrace_parent = &plugin_options[0];
static struct pevent_plugin_option *ftrace_indent = &plugin_options[1];
static struct tep_plugin_option *ftrace_parent = &plugin_options[0];
static struct tep_plugin_option *ftrace_indent = &plugin_options[1];
static void add_child(struct func_stack *stack, const char *child, int pos)
{
@ -122,25 +122,25 @@ static int add_and_get_index(const char *parent, const char *child, int cpu)
return 0;
}
static int function_handler(struct trace_seq *s, struct pevent_record *record,
static int function_handler(struct trace_seq *s, struct tep_record *record,
struct event_format *event, void *context)
{
struct pevent *pevent = event->pevent;
struct tep_handle *pevent = event->pevent;
unsigned long long function;
unsigned long long pfunction;
const char *func;
const char *parent;
int index = 0;
if (pevent_get_field_val(s, event, "ip", record, &function, 1))
if (tep_get_field_val(s, event, "ip", record, &function, 1))
return trace_seq_putc(s, '!');
func = pevent_find_function(pevent, function);
func = tep_find_function(pevent, function);
if (pevent_get_field_val(s, event, "parent_ip", record, &pfunction, 1))
if (tep_get_field_val(s, event, "parent_ip", record, &pfunction, 1))
return trace_seq_putc(s, '!');
parent = pevent_find_function(pevent, pfunction);
parent = tep_find_function(pevent, pfunction);
if (parent && ftrace_indent->set)
index = add_and_get_index(parent, func, record->cpu);
@ -163,22 +163,22 @@ static int function_handler(struct trace_seq *s, struct pevent_record *record,
return 0;
}
int PEVENT_PLUGIN_LOADER(struct pevent *pevent)
int TEP_PLUGIN_LOADER(struct tep_handle *pevent)
{
pevent_register_event_handler(pevent, -1, "ftrace", "function",
function_handler, NULL);
tep_register_event_handler(pevent, -1, "ftrace", "function",
function_handler, NULL);
traceevent_plugin_add_options("ftrace", plugin_options);
tep_plugin_add_options("ftrace", plugin_options);
return 0;
}
void PEVENT_PLUGIN_UNLOADER(struct pevent *pevent)
void TEP_PLUGIN_UNLOADER(struct tep_handle *pevent)
{
int i, x;
pevent_unregister_event_handler(pevent, -1, "ftrace", "function",
function_handler, NULL);
tep_unregister_event_handler(pevent, -1, "ftrace", "function",
function_handler, NULL);
for (i = 0; i <= cpus; i++) {
for (x = 0; x < fstack[i].size && fstack[i].stack[x]; x++)
@ -186,7 +186,7 @@ void PEVENT_PLUGIN_UNLOADER(struct pevent *pevent)
free(fstack[i].stack);
}
traceevent_plugin_remove_options(plugin_options);
tep_plugin_remove_options(plugin_options);
free(fstack);
fstack = NULL;

View file

@ -25,64 +25,64 @@
#include "event-parse.h"
static int timer_expire_handler(struct trace_seq *s,
struct pevent_record *record,
struct tep_record *record,
struct event_format *event, void *context)
{
trace_seq_printf(s, "hrtimer=");
if (pevent_print_num_field(s, "0x%llx", event, "timer",
record, 0) == -1)
pevent_print_num_field(s, "0x%llx", event, "hrtimer",
record, 1);
if (tep_print_num_field(s, "0x%llx", event, "timer",
record, 0) == -1)
tep_print_num_field(s, "0x%llx", event, "hrtimer",
record, 1);
trace_seq_printf(s, " now=");
pevent_print_num_field(s, "%llu", event, "now", record, 1);
tep_print_num_field(s, "%llu", event, "now", record, 1);
pevent_print_func_field(s, " function=%s", event, "function",
tep_print_func_field(s, " function=%s", event, "function",
record, 0);
return 0;
}
static int timer_start_handler(struct trace_seq *s,
struct pevent_record *record,
struct tep_record *record,
struct event_format *event, void *context)
{
trace_seq_printf(s, "hrtimer=");
if (pevent_print_num_field(s, "0x%llx", event, "timer",
record, 0) == -1)
pevent_print_num_field(s, "0x%llx", event, "hrtimer",
record, 1);
if (tep_print_num_field(s, "0x%llx", event, "timer",
record, 0) == -1)
tep_print_num_field(s, "0x%llx", event, "hrtimer",
record, 1);
pevent_print_func_field(s, " function=%s", event, "function",
record, 0);
tep_print_func_field(s, " function=%s", event, "function",
record, 0);
trace_seq_printf(s, " expires=");
pevent_print_num_field(s, "%llu", event, "expires", record, 1);
tep_print_num_field(s, "%llu", event, "expires", record, 1);
trace_seq_printf(s, " softexpires=");
pevent_print_num_field(s, "%llu", event, "softexpires", record, 1);
tep_print_num_field(s, "%llu", event, "softexpires", record, 1);
return 0;
}
int PEVENT_PLUGIN_LOADER(struct pevent *pevent)
int TEP_PLUGIN_LOADER(struct tep_handle *pevent)
{
pevent_register_event_handler(pevent, -1,
"timer", "hrtimer_expire_entry",
timer_expire_handler, NULL);
tep_register_event_handler(pevent, -1,
"timer", "hrtimer_expire_entry",
timer_expire_handler, NULL);
pevent_register_event_handler(pevent, -1, "timer", "hrtimer_start",
timer_start_handler, NULL);
tep_register_event_handler(pevent, -1, "timer", "hrtimer_start",
timer_start_handler, NULL);
return 0;
}
void PEVENT_PLUGIN_UNLOADER(struct pevent *pevent)
void TEP_PLUGIN_UNLOADER(struct tep_handle *pevent)
{
pevent_unregister_event_handler(pevent, -1,
"timer", "hrtimer_expire_entry",
timer_expire_handler, NULL);
tep_unregister_event_handler(pevent, -1,
"timer", "hrtimer_expire_entry",
timer_expire_handler, NULL);
pevent_unregister_event_handler(pevent, -1, "timer", "hrtimer_start",
timer_start_handler, NULL);
tep_unregister_event_handler(pevent, -1, "timer", "hrtimer_start",
timer_start_handler, NULL);
}

View file

@ -47,29 +47,29 @@ process_jiffies_to_msecs(struct trace_seq *s, unsigned long long *args)
return jiffies;
}
int PEVENT_PLUGIN_LOADER(struct pevent *pevent)
int TEP_PLUGIN_LOADER(struct tep_handle *pevent)
{
pevent_register_print_function(pevent,
process_jbd2_dev_to_name,
PEVENT_FUNC_ARG_STRING,
"jbd2_dev_to_name",
PEVENT_FUNC_ARG_INT,
PEVENT_FUNC_ARG_VOID);
tep_register_print_function(pevent,
process_jbd2_dev_to_name,
TEP_FUNC_ARG_STRING,
"jbd2_dev_to_name",
TEP_FUNC_ARG_INT,
TEP_FUNC_ARG_VOID);
pevent_register_print_function(pevent,
process_jiffies_to_msecs,
PEVENT_FUNC_ARG_LONG,
"jiffies_to_msecs",
PEVENT_FUNC_ARG_LONG,
PEVENT_FUNC_ARG_VOID);
tep_register_print_function(pevent,
process_jiffies_to_msecs,
TEP_FUNC_ARG_LONG,
"jiffies_to_msecs",
TEP_FUNC_ARG_LONG,
TEP_FUNC_ARG_VOID);
return 0;
}
void PEVENT_PLUGIN_UNLOADER(struct pevent *pevent)
void TEP_PLUGIN_UNLOADER(struct tep_handle *pevent)
{
pevent_unregister_print_function(pevent, process_jbd2_dev_to_name,
"jbd2_dev_to_name");
tep_unregister_print_function(pevent, process_jbd2_dev_to_name,
"jbd2_dev_to_name");
pevent_unregister_print_function(pevent, process_jiffies_to_msecs,
"jiffies_to_msecs");
tep_unregister_print_function(pevent, process_jiffies_to_msecs,
"jiffies_to_msecs");
}

View file

@ -23,7 +23,7 @@
#include "event-parse.h"
static int call_site_handler(struct trace_seq *s, struct pevent_record *record,
static int call_site_handler(struct trace_seq *s, struct tep_record *record,
struct event_format *event, void *context)
{
struct format_field *field;
@ -31,64 +31,64 @@ static int call_site_handler(struct trace_seq *s, struct pevent_record *record,
void *data = record->data;
const char *func;
field = pevent_find_field(event, "call_site");
field = tep_find_field(event, "call_site");
if (!field)
return 1;
if (pevent_read_number_field(field, data, &val))
if (tep_read_number_field(field, data, &val))
return 1;
func = pevent_find_function(event->pevent, val);
func = tep_find_function(event->pevent, val);
if (!func)
return 1;
addr = pevent_find_function_address(event->pevent, val);
addr = tep_find_function_address(event->pevent, val);
trace_seq_printf(s, "(%s+0x%x) ", func, (int)(val - addr));
return 1;
}
int PEVENT_PLUGIN_LOADER(struct pevent *pevent)
int TEP_PLUGIN_LOADER(struct tep_handle *pevent)
{
pevent_register_event_handler(pevent, -1, "kmem", "kfree",
call_site_handler, NULL);
tep_register_event_handler(pevent, -1, "kmem", "kfree",
call_site_handler, NULL);
pevent_register_event_handler(pevent, -1, "kmem", "kmalloc",
call_site_handler, NULL);
tep_register_event_handler(pevent, -1, "kmem", "kmalloc",
call_site_handler, NULL);
pevent_register_event_handler(pevent, -1, "kmem", "kmalloc_node",
call_site_handler, NULL);
tep_register_event_handler(pevent, -1, "kmem", "kmalloc_node",
call_site_handler, NULL);
pevent_register_event_handler(pevent, -1, "kmem", "kmem_cache_alloc",
call_site_handler, NULL);
tep_register_event_handler(pevent, -1, "kmem", "kmem_cache_alloc",
call_site_handler, NULL);
pevent_register_event_handler(pevent, -1, "kmem",
"kmem_cache_alloc_node",
call_site_handler, NULL);
tep_register_event_handler(pevent, -1, "kmem",
"kmem_cache_alloc_node",
call_site_handler, NULL);
pevent_register_event_handler(pevent, -1, "kmem", "kmem_cache_free",
call_site_handler, NULL);
tep_register_event_handler(pevent, -1, "kmem", "kmem_cache_free",
call_site_handler, NULL);
return 0;
}
void PEVENT_PLUGIN_UNLOADER(struct pevent *pevent)
void TEP_PLUGIN_UNLOADER(struct tep_handle *pevent)
{
pevent_unregister_event_handler(pevent, -1, "kmem", "kfree",
call_site_handler, NULL);
tep_unregister_event_handler(pevent, -1, "kmem", "kfree",
call_site_handler, NULL);
pevent_unregister_event_handler(pevent, -1, "kmem", "kmalloc",
call_site_handler, NULL);
tep_unregister_event_handler(pevent, -1, "kmem", "kmalloc",
call_site_handler, NULL);
pevent_unregister_event_handler(pevent, -1, "kmem", "kmalloc_node",
call_site_handler, NULL);
tep_unregister_event_handler(pevent, -1, "kmem", "kmalloc_node",
call_site_handler, NULL);
pevent_unregister_event_handler(pevent, -1, "kmem", "kmem_cache_alloc",
call_site_handler, NULL);
tep_unregister_event_handler(pevent, -1, "kmem", "kmem_cache_alloc",
call_site_handler, NULL);
pevent_unregister_event_handler(pevent, -1, "kmem",
"kmem_cache_alloc_node",
call_site_handler, NULL);
tep_unregister_event_handler(pevent, -1, "kmem",
"kmem_cache_alloc_node",
call_site_handler, NULL);
pevent_unregister_event_handler(pevent, -1, "kmem", "kmem_cache_free",
call_site_handler, NULL);
tep_unregister_event_handler(pevent, -1, "kmem", "kmem_cache_free",
call_site_handler, NULL);
}

View file

@ -247,17 +247,17 @@ static const char *find_exit_reason(unsigned isa, int val)
return strings[i].str;
}
static int print_exit_reason(struct trace_seq *s, struct pevent_record *record,
static int print_exit_reason(struct trace_seq *s, struct tep_record *record,
struct event_format *event, const char *field)
{
unsigned long long isa;
unsigned long long val;
const char *reason;
if (pevent_get_field_val(s, event, field, record, &val, 1) < 0)
if (tep_get_field_val(s, event, field, record, &val, 1) < 0)
return -1;
if (pevent_get_field_val(s, event, "isa", record, &isa, 0) < 0)
if (tep_get_field_val(s, event, "isa", record, &isa, 0) < 0)
isa = 1;
reason = find_exit_reason(isa, val);
@ -268,7 +268,7 @@ static int print_exit_reason(struct trace_seq *s, struct pevent_record *record,
return 0;
}
static int kvm_exit_handler(struct trace_seq *s, struct pevent_record *record,
static int kvm_exit_handler(struct trace_seq *s, struct tep_record *record,
struct event_format *event, void *context)
{
unsigned long long info1 = 0, info2 = 0;
@ -276,10 +276,10 @@ static int kvm_exit_handler(struct trace_seq *s, struct pevent_record *record,
if (print_exit_reason(s, record, event, "exit_reason") < 0)
return -1;
pevent_print_num_field(s, " rip 0x%lx", event, "guest_rip", record, 1);
tep_print_num_field(s, " rip 0x%lx", event, "guest_rip", record, 1);
if (pevent_get_field_val(s, event, "info1", record, &info1, 0) >= 0
&& pevent_get_field_val(s, event, "info2", record, &info2, 0) >= 0)
if (tep_get_field_val(s, event, "info1", record, &info1, 0) >= 0
&& tep_get_field_val(s, event, "info2", record, &info2, 0) >= 0)
trace_seq_printf(s, " info %llx %llx", info1, info2);
return 0;
@ -291,7 +291,7 @@ static int kvm_exit_handler(struct trace_seq *s, struct pevent_record *record,
#define KVM_EMUL_INSN_F_CS_L (1 << 3)
static int kvm_emulate_insn_handler(struct trace_seq *s,
struct pevent_record *record,
struct tep_record *record,
struct event_format *event, void *context)
{
unsigned long long rip, csbase, len, flags, failed;
@ -299,22 +299,22 @@ static int kvm_emulate_insn_handler(struct trace_seq *s,
uint8_t *insn;
const char *disasm;
if (pevent_get_field_val(s, event, "rip", record, &rip, 1) < 0)
if (tep_get_field_val(s, event, "rip", record, &rip, 1) < 0)
return -1;
if (pevent_get_field_val(s, event, "csbase", record, &csbase, 1) < 0)
if (tep_get_field_val(s, event, "csbase", record, &csbase, 1) < 0)
return -1;
if (pevent_get_field_val(s, event, "len", record, &len, 1) < 0)
if (tep_get_field_val(s, event, "len", record, &len, 1) < 0)
return -1;
if (pevent_get_field_val(s, event, "flags", record, &flags, 1) < 0)
if (tep_get_field_val(s, event, "flags", record, &flags, 1) < 0)
return -1;
if (pevent_get_field_val(s, event, "failed", record, &failed, 1) < 0)
if (tep_get_field_val(s, event, "failed", record, &failed, 1) < 0)
return -1;
insn = pevent_get_field_raw(s, event, "insn", record, &llen, 1);
insn = tep_get_field_raw(s, event, "insn", record, &llen, 1);
if (!insn)
return -1;
@ -330,24 +330,24 @@ static int kvm_emulate_insn_handler(struct trace_seq *s,
}
static int kvm_nested_vmexit_inject_handler(struct trace_seq *s, struct pevent_record *record,
static int kvm_nested_vmexit_inject_handler(struct trace_seq *s, struct tep_record *record,
struct event_format *event, void *context)
{
if (print_exit_reason(s, record, event, "exit_code") < 0)
return -1;
pevent_print_num_field(s, " info1 %llx", event, "exit_info1", record, 1);
pevent_print_num_field(s, " info2 %llx", event, "exit_info2", record, 1);
pevent_print_num_field(s, " int_info %llx", event, "exit_int_info", record, 1);
pevent_print_num_field(s, " int_info_err %llx", event, "exit_int_info_err", record, 1);
tep_print_num_field(s, " info1 %llx", event, "exit_info1", record, 1);
tep_print_num_field(s, " info2 %llx", event, "exit_info2", record, 1);
tep_print_num_field(s, " int_info %llx", event, "exit_int_info", record, 1);
tep_print_num_field(s, " int_info_err %llx", event, "exit_int_info_err", record, 1);
return 0;
}
static int kvm_nested_vmexit_handler(struct trace_seq *s, struct pevent_record *record,
static int kvm_nested_vmexit_handler(struct trace_seq *s, struct tep_record *record,
struct event_format *event, void *context)
{
pevent_print_num_field(s, "rip %llx ", event, "rip", record, 1);
tep_print_num_field(s, "rip %llx ", event, "rip", record, 1);
return kvm_nested_vmexit_inject_handler(s, record, event, context);
}
@ -370,7 +370,7 @@ union kvm_mmu_page_role {
};
};
static int kvm_mmu_print_role(struct trace_seq *s, struct pevent_record *record,
static int kvm_mmu_print_role(struct trace_seq *s, struct tep_record *record,
struct event_format *event, void *context)
{
unsigned long long val;
@ -379,7 +379,7 @@ static int kvm_mmu_print_role(struct trace_seq *s, struct pevent_record *record,
};
union kvm_mmu_page_role role;
if (pevent_get_field_val(s, event, "role", record, &val, 1) < 0)
if (tep_get_field_val(s, event, "role", record, &val, 1) < 0)
return -1;
role.word = (int)val;
@ -388,8 +388,8 @@ static int kvm_mmu_print_role(struct trace_seq *s, struct pevent_record *record,
* We can only use the structure if file is of the same
* endianess.
*/
if (pevent_is_file_bigendian(event->pevent) ==
pevent_is_host_bigendian(event->pevent)) {
if (tep_is_file_bigendian(event->pevent) ==
tep_is_host_bigendian(event->pevent)) {
trace_seq_printf(s, "%u q%u%s %s%s %spae %snxe %swp%s%s%s",
role.level,
@ -406,10 +406,10 @@ static int kvm_mmu_print_role(struct trace_seq *s, struct pevent_record *record,
} else
trace_seq_printf(s, "WORD: %08x", role.word);
pevent_print_num_field(s, " root %u ", event,
"root_count", record, 1);
tep_print_num_field(s, " root %u ", event,
"root_count", record, 1);
if (pevent_get_field_val(s, event, "unsync", record, &val, 1) < 0)
if (tep_get_field_val(s, event, "unsync", record, &val, 1) < 0)
return -1;
trace_seq_printf(s, "%s%c", val ? "unsync" : "sync", 0);
@ -417,17 +417,17 @@ static int kvm_mmu_print_role(struct trace_seq *s, struct pevent_record *record,
}
static int kvm_mmu_get_page_handler(struct trace_seq *s,
struct pevent_record *record,
struct tep_record *record,
struct event_format *event, void *context)
{
unsigned long long val;
if (pevent_get_field_val(s, event, "created", record, &val, 1) < 0)
if (tep_get_field_val(s, event, "created", record, &val, 1) < 0)
return -1;
trace_seq_printf(s, "%s ", val ? "new" : "existing");
if (pevent_get_field_val(s, event, "gfn", record, &val, 1) < 0)
if (tep_get_field_val(s, event, "gfn", record, &val, 1) < 0)
return -1;
trace_seq_printf(s, "sp gfn %llx ", val);
@ -444,79 +444,79 @@ process_is_writable_pte(struct trace_seq *s, unsigned long long *args)
return pte & PT_WRITABLE_MASK;
}
int PEVENT_PLUGIN_LOADER(struct pevent *pevent)
int TEP_PLUGIN_LOADER(struct tep_handle *pevent)
{
init_disassembler();
pevent_register_event_handler(pevent, -1, "kvm", "kvm_exit",
kvm_exit_handler, NULL);
tep_register_event_handler(pevent, -1, "kvm", "kvm_exit",
kvm_exit_handler, NULL);
pevent_register_event_handler(pevent, -1, "kvm", "kvm_emulate_insn",
kvm_emulate_insn_handler, NULL);
tep_register_event_handler(pevent, -1, "kvm", "kvm_emulate_insn",
kvm_emulate_insn_handler, NULL);
pevent_register_event_handler(pevent, -1, "kvm", "kvm_nested_vmexit",
kvm_nested_vmexit_handler, NULL);
tep_register_event_handler(pevent, -1, "kvm", "kvm_nested_vmexit",
kvm_nested_vmexit_handler, NULL);
pevent_register_event_handler(pevent, -1, "kvm", "kvm_nested_vmexit_inject",
kvm_nested_vmexit_inject_handler, NULL);
tep_register_event_handler(pevent, -1, "kvm", "kvm_nested_vmexit_inject",
kvm_nested_vmexit_inject_handler, NULL);
pevent_register_event_handler(pevent, -1, "kvmmmu", "kvm_mmu_get_page",
kvm_mmu_get_page_handler, NULL);
tep_register_event_handler(pevent, -1, "kvmmmu", "kvm_mmu_get_page",
kvm_mmu_get_page_handler, NULL);
pevent_register_event_handler(pevent, -1, "kvmmmu", "kvm_mmu_sync_page",
kvm_mmu_print_role, NULL);
tep_register_event_handler(pevent, -1, "kvmmmu", "kvm_mmu_sync_page",
kvm_mmu_print_role, NULL);
pevent_register_event_handler(pevent, -1,
"kvmmmu", "kvm_mmu_unsync_page",
kvm_mmu_print_role, NULL);
tep_register_event_handler(pevent, -1,
"kvmmmu", "kvm_mmu_unsync_page",
kvm_mmu_print_role, NULL);
pevent_register_event_handler(pevent, -1, "kvmmmu", "kvm_mmu_zap_page",
kvm_mmu_print_role, NULL);
tep_register_event_handler(pevent, -1, "kvmmmu", "kvm_mmu_zap_page",
kvm_mmu_print_role, NULL);
pevent_register_event_handler(pevent, -1, "kvmmmu",
tep_register_event_handler(pevent, -1, "kvmmmu",
"kvm_mmu_prepare_zap_page", kvm_mmu_print_role,
NULL);
pevent_register_print_function(pevent,
process_is_writable_pte,
PEVENT_FUNC_ARG_INT,
"is_writable_pte",
PEVENT_FUNC_ARG_LONG,
PEVENT_FUNC_ARG_VOID);
tep_register_print_function(pevent,
process_is_writable_pte,
TEP_FUNC_ARG_INT,
"is_writable_pte",
TEP_FUNC_ARG_LONG,
TEP_FUNC_ARG_VOID);
return 0;
}
void PEVENT_PLUGIN_UNLOADER(struct pevent *pevent)
void TEP_PLUGIN_UNLOADER(struct tep_handle *pevent)
{
pevent_unregister_event_handler(pevent, -1, "kvm", "kvm_exit",
kvm_exit_handler, NULL);
tep_unregister_event_handler(pevent, -1, "kvm", "kvm_exit",
kvm_exit_handler, NULL);
pevent_unregister_event_handler(pevent, -1, "kvm", "kvm_emulate_insn",
kvm_emulate_insn_handler, NULL);
tep_unregister_event_handler(pevent, -1, "kvm", "kvm_emulate_insn",
kvm_emulate_insn_handler, NULL);
pevent_unregister_event_handler(pevent, -1, "kvm", "kvm_nested_vmexit",
kvm_nested_vmexit_handler, NULL);
tep_unregister_event_handler(pevent, -1, "kvm", "kvm_nested_vmexit",
kvm_nested_vmexit_handler, NULL);
pevent_unregister_event_handler(pevent, -1, "kvm", "kvm_nested_vmexit_inject",
kvm_nested_vmexit_inject_handler, NULL);
tep_unregister_event_handler(pevent, -1, "kvm", "kvm_nested_vmexit_inject",
kvm_nested_vmexit_inject_handler, NULL);
pevent_unregister_event_handler(pevent, -1, "kvmmmu", "kvm_mmu_get_page",
kvm_mmu_get_page_handler, NULL);
tep_unregister_event_handler(pevent, -1, "kvmmmu", "kvm_mmu_get_page",
kvm_mmu_get_page_handler, NULL);
pevent_unregister_event_handler(pevent, -1, "kvmmmu", "kvm_mmu_sync_page",
kvm_mmu_print_role, NULL);
tep_unregister_event_handler(pevent, -1, "kvmmmu", "kvm_mmu_sync_page",
kvm_mmu_print_role, NULL);
pevent_unregister_event_handler(pevent, -1,
"kvmmmu", "kvm_mmu_unsync_page",
kvm_mmu_print_role, NULL);
tep_unregister_event_handler(pevent, -1,
"kvmmmu", "kvm_mmu_unsync_page",
kvm_mmu_print_role, NULL);
pevent_unregister_event_handler(pevent, -1, "kvmmmu", "kvm_mmu_zap_page",
kvm_mmu_print_role, NULL);
tep_unregister_event_handler(pevent, -1, "kvmmmu", "kvm_mmu_zap_page",
kvm_mmu_print_role, NULL);
pevent_unregister_event_handler(pevent, -1, "kvmmmu",
tep_unregister_event_handler(pevent, -1, "kvmmmu",
"kvm_mmu_prepare_zap_page", kvm_mmu_print_role,
NULL);
pevent_unregister_print_function(pevent, process_is_writable_pte,
"is_writable_pte");
tep_unregister_print_function(pevent, process_is_writable_pte,
"is_writable_pte");
}

View file

@ -28,7 +28,7 @@
static void print_string(struct trace_seq *s, struct event_format *event,
const char *name, const void *data)
{
struct format_field *f = pevent_find_field(event, name);
struct format_field *f = tep_find_field(event, name);
int offset;
int length;
@ -42,7 +42,7 @@ static void print_string(struct trace_seq *s, struct event_format *event,
if (!strncmp(f->type, "__data_loc", 10)) {
unsigned long long v;
if (pevent_read_number_field(f, data, &v)) {
if (tep_read_number_field(f, data, &v)) {
trace_seq_printf(s, "invalid_data_loc");
return;
}
@ -53,12 +53,12 @@ static void print_string(struct trace_seq *s, struct event_format *event,
trace_seq_printf(s, "%.*s", length, (char *)data + offset);
}
#define SF(fn) pevent_print_num_field(s, fn ":%d", event, fn, record, 0)
#define SFX(fn) pevent_print_num_field(s, fn ":%#x", event, fn, record, 0)
#define SF(fn) tep_print_num_field(s, fn ":%d", event, fn, record, 0)
#define SFX(fn) tep_print_num_field(s, fn ":%#x", event, fn, record, 0)
#define SP() trace_seq_putc(s, ' ')
static int drv_bss_info_changed(struct trace_seq *s,
struct pevent_record *record,
struct tep_record *record,
struct event_format *event, void *context)
{
void *data = record->data;
@ -66,7 +66,7 @@ static int drv_bss_info_changed(struct trace_seq *s,
print_string(s, event, "wiphy_name", data);
trace_seq_printf(s, " vif:");
print_string(s, event, "vif_name", data);
pevent_print_num_field(s, "(%d)", event, "vif_type", record, 1);
tep_print_num_field(s, "(%d)", event, "vif_type", record, 1);
trace_seq_printf(s, "\n%*s", INDENT, "");
SF("assoc"); SP();
@ -86,17 +86,17 @@ static int drv_bss_info_changed(struct trace_seq *s,
return 0;
}
int PEVENT_PLUGIN_LOADER(struct pevent *pevent)
int TEP_PLUGIN_LOADER(struct tep_handle *pevent)
{
pevent_register_event_handler(pevent, -1, "mac80211",
"drv_bss_info_changed",
drv_bss_info_changed, NULL);
tep_register_event_handler(pevent, -1, "mac80211",
"drv_bss_info_changed",
drv_bss_info_changed, NULL);
return 0;
}
void PEVENT_PLUGIN_UNLOADER(struct pevent *pevent)
void TEP_PLUGIN_UNLOADER(struct tep_handle *pevent)
{
pevent_unregister_event_handler(pevent, -1, "mac80211",
"drv_bss_info_changed",
drv_bss_info_changed, NULL);
tep_unregister_event_handler(pevent, -1, "mac80211",
"drv_bss_info_changed",
drv_bss_info_changed, NULL);
}

View file

@ -45,7 +45,7 @@ static void write_state(struct trace_seq *s, int val)
}
static void write_and_save_comm(struct format_field *field,
struct pevent_record *record,
struct tep_record *record,
struct trace_seq *s, int pid)
{
const char *comm;
@ -61,100 +61,100 @@ static void write_and_save_comm(struct format_field *field,
comm = &s->buffer[len];
/* Help out the comm to ids. This will handle dups */
pevent_register_comm(field->event->pevent, comm, pid);
tep_register_comm(field->event->pevent, comm, pid);
}
static int sched_wakeup_handler(struct trace_seq *s,
struct pevent_record *record,
struct tep_record *record,
struct event_format *event, void *context)
{
struct format_field *field;
unsigned long long val;
if (pevent_get_field_val(s, event, "pid", record, &val, 1))
if (tep_get_field_val(s, event, "pid", record, &val, 1))
return trace_seq_putc(s, '!');
field = pevent_find_any_field(event, "comm");
field = tep_find_any_field(event, "comm");
if (field) {
write_and_save_comm(field, record, s, val);
trace_seq_putc(s, ':');
}
trace_seq_printf(s, "%lld", val);
if (pevent_get_field_val(s, event, "prio", record, &val, 0) == 0)
if (tep_get_field_val(s, event, "prio", record, &val, 0) == 0)
trace_seq_printf(s, " [%lld]", val);
if (pevent_get_field_val(s, event, "success", record, &val, 1) == 0)
if (tep_get_field_val(s, event, "success", record, &val, 1) == 0)
trace_seq_printf(s, " success=%lld", val);
if (pevent_get_field_val(s, event, "target_cpu", record, &val, 0) == 0)
if (tep_get_field_val(s, event, "target_cpu", record, &val, 0) == 0)
trace_seq_printf(s, " CPU:%03llu", val);
return 0;
}
static int sched_switch_handler(struct trace_seq *s,
struct pevent_record *record,
struct tep_record *record,
struct event_format *event, void *context)
{
struct format_field *field;
unsigned long long val;
if (pevent_get_field_val(s, event, "prev_pid", record, &val, 1))
if (tep_get_field_val(s, event, "prev_pid", record, &val, 1))
return trace_seq_putc(s, '!');
field = pevent_find_any_field(event, "prev_comm");
field = tep_find_any_field(event, "prev_comm");
if (field) {
write_and_save_comm(field, record, s, val);
trace_seq_putc(s, ':');
}
trace_seq_printf(s, "%lld ", val);
if (pevent_get_field_val(s, event, "prev_prio", record, &val, 0) == 0)
if (tep_get_field_val(s, event, "prev_prio", record, &val, 0) == 0)
trace_seq_printf(s, "[%d] ", (int) val);
if (pevent_get_field_val(s, event, "prev_state", record, &val, 0) == 0)
if (tep_get_field_val(s, event, "prev_state", record, &val, 0) == 0)
write_state(s, val);
trace_seq_puts(s, " ==> ");
if (pevent_get_field_val(s, event, "next_pid", record, &val, 1))
if (tep_get_field_val(s, event, "next_pid", record, &val, 1))
return trace_seq_putc(s, '!');
field = pevent_find_any_field(event, "next_comm");
field = tep_find_any_field(event, "next_comm");
if (field) {
write_and_save_comm(field, record, s, val);
trace_seq_putc(s, ':');
}
trace_seq_printf(s, "%lld", val);
if (pevent_get_field_val(s, event, "next_prio", record, &val, 0) == 0)
if (tep_get_field_val(s, event, "next_prio", record, &val, 0) == 0)
trace_seq_printf(s, " [%d]", (int) val);
return 0;
}
int PEVENT_PLUGIN_LOADER(struct pevent *pevent)
int TEP_PLUGIN_LOADER(struct tep_handle *pevent)
{
pevent_register_event_handler(pevent, -1, "sched", "sched_switch",
sched_switch_handler, NULL);
tep_register_event_handler(pevent, -1, "sched", "sched_switch",
sched_switch_handler, NULL);
pevent_register_event_handler(pevent, -1, "sched", "sched_wakeup",
sched_wakeup_handler, NULL);
tep_register_event_handler(pevent, -1, "sched", "sched_wakeup",
sched_wakeup_handler, NULL);
pevent_register_event_handler(pevent, -1, "sched", "sched_wakeup_new",
sched_wakeup_handler, NULL);
tep_register_event_handler(pevent, -1, "sched", "sched_wakeup_new",
sched_wakeup_handler, NULL);
return 0;
}
void PEVENT_PLUGIN_UNLOADER(struct pevent *pevent)
void TEP_PLUGIN_UNLOADER(struct tep_handle *pevent)
{
pevent_unregister_event_handler(pevent, -1, "sched", "sched_switch",
sched_switch_handler, NULL);
tep_unregister_event_handler(pevent, -1, "sched", "sched_switch",
sched_switch_handler, NULL);
pevent_unregister_event_handler(pevent, -1, "sched", "sched_wakeup",
sched_wakeup_handler, NULL);
tep_unregister_event_handler(pevent, -1, "sched", "sched_wakeup",
sched_wakeup_handler, NULL);
pevent_unregister_event_handler(pevent, -1, "sched", "sched_wakeup_new",
sched_wakeup_handler, NULL);
tep_unregister_event_handler(pevent, -1, "sched", "sched_wakeup_new",
sched_wakeup_handler, NULL);
}

View file

@ -413,21 +413,21 @@ unsigned long long process_scsi_trace_parse_cdb(struct trace_seq *s,
return 0;
}
int PEVENT_PLUGIN_LOADER(struct pevent *pevent)
int TEP_PLUGIN_LOADER(struct tep_handle *pevent)
{
pevent_register_print_function(pevent,
process_scsi_trace_parse_cdb,
PEVENT_FUNC_ARG_STRING,
"scsi_trace_parse_cdb",
PEVENT_FUNC_ARG_PTR,
PEVENT_FUNC_ARG_PTR,
PEVENT_FUNC_ARG_INT,
PEVENT_FUNC_ARG_VOID);
tep_register_print_function(pevent,
process_scsi_trace_parse_cdb,
TEP_FUNC_ARG_STRING,
"scsi_trace_parse_cdb",
TEP_FUNC_ARG_PTR,
TEP_FUNC_ARG_PTR,
TEP_FUNC_ARG_INT,
TEP_FUNC_ARG_VOID);
return 0;
}
void PEVENT_PLUGIN_UNLOADER(struct pevent *pevent)
void TEP_PLUGIN_UNLOADER(struct tep_handle *pevent)
{
pevent_unregister_print_function(pevent, process_scsi_trace_parse_cdb,
"scsi_trace_parse_cdb");
tep_unregister_print_function(pevent, process_scsi_trace_parse_cdb,
"scsi_trace_parse_cdb");
}

View file

@ -119,19 +119,19 @@ unsigned long long process_xen_hypercall_name(struct trace_seq *s,
return 0;
}
int PEVENT_PLUGIN_LOADER(struct pevent *pevent)
int TEP_PLUGIN_LOADER(struct tep_handle *pevent)
{
pevent_register_print_function(pevent,
process_xen_hypercall_name,
PEVENT_FUNC_ARG_STRING,
"xen_hypercall_name",
PEVENT_FUNC_ARG_INT,
PEVENT_FUNC_ARG_VOID);
tep_register_print_function(pevent,
process_xen_hypercall_name,
TEP_FUNC_ARG_STRING,
"xen_hypercall_name",
TEP_FUNC_ARG_INT,
TEP_FUNC_ARG_VOID);
return 0;
}
void PEVENT_PLUGIN_UNLOADER(struct pevent *pevent)
void TEP_PLUGIN_UNLOADER(struct tep_handle *pevent)
{
pevent_unregister_print_function(pevent, process_xen_hypercall_name,
"xen_hypercall_name");
tep_unregister_print_function(pevent, process_xen_hypercall_name,
"xen_hypercall_name");
}