callgraph_container.h
Go to the documentation of this file.00001
00012 #ifndef CALLGRAPH_CONTAINER_H
00013 #define CALLGRAPH_CONTAINER_H
00014
00015 #include <set>
00016 #include <vector>
00017 #include <string>
00018
00019 #include "symbol.h"
00020 #include "symbol_functors.h"
00021 #include "string_filter.h"
00022 #include "locate_images.h"
00023
00024 class profile_container;
00025 class inverted_profile;
00026 class profile_t;
00027 class image_set;
00028 class op_bfd;
00029
00030
00038 class arc_recorder {
00039 public:
00040 ~arc_recorder() {}
00041
00052 void add(symbol_entry const & caller, symbol_entry const * callee,
00053 count_array_t const & arc_count);
00054
00056 symbol_collection const & get_symbols() const;
00057
00062 void process(count_array_t total, double threshold,
00063 string_filter const & filter);
00064
00065 private:
00072 struct cg_data {
00073 cg_data() {}
00074
00075 typedef std::map<symbol_entry, count_array_t, less_symbol> children;
00076
00078 children callers;
00080 children callees;
00081 };
00082
00086 void process_children(cg_symbol & sym, double threshold);
00087
00088 typedef std::map<symbol_entry, cg_data, less_symbol> map_t;
00089
00091 map_t sym_map;
00092
00094 cg_collection_objs cg_syms_objs;
00095
00097 symbol_collection cg_syms;
00098 };
00099
00100
00104 class callgraph_container {
00105 public:
00118 void populate(std::list<inverted_profile> const & iprofiles,
00119 extra_images const & extra, bool debug_info,
00120 double threshold, bool merge_lib,
00121 string_filter const & sym_filter);
00122
00124 column_flags output_hint() const;
00125
00127 count_array_t samples_count() const;
00128
00129
00130 symbol_collection const & get_symbols() const;
00131
00132 private:
00144 void add(profile_t const & profile, op_bfd const & caller_bfd,
00145 bool bfd_caller_ok, op_bfd const & callee_bfd,
00146 std::string const & app_name, profile_container const & pc,
00147 bool debug_info, size_t pclass);
00148
00149 void populate(std::list<image_set> const & lset,
00150 std::string const & app_image,
00151 size_t pclass, profile_container const & pc,
00152 bool debug_info, bool merge_lib);
00153 void populate(std::list<std::string> const & cg_files,
00154 std::string const & app_image,
00155 size_t pclass, profile_container const & pc,
00156 bool debug_info, bool merge_lib);
00157
00159 void add_symbols(profile_container const & pc);
00160
00162 count_array_t total_count;
00163
00165 arc_recorder recorder;
00166
00167 public:
00168 extra_images extra_found_images;
00169 };
00170
00171 #endif