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