This source file includes following definitions.
- event_attributes
- main
1
2
3
4
5
6 #include <stdio.h>
7 #include <stdlib.h>
8
9 #include "ebb.h"
10
11
12
13
14
15 int event_attributes(void)
16 {
17 struct event event, leader;
18
19 SKIP_IF(!ebb_is_supported());
20
21 event_init(&event, 0x1001e);
22 event_leader_ebb_init(&event);
23
24 FAIL_IF(event_open(&event));
25 event_close(&event);
26
27
28 event_init(&event, 0x001e);
29 event_leader_ebb_init(&event);
30
31 FAIL_IF(event_open(&event) == 0);
32
33
34 event_init(&event, 0x2001e);
35 event_leader_ebb_init(&event);
36 event.attr.exclusive = 0;
37
38 FAIL_IF(event_open(&event) == 0);
39
40
41 event_init(&event, 0x3001e);
42 event_leader_ebb_init(&event);
43 event.attr.freq = 1;
44
45 FAIL_IF(event_open(&event) == 0);
46
47
48 event_init(&event, 0x4001e);
49 event_leader_ebb_init(&event);
50 event.attr.sample_period = 1;
51
52 FAIL_IF(event_open(&event) == 0);
53
54
55 event_init(&event, 0x1001e);
56 event_leader_ebb_init(&event);
57 event.attr.enable_on_exec = 1;
58
59 FAIL_IF(event_open(&event) == 0);
60
61
62 event_init(&event, 0x1001e);
63 event_leader_ebb_init(&event);
64 event.attr.inherit = 1;
65
66 FAIL_IF(event_open(&event) == 0);
67
68
69 event_init(&leader, 0x1001e);
70 event_leader_ebb_init(&leader);
71 FAIL_IF(event_open(&leader));
72
73 event_init(&event, 0x20002);
74 event_ebb_init(&event);
75
76
77 FAIL_IF(event_open_with_group(&event, leader.fd));
78 event_close(&leader);
79 event_close(&event);
80
81
82 event_init(&leader, 0x1001e);
83 event_leader_ebb_init(&leader);
84 FAIL_IF(event_open(&leader));
85
86 event_init(&event, 0x20002);
87
88
89 FAIL_IF(event_open_with_group(&event, leader.fd) == 0);
90 event_close(&leader);
91
92
93 event_init(&leader, 0x1001e);
94 event_leader_ebb_init(&leader);
95
96 leader.attr.config &= ~(1ull << 63);
97
98 FAIL_IF(event_open(&leader));
99
100 event_init(&event, 0x20002);
101 event_ebb_init(&event);
102
103
104 FAIL_IF(event_open_with_group(&event, leader.fd) == 0);
105 event_close(&leader);
106
107
108 event_init(&leader, 0x1001e);
109 event_leader_ebb_init(&leader);
110 leader.attr.exclusive = 0;
111
112 FAIL_IF(event_open(&leader) == 0);
113
114
115 event_init(&leader, 0x1001e);
116 event_leader_ebb_init(&leader);
117 leader.attr.pinned = 0;
118
119 FAIL_IF(event_open(&leader) == 0);
120
121 event_init(&event, 0x1001e);
122 event_leader_ebb_init(&event);
123
124 SKIP_IF(require_paranoia_below(1));
125 FAIL_IF(event_open_with_cpu(&event, 0) == 0);
126
127 return 0;
128 }
129
130 int main(void)
131 {
132 return test_harness(event_attributes, "event_attributes");
133 }