blob: 82938acd351e6cab66a447ce2565fde102ab1579 (
plain)
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
--- libpp/arrange_profiles.cpp.orig 2006-02-15 13:26:05.780995781 +0100
+++ libpp/arrange_profiles.cpp 2006-02-15 13:16:37.997633075 +0100
@@ -24,6 +24,44 @@
#include "parse_filename.h"
#include "locate_images.h"
+bool profile_classes::matches(profile_classes const & classes)
+{
+ if (v.size() != classes.v.size())
+ return false;
+
+ axis_types const axis2 = classes.axis;
+
+ switch (axis) {
+ case AXIS_EVENT:
+ break;
+ case AXIS_TGID:
+ case AXIS_TID:
+ return axis2 == AXIS_TID || axis2 == AXIS_TGID;
+ case AXIS_CPU:
+ return axis2 == AXIS_CPU;
+ case AXIS_MAX:
+ return false;
+ }
+
+ // check that the events match (same event, count)
+
+ std::vector<profile_class>::const_iterator it1 = v.begin();
+ std::vector<profile_class>::const_iterator end1 = v.end();
+ std::vector<profile_class>::const_iterator it2 = classes.v.begin();
+
+ while (it1 != end1) {
+ if (it1->ptemplate.event != it2->ptemplate.event)
+ return false;
+ if (it1->ptemplate.count != it2->ptemplate.count)
+ return false;
+ // differing unit mask is considered comparable
+ ++it1;
+ ++it2;
+ }
+
+ return true;
+}
+
using namespace std;
namespace {
@@ -90,45 +128,6 @@
};
-bool profile_classes::matches(profile_classes const & classes)
-{
- if (v.size() != classes.v.size())
- return false;
-
- axis_types const axis2 = classes.axis;
-
- switch (axis) {
- case AXIS_EVENT:
- break;
- case AXIS_TGID:
- case AXIS_TID:
- return axis2 == AXIS_TID || axis2 == AXIS_TGID;
- case AXIS_CPU:
- return axis2 == AXIS_CPU;
- case AXIS_MAX:
- return false;
- }
-
- // check that the events match (same event, count)
-
- vector<profile_class>::const_iterator it1 = v.begin();
- vector<profile_class>::const_iterator end1 = v.end();
- vector<profile_class>::const_iterator it2 = classes.v.begin();
-
- while (it1 != end1) {
- if (it1->ptemplate.event != it2->ptemplate.event)
- return false;
- if (it1->ptemplate.count != it2->ptemplate.count)
- return false;
- // differing unit mask is considered comparable
- ++it1;
- ++it2;
- }
-
- return true;
-}
-
-
/// We have more than one axis of classification, tell the user.
void report_error(profile_classes const & classes, axis_types newaxis)
{
|