From 6c3d26705c4c3c671cce271f3645a302f01eaad8 Mon Sep 17 00:00:00 2001 From: Jose Fonseca Date: Wed, 5 Oct 2016 23:06:40 +0100 Subject: [PATCH] docs: Document the Snappy format too. --- docs/FORMAT.markdown | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/docs/FORMAT.markdown b/docs/FORMAT.markdown index 9c7aeff5a..db493cc6f 100644 --- a/docs/FORMAT.markdown +++ b/docs/FORMAT.markdown @@ -2,9 +2,31 @@ This document specifies the binary format of trace streams. -Trace streams are not written verbatim to file, but compressed, nowadays with -snappy (see `lib/trace/trace_file_snappy.cpp` for details). Previously they used -to be compressed with gzip. +## Compression ## + +Trace streams are not written verbatim to file, but compressed. + +By default traces are compressed with [Snappy](https://github.com/google/snappy) +(see below for details). Previously they used to be compressed with gzip. And +recently it also possible to have them compressed with +[Brotli](https://github.com/google/brotli), though this is mostly intended for +space savings on large databases of trace files. + +`apitrace repack` utility can be used to recompress the stream without any loss. + +### Snappy ### + +The used Snappy format is different from the standard _Snappy framing format_, +because it predates it. + + file = header chunk* + + header = 'a' 't' + + chunk = compressed_length compressed_data + + compressed_length = uint32 // length of compressed data in little endian + compressed_data = byte* ## Versions ##