00001 00016 #ifndef OPD_TRANS_H 00017 #define OPD_TRANS_H 00018 00019 #include "opd_cookie.h" 00020 #include "op_types.h" 00021 00022 #include <stdint.h> 00023 00024 struct sfile; 00025 struct anon_mapping; 00026 00027 enum tracing_type { 00028 TRACING_OFF, 00029 TRACING_START, 00030 TRACING_ON 00031 }; 00032 00039 struct transient { 00040 char const * buffer; 00041 size_t remaining; 00042 enum tracing_type tracing; 00043 struct sfile * current; 00044 struct sfile * last; 00045 struct anon_mapping * anon; 00046 struct anon_mapping * last_anon; 00047 cookie_t cookie; 00048 cookie_t app_cookie; 00049 vma_t pc; 00050 vma_t last_pc; 00051 unsigned long event; 00052 int in_kernel; 00053 unsigned long cpu; 00054 pid_t tid; 00055 pid_t tgid; 00056 uint64_t embedded_offset; 00057 void * ext; 00058 }; 00059 00060 typedef void (*handler_t)(struct transient *); 00061 extern handler_t handlers[]; 00062 00063 uint64_t pop_buffer_value(struct transient * trans); 00064 int enough_remaining(struct transient * trans, size_t size); 00065 static inline void update_trans_last(struct transient * trans) 00066 { 00067 trans->last = trans->current; 00068 trans->last_anon = trans->anon; 00069 trans->last_pc = trans->pc; 00070 } 00071 00072 extern size_t kernel_pointer_size; 00073 static inline int is_escape_code(uint64_t code) 00074 { 00075 return kernel_pointer_size == 4 ? code == ~0LU : code == ~0LLU; 00076 } 00077 00078 void opd_process_samples(char const * buffer, size_t count); 00079 00081 void clear_trans_last(struct transient * trans); 00082 00084 void clear_trans_current(struct transient * trans); 00085 00086 #endif /* OPD_TRANS_H */