blob: d3e0bcc1f457138185f72b37b6c4518bf635eed0 (
plain) (
blame)
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
|
/*
* %CopyrightBegin%
*
* Copyright Ericsson AB 2004-2016. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* %CopyrightEnd%
*/
/*
* Description:
*
* Author: Rickard Green
*/
#ifndef ERL_MEMORY_TRACE_PROTOCOL_H__
#define ERL_MEMORY_TRACE_PROTOCOL_H__
/*
* Increase ERTS_MT_MAJOR_VSN and set ERTS_MT_MINOR_VSN to 0
* when backward incompatible changes are made in the protocol.
*
* Increase ERTS_MT_MINOR_VSN when backward compatible changes are
* made in the protocol.
*/
#define ERTS_MT_MAJOR_VSN (2)
#define ERTS_MT_MINOR_VSN (0)
/* Trace flags */
#define ERTS_MT_64_BIT_FLAG (1 << 0)
#define ERTS_MT_CRR_INFO (1 << 1)
#define ERTS_MT_SEG_CRR_INFO (1 << 2)
/* Header flags */
/* Allocator flags */
#define ERTS_MT_ALLCTR_USD_CRR_INFO (1 << 0)
/* Block type flags */
/* Entry tags */
#define ERTS_MT_V1_ALLOCATOR_TAG (1)
#define ERTS_MT_V1_BLOCK_TYPE_TAG (2)
#define ERTS_MT_V1_ALLOC_TAG (3)
#define ERTS_MT_V1_REALLOC_NPB_TAG (4)
#define ERTS_MT_V1_REALLOC_MV_TAG (5)
#define ERTS_MT_V1_REALLOC_NMV_TAG (6)
#define ERTS_MT_V1_FREE_TAG (7)
#define ERTS_MT_V1_TIME_INC_TAG (8)
#define ERTS_MT_V1_STOP_TAG (9)
#define ERTS_MT_V1_EXIT_TAG (10)
#define ERTS_MT_END_OF_HDR_TAG (0)
#define ERTS_MT_ALLOCATOR_HDR_TAG (1)
#define ERTS_MT_BLOCK_TYPE_HDR_TAG (2)
#define ERTS_MT_EXIT_BDY_TAG (0)
#define ERTS_MT_STOP_BDY_TAG (1)
#define ERTS_MT_ALLOC_BDY_TAG (2)
#define ERTS_MT_REALLOC_BDY_TAG (3)
#define ERTS_MT_FREE_BDY_TAG (4)
#define ERTS_MT_CRR_ALLOC_BDY_TAG (5)
#define ERTS_MT_CRR_REALLOC_BDY_TAG (6)
#define ERTS_MT_CRR_FREE_BDY_TAG (7)
#define ERTS_MT_TIME_INC_BDY_TAG (8)
#define ERTS_MT_X_BDY_TAG (9)
/* X subtags */
#if 0
#define ERTS_MT_X_ _BDY_TAG (0)
#endif
#define ERTS_MT_START_WORD (0xfff04711)
/* Entry header fields */
#define ERTS_MT_UI8_MSB_EHDR_FLD_SZ (0)
#define ERTS_MT_UI16_MSB_EHDR_FLD_SZ (1)
#define ERTS_MT_UI32_MSB_EHDR_FLD_SZ (2)
#define ERTS_MT_UI64_MSB_EHDR_FLD_SZ (3)
#define ERTS_MT_UI_MSB_EHDR_FLD_SZ ERTS_MT_UI64_MSB_EHDR_FLD_SZ
#define ERTS_MT_TAG_EHDR_FLD_SZ (4)
#define ERTS_MT_UI8_MSB_EHDR_FLD_MSK ((1 << ERTS_MT_UI8_MSB_EHDR_FLD_SZ)-1)
#define ERTS_MT_UI16_MSB_EHDR_FLD_MSK ((1 << ERTS_MT_UI16_MSB_EHDR_FLD_SZ)-1)
#define ERTS_MT_UI32_MSB_EHDR_FLD_MSK ((1 << ERTS_MT_UI32_MSB_EHDR_FLD_SZ)-1)
#define ERTS_MT_UI64_MSB_EHDR_FLD_MSK ((1 << ERTS_MT_UI64_MSB_EHDR_FLD_SZ)-1)
#define ERTS_MT_UI_MSB_EHDR_FLD_MSK ERTS_MT_UI64_MSB_EHDR_FLD_MSK
#define ERTS_MT_TAG_EHDR_FLD_MSK ((1 << ERTS_MT_TAG_EHDR_FLD_SZ)-1)
/* Time increment word */
#define ERTS_MT_TIME_INC_SECS_SHIFT 20
#define ERTS_MT_TIME_INC_USECS_SHIFT 0
#define ERTS_MT_TIME_INC_SECS_MASK ((1 << 12) - 1)
#define ERTS_MT_TIME_INC_USECS_MASK ((1 << 20) - 1)
#define ERTS_MT_MAX_V1_HEADER_ENTRY_SIZE (2 + 2 + 1 + 255 + 2)
/* Largest v1 header entry is block type entry (ERTS_MT_V1_BLOCK_TYPE_TAG) */
#define ERTS_MT_MAX_V1_BODY_ENTRY_SIZE (2 + 8 + 8 + 8 + 4)
/* Largest body entry is realloc moved entry (ERTS_MT_V1_REALLOC_MV_TAG) */
#define ERTS_MT_MAX_HEADER_ENTRY_SIZE (1 + 2 + 2 + 1 + 255 + 2)
/* Largest header entry is block type entry (ERTS_MT_BLOCK_TYPE_TAG) */
#define ERTS_MT_MAX_BODY_ENTRY_SIZE ERTS_MT_MAX_CRR_REALLOC_SIZE
/* Largest body entry is carrier realloc entry (ERTS_MT_CRR_REALLOC_BDY_TAG) */
/*
*
* Entry header:
*
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | ... |MSB2|MSB1|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*
* Time inc entry field:
*
* 31 23 0
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Seconds | Micro Seconds |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
#define ERTS_MT_MAX_CRR_ALLOC_SIZE (1 + 2 + 2 + 2 + 8 + 8 + 4)
/*
* ERTS_MT_CRR_ALLOC_BDY_TAG:
* N 1 2 3 4 5
* MSB 1-0 1-0 7|3-0 7|3-0 3-0
* SZ 1 2 2-1 2-1 8|4-1 8|4-1 4-1
* UIT UI8 UI16 UI16 UI16 UI64|UI32 UI64|UI32 UI32
* +---+----+...--+...--+...-------+...-------+...-------+
* |Tag| Hdr|CType| Type| Out ptr | In size | Time inc |
* +---+----+...--+...--+...-------+...-------+...-------+
*
*/
#define ERTS_MT_MAX_ALLOC_SIZE (1 + 2 + 2 + 8 + 8 + 4)
/*
* ERTS_MT_ALLOC_BDY_TAG:
* N 1 2 3 4
* MSB 1-0 7|3-0 7|3-0 3-0
* SZ 1 2 2-1 8|4-1 8|4-1 4-1
* UIT UI8 UI16 UI16 UI64|UI32 UI64|UI32 UI32
* +---+----+...--+...-------+...-------+...-------+
* |Tag| Hdr| Type| Out ptr | In size | Time inc |
* +---+----+...--+...-------+...-------+...-------+
*
*/
#define ERTS_MT_MAX_CRR_REALLOC_SIZE (1 + 2 + 2 + 2 + 8 + 8 + 8 + 4)
/*
* ERTS_MT_CRR_REALLOC_BDY_TAG:
* N 1 2 3 4 5 6
* MSB 1-0 1-0 7|3-0 7|3-0 7|3-0 3-0
* SZ 1 2 2-1 2-1 8|4-1 8|4-1 8|4-1 4-1
* UIT UI8 UI16 UI16 UI16 UI64|UI32 UI64|UI32 UI64|UI32 UI32
* +---+----+...--+...--+...-------+...-------+...-------+...-------+
* |Tag| Hdr|CType| Type| Out ptr | In ptr | In size | Time inc |
* +---+----+...--+...--+...-------+...-------+...-------+...-------+
*
*/
#define ERTS_MT_MAX_REALLOC_SIZE (1 + 2 + 2 + 8 + 8 + 8 + 4)
/*
* ERTS_MT_REALLOC_BDY_TAG:
* N 1 2 3 4 5
* MSB 1-0 7|3-0 7|3-0 7|3-0 3-0
* SZ 1 2 2-1 8|4-1 8|4-1 8|4-1 4-1
* UIT UI8 UI16 UI16 UI64|UI32 UI64|UI32 UI64|UI32 UI32
* +---+----+...--+...-------+...-------+...-------+...-------+
* |Tag| Hdr| Type| Out ptr | In ptr | In size | Time inc |
* +---+----+...--+...-------+...-------+...-------+...-------+
*
*/
#define ERTS_MT_MAX_CRR_FREE_SIZE (1 + 2 + 2 + 2 + 8 + 4)
/*
* ERTS_MT_CRR_FREE_BDY_TAG:
* N 1 2 3 4
* MSB 1-0 1-0 7|3-0 3-0
* SZ 1 2 2-1 2-1 8|4-1 4-1
* UIT UI8 UI16 UI16 UI16 UI64|UI32 UI32
* +---+----+...--+...--+...-------+...-------+
* |Tag| Hdr|CType| Type| In ptr | Time inc |
* +---+----+...--+...--+...-------+...-------+
*
*/
#define ERTS_MT_MAX_FREE_SIZE (1 + 2 + 2 + 8 + 4)
/*
* ERTS_MT_FREE_BDY_TAG:
* N 1 2 3
* MSB 1-0 7|3-0 3-0
* SZ 1 2 2-1 8|4-1 4-1
* UIT UI8 UI16 UI16 UI64|UI32 UI32
* +---+----+...--+...-------+...-------+
* |Tag| Hdr| Type| In ptr | Time inc |
* +---+----+...--+...-------+...-------+
*
*/
/*
* ERTS_MT_X_BDY_TAG:
* N
* MSB
* SZ 1 2 1
* UIT UI8 UI16 UI8
* +---+-----+------+... ...+
* |Tag|TotSz|SubTag| |
* +---+-----+------+... ...+
*
* ^ ^
* | |
* +------ TotSz bytes -----+
*
* X for extension
*
* * Tag equals ERTS_MT_X_BDY_TAG.
* * TotSz contains the total size of the entry.
* * SubTag is used to distinguish between different sub entries
* passed in X entries.
*
*/
#endif /* #ifndef ERL_MEMORY_TRACE_PROTOCOL_H__ */
|