00001 00012 #ifndef SYMBOL_H 00013 #define SYMBOL_H 00014 00015 #include "config.h" 00016 #include "name_storage.h" 00017 #include "growable_vector.h" 00018 #include "sparse_array.h" 00019 #include "format_flags.h" 00020 #include "op_types.h" 00021 00022 #include <bfd.h> 00023 #include <stdint.h> 00024 00025 #include <list> 00026 00027 class extra_images; 00028 00029 00031 typedef sparse_array<u32, count_type> count_array_t; 00032 00033 00035 struct file_location { 00036 file_location() : linenr(0) {} 00038 debug_name_id filename; 00040 unsigned int linenr; 00041 00042 bool operator<(file_location const & rhs) const { 00043 // Note we sort on filename id not on string 00044 return filename < rhs.filename || 00045 (filename == rhs.filename && linenr < rhs.linenr); 00046 } 00047 }; 00048 00049 00051 struct sample_entry { 00052 sample_entry() : vma(0) {} 00054 file_location file_loc; 00056 bfd_vma vma; 00058 count_array_t counts; 00059 }; 00060 00061 00063 class symbol_entry { 00064 public: 00065 symbol_entry() : size(0) {} 00066 virtual ~symbol_entry() {} 00067 00069 image_name_id image_name; 00073 image_name_id app_name; 00074 // index into the op_bfd symbol table 00075 size_t sym_index; 00077 sample_entry sample; 00079 symbol_name_id name; 00081 size_t size; 00082 00090 column_flags output_hint(column_flags fl) const; 00091 uint64_t spu_offset; 00092 image_name_id embedding_filename; 00093 00103 bfd_vma vma_adj; 00104 }; 00105 00106 00108 typedef std::vector<symbol_entry const *> symbol_collection; 00109 00110 00116 class cg_symbol : public symbol_entry { 00117 public: 00118 cg_symbol(symbol_entry const & sym) : symbol_entry(sym) {} 00119 00120 typedef std::vector<symbol_entry> children; 00121 00123 children callers; 00125 count_array_t total_caller_count; 00126 00128 children callees; 00130 count_array_t total_callee_count; 00131 }; 00132 00134 typedef std::list<cg_symbol> cg_collection_objs; 00135 00137 typedef growable_vector<double> diff_array_t; 00138 00139 00143 struct diff_symbol : public symbol_entry { 00144 diff_symbol(symbol_entry const & sym) : symbol_entry(sym) {} 00145 00147 diff_array_t diffs; 00148 }; 00149 00150 00152 typedef std::vector<diff_symbol> diff_collection; 00153 00154 bool has_sample_counts(count_array_t const & counts, size_t lo, size_t hi); 00155 std::string const & get_image_name(image_name_id id, 00156 image_name_storage::image_name_type type, 00157 extra_images const & extra); 00158 00159 00160 #endif /* !SYMBOL_H */