Commit | Line | Data |
---|---|---|
8b9d5b5e | 1 | |
a030d084 MD |
2 | typealias integer { size = 32; align = 32; signed = true; } := int; |
3 | typealias integer { size = 64; align = 64; signed = true; } := long; | |
4 | typealias integer { size = 64; align = 64; } := unsigned long; | |
5039b4cc | 5 | |
0fbb34a5 | 6 | enum name1 : int { |
8b9d5b5e MD |
7 | ZERO, |
8 | ONE, | |
9 | TWO, | |
10 | TEN = 10, | |
11 | ELEVEN, | |
12 | }; | |
13 | ||
0fbb34a5 | 14 | enum name2 : long { ONE, TWO }; |
8b9d5b5e | 15 | |
0fbb34a5 | 16 | enum name3 : unsigned long { ONE, TWO }; |
8b9d5b5e | 17 | |
0fbb34a5 | 18 | enum name4 : unsigned long { |
8b9d5b5e MD |
19 | string = 1 ... 2, |
20 | "other string" = 3...4, | |
21 | yet_another_string, /* will be assigned to end_value2 + 1 */ | |
22 | "some other string" = 10, | |
23 | }; | |
24 | ||
0fbb34a5 | 25 | enum name5 : long { "int" = 1, }; |
8b9d5b5e | 26 | |
6743829a MD |
27 | enum name6 { "int" = 1, }; |
28 | ||
8b9d5b5e MD |
29 | typealias floating_point { |
30 | exp_dig = 8; /* sizeof(float) * CHAR_BIT - FLT_MANT_DIG */ | |
31 | mant_dig = 24; /* FLT_MANT_DIG */ | |
32 | byte_order = native; | |
a030d084 | 33 | } := float; |
8b9d5b5e MD |
34 | |
35 | typealias integer { | |
36 | size = 32; | |
37 | align = 32; | |
5039b4cc | 38 | signed = false; |
a030d084 | 39 | } := struct page *; |
8b9d5b5e | 40 | |
5039b4cc MD |
41 | trace { |
42 | major = 66; | |
43 | minor = 2; | |
44 | uuid = "1123fcea-706e-11e0-a38b-f3c28a683a3d"; | |
45 | word_size = 64; | |
46 | }; | |
47 | ||
8b9d5b5e | 48 | stream { |
a030d084 MD |
49 | typealias integer { size = 64; align = 64; signed = false; } := uint64_t; |
50 | typealias integer { size = 16; align = 16; signed = false; } := uint16_t; | |
51 | typealias integer { size = 32; align = 32; signed = true; } := int; | |
8b9d5b5e MD |
52 | typedef int pid_t; |
53 | ||
54 | id = 5; | |
55 | /* Type 1 - Few event IDs; Type 2 - Many event IDs. See section 6.2. */ | |
56 | event.header := struct { uint64_t timestamp; uint16_t id; }; | |
57 | event.context := struct { pid_t pid; }; | |
58 | }; | |
59 | ||
60 | struct example { | |
5039b4cc MD |
61 | /* TODO gcc bitfields not supported yet. */ |
62 | /* short a:12; | |
63 | short b:5; */ | |
8b9d5b5e MD |
64 | }; |
65 | ||
66 | struct name { | |
a030d084 MD |
67 | typealias integer { size = 64; align = 64; signed = false; } := uint64_t; |
68 | typealias integer { size = 32; align = 32; signed = false; } := uint32_t; | |
69 | typealias integer { size = 32; align = 32; signed = true; } := int32_t; | |
70 | typealias integer { size = 2; align = 8; signed = false; } := uint2_t; | |
71 | typealias integer { size = 16; align = 16; signed = true; } := short; | |
72 | typealias uint32_t := unsigned int; | |
8b9d5b5e | 73 | |
0fbb34a5 | 74 | enum : uint2_t { a, b, c, d } choice; |
8b9d5b5e MD |
75 | /* Unrelated fields can be added between the variant and its tag */ |
76 | int32_t somevalue; | |
77 | variant <choice> { | |
78 | uint32_t a; | |
79 | uint64_t b; | |
80 | short c; | |
81 | struct { | |
82 | unsigned int field1; | |
83 | uint64_t field2; | |
84 | } d; | |
85 | } s; | |
86 | }; | |
87 | ||
88 | typealias integer { | |
89 | size = 32; | |
90 | signed = false; | |
91 | align = 32; | |
a030d084 | 92 | } := uint32_t; |
8b9d5b5e | 93 | |
a030d084 | 94 | typealias string { encoding = UTF8; } := test; |
8b9d5b5e MD |
95 | |
96 | struct event_packet_header { | |
a030d084 MD |
97 | typealias integer { size = 32; align = 32; signed = false; } := uint32_t; |
98 | typealias integer { size = 8; align = 8; signed = false; } := uint8_t; | |
8b9d5b5e MD |
99 | |
100 | uint32_t magic; | |
101 | uint8_t trace_uuid[16]; | |
102 | uint32_t stream_id; | |
103 | }; | |
104 | ||
105 | struct event_packet_context { | |
a030d084 MD |
106 | typealias integer { size = 64; align = 64; signed = false; } := uint64_t; |
107 | typealias integer { size = 32; align = 32; signed = false; } := uint32_t; | |
108 | typealias integer { size = 16; align = 16; signed = false; } := uint16_t; | |
109 | typealias integer { size = 8; align = 8; signed = false; } := uint8_t; | |
8b9d5b5e MD |
110 | |
111 | uint64_t timestamp_begin; | |
112 | uint64_t timestamp_end; | |
113 | uint32_t checksum; | |
114 | uint32_t stream_packet_count; | |
115 | uint32_t events_discarded; | |
116 | uint32_t cpu_id; | |
117 | uint16_t content_size; | |
118 | uint16_t packet_size; | |
119 | uint8_t stream_packet_count_bits; /* Significant counter bits */ | |
120 | uint8_t compression_scheme; | |
121 | uint8_t encryption_scheme; | |
122 | uint8_t checksum_scheme; | |
123 | }; | |
124 | ||
125 | struct event_header_1 { | |
a030d084 MD |
126 | typealias integer { size = 64; align = 64; signed = false; } := uint64_t; |
127 | typealias integer { size = 32; align = 32; signed = false; } := uint32_t; | |
128 | typealias integer { size = 5; align = 1; signed = false; } := uint5_t; | |
129 | typealias integer { size = 27; align = 1; signed = false; } := uint27_t; | |
8b9d5b5e MD |
130 | |
131 | /* | |
132 | * id: range: 0 - 30. | |
133 | * id 31 is reserved to indicate an extended header. | |
134 | */ | |
0fbb34a5 | 135 | enum : uint5_t { compact = 0 ... 30, extended = 31 } id; |
8b9d5b5e MD |
136 | variant <id> { |
137 | struct { | |
138 | uint27_t timestamp; | |
139 | } compact; | |
140 | struct { | |
141 | uint32_t id; /* 32-bit event IDs */ | |
142 | uint64_t timestamp; /* 64-bit timestamps */ | |
143 | } extended; | |
144 | } v; | |
145 | }; | |
146 | ||
147 | struct event_header_2 { | |
a030d084 MD |
148 | typealias integer { size = 64; align = 64; signed = false; } := uint64_t; |
149 | typealias integer { size = 32; align = 32; signed = false; } := uint32_t; | |
150 | typealias integer { size = 16; align = 16; signed = false; } := uint16_t; | |
8b9d5b5e MD |
151 | |
152 | /* | |
153 | * id: range: 0 - 65534. | |
154 | * id 65535 is reserved to indicate an extended header. | |
155 | */ | |
0fbb34a5 | 156 | enum : uint16_t { compact = 0 ... 65534, extended = 65535 } id; |
8b9d5b5e MD |
157 | variant <id> { |
158 | struct { | |
159 | uint32_t timestamp; | |
160 | } compact; | |
161 | struct { | |
162 | uint32_t id; /* 32-bit event IDs */ | |
163 | uint64_t timestamp; /* 64-bit timestamps */ | |
164 | } extended; | |
165 | } v; | |
166 | }; | |
167 | ||
64b829c0 MD |
168 | typedef int rootscopetest; |
169 | ||
5039b4cc MD |
170 | /* parser level only: event { a.b.c.d.e = f.g.h->i->j; }; */ |
171 | ||
172 | event { | |
173 | name = test_event; | |
174 | id = 0; | |
175 | stream_id = 5; | |
176 | context := struct {}; | |
177 | payload := struct {}; | |
178 | }; | |
48a01768 | 179 | |
a030d084 | 180 | typealias integer { size = 32; align = 32; signed = false; } := unsigned long long *; |