[0d0e60]: libpp / filename_spec.h Maximize Restore History

Download this file

filename_spec.h    80 lines (66 with data), 1.7 kB

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