diff --git a/README.rst b/README.rst index d2d8ed95..c98db889 100644 --- a/README.rst +++ b/README.rst @@ -74,3 +74,48 @@ dependencies all the way to the top-level application like so: Examples / Usage ================ There are a few examples of usage in the examples folder. + + +Memory Layout Specification +=========================== + +The class preallocates memory at construction with the following layout: + ++-------------------------+-------------------+-------------------------------------------+ +| **Field** | **Size (bytes)** | **Description** | ++=========================+===================+===========================================+ +| **Header** | 10 | Static metadata written once. | +| | | | +| - Endianness | 1 | Indicates big-endian or little-endian. | +| - Protocol version | 1 | Protocol version identifier. | +| - Total name bytes | 2 | Total bytes allocated for names. | +| - Total description | 2 | Total bytes allocated for descriptions. | +| - # of 8-byte metrics | 2 | Number of 8-byte-value metrics. | +| - # of 1-byte metrics | 2 | Number of 1-byte-value metrics. | ++-------------------------+-------------------+-------------------------------------------+ +| **Name Sizes** | 2 per metric | Byte size of each metric name. | ++-------------------------+-------------------+-------------------------------------------+ +| **Description Sizes** | 2 per metric | Byte size of each metric description. | ++-------------------------+-------------------+-------------------------------------------+ +| **Metric Names** | Variable | Names of the metrics. | ++-------------------------+-------------------+-------------------------------------------+ +| **Descriptions** | Variable | Descriptions of the metrics. | ++-------------------------+-------------------+-------------------------------------------+ +| **Metric Types** | 1 per metric | Specifies the type of each metric. | ++-------------------------+-------------------+-------------------------------------------+ +| **Metric Flags** | 1 per metric | Initialization and constant flags. | ++-------------------------+-------------------+-------------------------------------------+ +| **Padding** | Up to 7 | Alignment padding for memory boundaries. | ++-------------------------+-------------------+-------------------------------------------+ +| **8-Byte Values** | 8 per metric | Values for 8-byte metrics. | ++-------------------------+-------------------+-------------------------------------------+ +| **1-Byte Values** | 1 per metric | Values for 1-byte metrics. | ++-------------------------+-------------------+-------------------------------------------+ +| **Bitmap** | 1 per 8 metrics | Bitmap indicating initialized metrics. | ++-------------------------+-------------------+-------------------------------------------+ + +Notes +----- + +- **Static Sections (1–8)**: These fields are written once during initialization. +- **Dynamic Sections (9–11)**: These fields are updated as metrics are initialized or modified. \ No newline at end of file