00001 00013 #ifndef OPD_SFILE_H 00014 #define OPD_SFILE_H 00015 00016 #include "operf_utils.h" 00017 #include "odb.h" 00018 #include "op_hw_config.h" 00019 #include "op_types.h" 00020 #include "op_list.h" 00021 #include "operf_process_info.h" 00022 00023 #include <sys/types.h> 00024 00025 struct operf_transient; 00026 struct operf_kernel_image; 00027 00028 #define CG_HASH_SIZE 16 00029 #define INVALID_IMAGE "INVALID IMAGE" 00030 00031 #define VMA_SHIFT 13 00032 00039 struct operf_sfile { 00041 unsigned long hashval; 00042 const char * image_name; 00043 const char * app_filename; 00044 size_t image_len, app_len; 00046 pid_t tid; 00048 pid_t tgid; 00050 unsigned int cpu; 00052 struct operf_kernel_image * kernel; 00053 bool is_anon; 00054 vma_t start_addr; 00055 vma_t end_addr; 00056 00058 struct list_head hash; 00060 struct list_head lru; 00062 int ignored; 00064 odb_t files[OP_MAX_COUNTERS]; 00066 odb_t * ext_files; 00068 struct list_head cg_hash[CG_HASH_SIZE]; 00069 }; 00070 00072 struct operf_cg_entry { 00074 struct operf_sfile to; 00076 struct list_head hash; 00077 }; 00078 00085 struct operf_transient { 00086 struct operf_sfile * current; 00087 struct operf_sfile * last; 00088 bool is_anon; 00089 operf_process_info * cur_procinfo; 00090 vma_t pc; 00091 const char * image_name; 00092 const char * app_filename; 00093 size_t image_len, app_len; 00094 vma_t last_pc; 00095 int event; 00096 u64 sample_id; 00097 int in_kernel; 00098 unsigned long cpu; 00099 u32 tid; 00100 u32 tgid; 00101 vma_t start_addr; 00102 vma_t end_addr; 00103 bool cg; 00104 // TODO: handle extended 00105 //void * ext; 00106 }; 00107 00108 00110 void operf_sfile_clear_kernel(void); 00111 00113 void operf_sfile_sync_files(void); 00114 00116 void operf_sfile_close_files(void); 00117 00120 int operf_sfile_lru_clear(void); 00121 00123 void operf_sfile_get(struct operf_sfile * sf); 00124 00126 void operf_sfile_put(struct operf_sfile * sf); 00127 00132 struct operf_sfile * operf_sfile_find(struct operf_transient const * trans); 00133 00135 void operf_sfile_log_sample(struct operf_transient const * trans); 00136 00138 void operf_sfile_log_sample_count(struct operf_transient const * trans, 00139 unsigned long int count); 00140 00142 void operf_sfile_log_arc(struct operf_transient const * trans); 00143 00145 void operf_sfile_init(void); 00146 00147 #endif /* OPD_SFILE_H */