00001 00011 #ifndef PROFILE_SPEC_H 00012 #define PROFILE_SPEC_H 00013 00014 #include <map> 00015 #include <vector> 00016 #include <list> 00017 00018 #include "filename_spec.h" 00019 #include "comma_list.h" 00020 #include "locate_images.h" 00021 00029 class profile_spec 00030 { 00031 public: 00041 static profile_spec create(std::list<std::string> const & args, 00042 std::vector<std::string> const & image_path, 00043 std::string const & root_path); 00044 00051 std::list<std::string> 00052 generate_file_list(bool exclude_dependent, bool exclude_cg) const; 00053 00059 bool match(filename_spec const & file_spec) const; 00060 00065 std::string get_archive_path() const; 00066 00067 private: 00068 profile_spec(); 00069 00074 void parse(std::string const & tag_value); 00075 00082 void set_image_or_lib_name(std::string const & image); 00083 00089 bool is_valid_tag(std::string const & str); 00090 00094 void parse_archive_path(std::string const &); 00095 void parse_session(std::string const &); 00096 void parse_session_exclude(std::string const &); 00097 void parse_image(std::string const &); 00098 void parse_image_exclude(std::string const &); 00099 void parse_lib_image(std::string const &); 00100 void parse_event(std::string const &); 00101 void parse_count(std::string const &); 00102 void parse_unitmask(std::string const &); 00103 void parse_tid(std::string const &); 00104 void parse_tgid(std::string const &); 00105 void parse_cpu(std::string const &); 00106 00107 typedef void (profile_spec::*action_t)(std::string const &); 00108 typedef std::map<std::string, action_t> parse_table_t; 00109 parse_table_t parse_table; 00110 00119 action_t get_handler(std::string const & tag_value, 00120 std::string & value); 00121 00122 std::string archive_path; 00123 std::string binary; 00124 std::vector<std::string> session; 00125 std::vector<std::string> session_exclude; 00126 std::vector<std::string> image; 00127 std::vector<std::string> image_exclude; 00128 std::vector<std::string> lib_image; 00129 comma_list<std::string> event; 00130 comma_list<int> count; 00131 comma_list<unsigned int> unitmask; 00132 comma_list<pid_t> tid; 00133 comma_list<pid_t> tgid; 00134 comma_list<int> cpu; 00135 // specified by user on command like opreport image1 image2 ... 00136 std::vector<std::string> image_or_lib_image; 00137 00138 public: // FIXME 00140 extra_images extra_found_images; 00141 }; 00142 00143 #endif /* !PROFILE_SPEC_H */