1 /** 2 * @file filename_spec.h 3 * Container holding a sample filename split into its components 4 * 5 * @remark Copyright 2003 OProfile authors 6 * @remark Read the file COPYING 7 * 8 * @author Philippe Elie 9 */ 10 11 #ifndef FILENAME_SPEC_H 12 #define FILENAME_SPEC_H 13 14 #include <unistd.h> 15 #include <string> 16 17 #include "generic_spec.h" 18 19 class profile_spec; 20 class extra_images; 21 22 /** 23 * A class to split and store components of a sample filename. 24 * These derived values are then used to match against a 25 * profile_spec as given by the user. 26 */ 27 class filename_spec 28 { 29 friend class profile_spec; 30 31 public: 32 /** 33 * @param filename the samples filename 34 * @param extra extra binary image location 35 * 36 * build a filename_spec from a samples filename 37 */ 38 filename_spec(std::string const & filename, 39 extra_images const & extra); 40 41 filename_spec(); 42 43 /** 44 * @param filename a sample filename 45 * @param extra extra binary image location 46 * 47 * setup filename spec according to the samples filename. PP:3.19 to 48 * 3.25 49 */ 50 void set_sample_filename(std::string const & filename, 51 extra_images const & extra); 52 53 /** 54 * @param rhs right hand side of the match operator 55 * @param binary if binary is non-empty, and matches 56 * the binary or lib name, use it rather than the 57 * one in rhs. 58 * 59 * return true if *this match rhs, matching if: 60 * - image_name are identical 61 * - lib_name are identical 62 * - event_spec match 63 * 64 * This operation is not commutative. First part of PP:3.24 65 */ 66 bool match(filename_spec const & rhs, 67 std::string const & binary) const; 68 69 bool is_dependent() const; 70 71 private: 72 std::string image; 73 std::string lib_image; 74 std::string cg_image; 75 std::string event; 76 int count; 77 unsigned int unitmask; 78 generic_spec<pid_t> tgid; 79 generic_spec<pid_t> tid; 80 generic_spec<int> cpu; 81 }; 82 83 84 #endif /* !FILENAME_SPEC_H */ 85