00001 00012 #ifndef SAMPLE_CONTAINER_H 00013 #define SAMPLE_CONTAINER_H 00014 00015 #include <map> 00016 #include <set> 00017 #include <string> 00018 00019 #include "symbol.h" 00020 #include "symbol_functors.h" 00021 00027 class sample_container { 00028 typedef std::pair<symbol_entry const *, bfd_vma> sample_index_t; 00029 public: 00030 typedef std::map<sample_index_t, sample_entry> samples_storage; 00031 typedef samples_storage::const_iterator samples_iterator; 00032 00034 samples_iterator begin(symbol_entry const *) const; 00036 samples_iterator end(symbol_entry const *) const; 00037 00039 samples_iterator begin() const; 00041 samples_iterator end() const; 00042 00045 void insert(symbol_entry const * symbol, sample_entry const &); 00046 00048 count_array_t accumulate_samples(debug_name_id filename_id) const; 00049 00051 count_array_t accumulate_samples(debug_name_id, size_t linenr) const; 00052 00054 sample_entry const * find_by_vma(symbol_entry const * symbol, 00055 bfd_vma vma) const; 00056 00057 private: 00059 void build_by_loc() const; 00060 00062 samples_storage samples; 00063 00064 typedef std::multiset<sample_entry const *, less_by_file_loc> 00065 samples_by_loc_t; 00066 00067 // must be declared after the samples_storage to ensure a 00068 // correct life-time. 00069 00074 mutable samples_by_loc_t samples_by_loc; 00075 }; 00076 00077 #endif /* SAMPLE_CONTAINER_H */