21 #ifndef _PARSE_EVENTS_H
22 #define _PARSE_EVENTS_H
27 #ifndef __maybe_unused
28 #define __maybe_unused __attribute__((unused))
34 #ifndef TRACE_SEQ_BUF_SIZE
35 #define TRACE_SEQ_BUF_SIZE 4096
39 #define DEBUG_RECORD 0
43 unsigned long long ts;
149 #define PEVENT_PLUGIN_LOADER pevent_plugin_loader
150 #define PEVENT_PLUGIN_UNLOADER pevent_plugin_unloader
151 #define PEVENT_PLUGIN_OPTIONS pevent_plugin_options
152 #define PEVENT_PLUGIN_ALIAS pevent_plugin_alias
153 #define _MAKE_STR(x) #x
154 #define MAKE_STR(x) _MAKE_STR(x)
155 #define PEVENT_PLUGIN_LOADER_NAME MAKE_STR(PEVENT_PLUGIN_LOADER)
156 #define PEVENT_PLUGIN_UNLOADER_NAME MAKE_STR(PEVENT_PLUGIN_UNLOADER)
157 #define PEVENT_PLUGIN_OPTIONS_NAME MAKE_STR(PEVENT_PLUGIN_OPTIONS)
158 #define PEVENT_PLUGIN_ALIAS_NAME MAKE_STR(PEVENT_PLUGIN_ALIAS)
160 #define NSECS_PER_SEC 1000000000ULL
161 #define NSECS_PER_USEC 1000ULL
333 unsigned long long *
args);
348 #define PEVENT_ERRORS \
349 _PE(MEM_ALLOC_FAILED, "failed to allocate memory"), \
350 _PE(PARSE_EVENT_FAILED, "failed to parse event"), \
351 _PE(READ_ID_FAILED, "failed to read event id"), \
352 _PE(READ_FORMAT_FAILED, "failed to read event format"), \
353 _PE(READ_PRINT_FAILED, "failed to read event print fmt"), \
354 _PE(OLD_FTRACE_ARG_FAILED,"failed to allocate field name for ftrace"),\
355 _PE(INVALID_ARG_TYPE, "invalid argument type")
358 #define _PE(__code, __str) PEVENT_ERRNO__ ## __code
459 static inline unsigned short
467 swap = ((data & 0xffULL) << 8) |
468 ((data & (0xffULL << 8)) >> 8);
473 static inline unsigned int
474 __data2host4(
struct pevent *pevent,
unsigned int data)
481 swap = ((data & 0xffULL) << 24) |
482 ((data & (0xffULL << 8)) << 8) |
483 ((data & (0xffULL << 16)) >> 8) |
484 ((data & (0xffULL << 24)) >> 24);
489 static inline unsigned long long
490 __data2host8(
struct pevent *pevent,
unsigned long long data)
492 unsigned long long swap;
497 swap = ((data & 0xffULL) << 56) |
498 ((data & (0xffULL << 8)) << 40) |
499 ((data & (0xffULL << 16)) << 24) |
500 ((data & (0xffULL << 24)) << 8) |
501 ((data & (0xffULL << 32)) >> 8) |
502 ((data & (0xffULL << 40)) >> 24) |
503 ((data & (0xffULL << 48)) >> 40) |
504 ((data & (0xffULL << 56)) >> 56);
509 #define data2host2(pevent, ptr) __data2host2(pevent, *(unsigned short *)(ptr))
510 #define data2host4(pevent, ptr) __data2host4(pevent, *(unsigned int *)(ptr))
511 #define data2host8(pevent, ptr) \
513 unsigned long long __val; \
515 memcpy(&__val, (ptr), sizeof(unsigned long long)); \
516 __data2host8(pevent, __val); \
530 unsigned long long addr,
char *
mod);
532 unsigned long long addr);
542 unsigned long size,
const char *
sys);
544 unsigned long size,
const char *
sys);
553 unsigned long long *
val,
int err);
556 unsigned long long *
val,
int err);
559 unsigned long long *
val,
int err);
581 unsigned long long *
value);
603 static inline int pevent_get_cpus(
struct pevent *pevent)
608 static inline void pevent_set_cpus(
struct pevent *pevent,
int cpus)
613 static inline int pevent_get_long_size(
struct pevent *pevent)
618 static inline void pevent_set_long_size(
struct pevent *pevent,
int long_size)
623 static inline int pevent_is_file_bigendian(
struct pevent *pevent)
628 static inline void pevent_set_file_bigendian(
struct pevent *pevent,
int endian)
633 static inline int pevent_is_host_bigendian(
struct pevent *pevent)
638 static inline void pevent_set_host_bigendian(
struct pevent *pevent,
int endian)
643 static inline int pevent_is_latency_format(
struct pevent *pevent)
648 static inline void pevent_set_latency_format(
struct pevent *pevent,
int lat)
800 #define FILTER_NONE -2
801 #define FILTER_NOEXIST -1
802 #define FILTER_MISS 0
803 #define FILTER_MATCH 1
812 const char *filter_str,