00001 /** 00002 * @file common_option.h 00003 * Declaration of entry point of pp tools, implementation file add common 00004 * options of pp tools and some miscelleaneous functions 00005 * 00006 * @remark Copyright 2003 OProfile authors 00007 * @remark Read the file COPYING 00008 * 00009 * @author John Levon 00010 * @author Philippe Elie 00011 */ 00012 00013 #ifndef COMMON_OPTION_H 00014 #define COMMON_OPTION_H 00015 00016 #include <vector> 00017 #include <list> 00018 00019 #include "arrange_profiles.h" 00020 #include "demangle_symbol.h" 00021 00022 namespace options { 00023 extern bool verbose; 00024 extern double threshold; 00025 extern std::string threshold_opt; 00026 extern std::string command_options; 00027 extern std::vector<std::string> image_path; 00028 extern std::string root_path; 00029 00030 struct spec { 00031 std::list<std::string> common; 00032 std::list<std::string> first; 00033 std::list<std::string> second; 00034 }; 00035 } 00036 00037 /** 00038 * prototype of a pp tool entry point. This entry point is called 00039 * by run_pp_tool 00040 */ 00041 typedef int (*pp_fct_run_t)(options::spec const & spec); 00042 00043 /** 00044 * @param argc command line number of argument 00045 * @param argv command line argument pointer array 00046 * @param fct function to run to start this pp tool 00047 * 00048 * Provide a common entry to all pp tools, parsing all options, handling 00049 * common options and providing the necessary try catch clause 00050 */ 00051 int run_pp_tool(int argc, char const * argv[], pp_fct_run_t fct); 00052 00053 /** 00054 * @param option one of [smart,none,normal] 00055 * 00056 * return the demangle_type of option or throw an exception if option 00057 * is not valid. 00058 */ 00059 demangle_type handle_demangle_option(std::string const & option); 00060 00061 /** 00062 * @param mergespec merge option 00063 * @param allow_lib is merge)lib allowed in mergespec 00064 * @param exclude_dependent user specified --exclude-dependent 00065 * 00066 * parse merge option and return a merge_option filled from it. 00067 * 00068 */ 00069 merge_option handle_merge_option(std::vector<std::string> const & mergespec, 00070 bool allow_lib, bool exclude_dependent); 00071 00072 /** 00073 * Answer the question 'did the user pass in a session-dir argument?'. 00074 */ 00075 bool was_session_dir_supplied(void); 00076 00077 #endif /* !COMMON_OPTION_H */
1.6.1