Skip to content

Commit 211ca8a

Browse files
committed
Write out trace description.
1 parent b532b86 commit 211ca8a

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,42 @@
4747
make
4848
make install
4949
```
50+
51+
## Trace format
52+
53+
The trace consists of three parts: the header,
54+
a table of contents (TOC) holding the frames, and an index into the TOC.
55+
56+
A fixed number of frames are considered _one entry_ in the TOC.
57+
Frames in each entry starts with the size of the frame, followed by the actual frame data.
58+
Then the next frame size followed by the frame data and so forth.
59+
60+
The TOC index is stored at the end.
61+
62+
[!IMPORTANT]
63+
The last TOC entry might holds less than `m` frames.
64+
65+
For specifics about the frame contents, please check the definitions in the [piqi](piqi/) directory.
66+
67+
**Format**
68+
69+
| Offset | Type | Field | Note |
70+
|--------|------|-------|------|
71+
| 0x0 | uint64_t | magic number (7456879624156307493LL) | Header begin |
72+
| 0x8 | uint64_t | trace version number | |
73+
| 0x10 | uint64_t | frame_architecture | |
74+
| 0x18 | uint64_t | frame_machine, 0 for unspecified. | |
75+
| 0x20 | uint64_t | n = total number of frames in trace. | |
76+
| 0x28 | uint64_t | T = offset to TOC index. | |
77+
| 0x30 | uint64_t | sizeof(frame_0) | TOC begin |
78+
| 0x38 | meta_frame | frame_0 | |
79+
| 0x40 | uint64_t | sizeof(frame_1) | |
80+
| 0x48 | type(frame_1) | frame_1 | |
81+
| ... | ... | ... | |
82+
| T-0x10 | uint64_t | sizeof(frame_n-1) | |
83+
| T-0x8 | type(frame_n-1) | frame_n-1 | |
84+
| T+0 | uint64_t | m = maximum number of frames per TOC entry | TOC index begin |
85+
| T+0x8 | uint64_t | offset toc_entry(0) | |
86+
| T+0x10 | uint64_t | offset toc_entry(1) | |
87+
| ... | ... | ... | |
88+
| T+0x8+(0x8*ceil(n/m)) | uint64_t | offset toc_entry(ceil(n/m)) | |

0 commit comments

Comments
 (0)