00001 /** 00002 * @file parse_filename.h 00003 * Split a sample filename into its constituent parts 00004 * 00005 * @remark Copyright 2003 OProfile authors 00006 * @remark Read the file COPYING 00007 * 00008 * @author Philippe Elie 00009 */ 00010 00011 #ifndef PARSE_FILENAME_H 00012 #define PARSE_FILENAME_H 00013 00014 #include <string> 00015 00016 class extra_images; 00017 00018 /** 00019 * a convenience class to store result of parse_filename() 00020 */ 00021 struct parsed_filename 00022 { 00023 std::string image; 00024 std::string lib_image; 00025 /// destination image for call graph file, empty if this sample 00026 /// file is not a callgraph file. 00027 std::string cg_image; 00028 std::string event; 00029 std::string count; 00030 std::string unitmask; 00031 std::string tgid; 00032 std::string tid; 00033 std::string cpu; 00034 00035 /// return true if the profile specification are identical. 00036 bool profile_spec_equal(parsed_filename const & parsed); 00037 00038 /** 00039 * the original sample filename from which the 00040 * above components are built 00041 */ 00042 std::string filename; 00043 bool jit_dumpfile_exists; 00044 }; 00045 00046 00047 /// debugging helper 00048 std::ostream & operator<<(std::ostream &, parsed_filename const &); 00049 00050 00051 /** 00052 * parse a sample filename 00053 * @param filename in: a sample filename 00054 * @param extra_found_images binary image location 00055 * 00056 * filename is split into constituent parts, the lib_image is optional 00057 * and can be empty on successfull call. All other error are fatal. 00058 * Filenames are encoded as according to PP:3.19 to PP:3.25 00059 * 00060 * all errors throw an std::invalid_argument exception 00061 */ 00062 parsed_filename parse_filename(std::string const & filename, 00063 extra_images const & extra_found_images); 00064 00065 #endif /* !PARSE_FILENAME_H */
1.6.1