00001 /** 00002 * @file daemon/opd_trans.h 00003 * Processing the sample buffer 00004 * 00005 * @remark Copyright 2002 OProfile authors 00006 * @remark Read the file COPYING 00007 * 00008 * @author John Levon 00009 * @author Philippe Elie 00010 * 00011 * Modified by Maynard Johnson <maynardj@us.ibm.com> 00012 * These modifications are: 00013 * (C) Copyright IBM Corporation 2007 00014 */ 00015 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 00033 /** 00034 * Transient values used for parsing the event buffer. 00035 * Note that these are reset for each buffer read, but 00036 * that should be ok as in the kernel, cpu_buffer_reset() 00037 * ensures that a correct context starts off the buffer. 00038 */ 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 00080 /** used when we need to clear data that's been freed */ 00081 void clear_trans_last(struct transient * trans); 00082 00083 /** used when we need to clear data that's been freed */ 00084 void clear_trans_current(struct transient * trans); 00085 00086 #endif /* OPD_TRANS_H */
1.6.1