linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com>
Cc: linux-trace-devel@vger.kernel.org
Subject: Re: [PATCH v6 45/45] trace-cmd: Update trace.dat man page
Date: Mon, 21 Jun 2021 20:37:16 -0400	[thread overview]
Message-ID: <20210621203716.17121623@oasis.local.home> (raw)
In-Reply-To: <20210614075029.598048-46-tz.stoyanov@gmail.com>

On Mon, 14 Jun 2021 10:50:29 +0300
"Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com> wrote:

> Updated the trace.dat man page with the changes related to file
> version 7 and compression.
> 
> Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
> ---
>  Documentation/trace-cmd/trace-cmd.dat.5.txt | 56 ++++++++++++++++++---
>  1 file changed, 50 insertions(+), 6 deletions(-)
> 
> diff --git a/Documentation/trace-cmd/trace-cmd.dat.5.txt b/Documentation/trace-cmd/trace-cmd.dat.5.txt
> index 8d285353..e80d460e 100644
> --- a/Documentation/trace-cmd/trace-cmd.dat.5.txt
> +++ b/Documentation/trace-cmd/trace-cmd.dat.5.txt
> @@ -52,6 +52,23 @@ INITIAL FORMAT
>    The next 4 bytes are a 32-bit word that defines what the traced
>    host machine page size was.
>  
> +  If the file version is 7 or greater, the compression header is
> +  written next:
> +     "name version\0"

I wonder if we should make it: "name\0version\0"

Also, I think "none" is acceptable, where none of the sections are
compressed. If we add something special for a version 7 but don't want
to compress, we need to support that.

> +  where "name" and "version" are strings, name and version of the
> +  compression algorithm used to compress the trace file.
> +
> +COMPRESSION FORMAT OF THE HEADER SECTIONS
> +-----------------------------------------
> +  If the file version is 7 or greater, some header sections are compressed
> +  with the compression algorithm, specified in the compression header.
> +  The format of these compressed sections is:
> +     <4 bytes> unsigned int, size of compressed data in the next block.
> +     <4 bytes> unsigned int, size of uncompressed data.
> +     <data> binary compressed data, with the specified size.
> +  These sections must be uncompressed on reading. The described format of
> +  the sections refers to the uncomperssed data.

I think each section should have a flag that states that it is
compressed or not. That way we could have options that determine "what"
gets compressed, and not have it be all or none.

> +
>  HEADER INFO FORMAT
>  ------------------
>  
> @@ -93,7 +110,8 @@ FTRACE EVENT FORMATS
>  
>    Directly after the header information comes the information about
>    the Ftrace specific events. These are the events used by the Ftrace plugins
> -  and are not enabled by the event tracing.
> +  and are not enabled by the event tracing. If the file version is 7 or
> +  greater, this section is compressed.

Perhaps add a single byte ahead of each section, where "0" is not
compressed, and "1" is compressed?

>  
>    The next 4 bytes contain a 32-bit word of the number of Ftrace event
>    format files that are stored in the file.
> @@ -110,7 +128,8 @@ EVENT FORMATS
>  -------------
>  
>    Directly after the Ftrace formats comes the information about
> -  the event layout.
> +  the event layout. If the file version is 7 or greater, this section
> +  is compressed.
>  
>    The next 4 bytes are a 32-bit word containing the number of
>    event systems that are stored in the file. These are the
> @@ -137,7 +156,8 @@ KALLSYMS INFORMATION
>  --------------------
>  
>    Directly after the event formats comes the information of the mapping
> -  of function addresses to the function names.
> +  of function addresses to the function names. If the file version is 7
> +  or greater, this section is compressed.
>  
>    The next 4 bytes are a 32-bit word containing the size of the
>    data holding the function mappings.
> @@ -154,6 +174,7 @@ TRACE_PRINTK INFORMATION
>    store the format string outside the ring buffer.
>    This information can be found in:
>    debugfs/tracing/printk_formats
> +  If the file version is 7 or greater, this section is compressed.
>  
>    The next 4 bytes are a 32-bit word containing the size of the
>    data holding the printk formats.
> @@ -166,7 +187,8 @@ PROCESS INFORMATION
>  -------------------
>  
>    Directly after the trace_printk formats comes the information mapping
> -  a PID to a process name.
> +  a PID to a process name. If the file version is 7 or greater, this
> +  section is compressed.
>  
>    The next 8 bytes contain a 64-bit word that holds the size of the
>    data mapping the PID to a process name.
> @@ -193,10 +215,11 @@ REST OF TRACE-CMD HEADER
>  
>      "flyrecord\0"
>  
> -  If it is "options  \0" then:
> +  If it is "options  \0" then follows a section with trace options.
> +  If the file version is 7 or greater, this section is compressed.
>  
>    The next 2 bytes are a 16-bit word defining the current option.
> -  If the the value is zero then there are no more options.
> +  If the value is zero then there are no more options.
>  
>    Otherwise, the next 4 bytes contain a 32-bit word containing the
>    option size. If the reader does not know how to handle the option
> @@ -206,6 +229,25 @@ REST OF TRACE-CMD HEADER
>    The next option will be directly after the previous option, and
>    the options ends with a zero in the option type field.
>  
> +COMPRESSION FORMAT OF THE TRACE DATA
> +------------------------------------
> +
> +  If the file version is 7 or greater, the tarce data is compressed

Typo "trace data"

And this is where we definitely need to make it optional. We currently
do not have a safe way to read this file. The "uncompress to /tmp" is
not a reliable way to do this. And again, people can likely want to
have the header compressed but not the data, due to speed in reading.

-- Steve

> +  with the compression algorithm, specified in the compression header.
> +  The data is compressed in chunks. The size of one compression chunk
> +  is defined when the file is written. The format of compressed trace
> +  data is:
> +     <4 bytes> unsigned int, count of chunks.
> +     Follows the compressed chunks of givent count. For each chunk:
> +        <4 bytes> unsigned int, size of compressed data in this chunk.
> +        <4 bytes> unsigned int, size of uncompressed data.
> +        <data> binary compressed data, with the specified size.
> +  These chunks must be uncompressed on reading. The described format of
> +  trace data refers to the uncomperssed data.
> +
> +TRACE DATA
> +----------
> +
>    The next 10 bytes after the options are one of the following:
>  
>    "latency  \0"
> @@ -217,6 +259,7 @@ REST OF TRACE-CMD HEADER
>    If the value is "latency  \0", then the rest of the file is
>    simply ASCII text that was taken from the target's:
>    debugfs/tracing/trace
> +  If the file version is 7 or greater, the latency data is compressed.
>  
>    If the value is "flyrecord\0", the following is present:
>  
> @@ -232,6 +275,7 @@ REST OF TRACE-CMD HEADER
>  CPU DATA
>  --------
>  
> +  If the file version is 7 or greater, the CPU data is compressed.
>    The CPU data is located in the part of the file that is specified
>    in the end of the header. Padding is placed between the header and
>    the CPU data, placing the CPU data at a page aligned (target page) position


  reply	other threads:[~2021-06-22  0:37 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-14  7:49 [PATCH v6 00/45] Add trace file compression Tzvetomir Stoyanov (VMware)
2021-06-14  7:49 ` [PATCH v6 01/45] trace-cmd library: Remove unused private APIs for creating trace files Tzvetomir Stoyanov (VMware)
2021-06-14  7:49 ` [PATCH v6 02/45] trace-cmd library: Remove unused API tracecmd_update_option Tzvetomir Stoyanov (VMware)
2021-06-14  7:49 ` [PATCH v6 03/45] trace-cmd: Check if file version is supported Tzvetomir Stoyanov (VMware)
2021-06-21 22:27   ` Steven Rostedt
2021-06-21 22:36     ` Steven Rostedt
2021-06-14  7:49 ` [PATCH v6 04/45] trace-cmd library: Add new API to get file version of input handler Tzvetomir Stoyanov (VMware)
2021-06-14  7:49 ` [PATCH v6 05/45] trace-cmd library: Select the file version when writing trace file Tzvetomir Stoyanov (VMware)
2021-06-14  7:49 ` [PATCH v6 06/45] trace-cmd: Add APIs for library initialization and free Tzvetomir Stoyanov (VMware)
2021-06-14  7:49 ` [PATCH v6 07/45] trace-cmd library: Add support for compression algorithms Tzvetomir Stoyanov (VMware)
2021-06-14  7:49 ` [PATCH v6 08/45] trace-cmd list: Show supported " Tzvetomir Stoyanov (VMware)
2021-06-14  7:49 ` [PATCH v6 09/45] trace-cmd library: Bump the trace file version to 7 Tzvetomir Stoyanov (VMware)
2021-06-14  7:49 ` [PATCH v6 10/45] trace-cmd library: Compress part of the trace file Tzvetomir Stoyanov (VMware)
2021-06-14  7:49 ` [PATCH v6 11/45] trace-cmd library: Read compressed " Tzvetomir Stoyanov (VMware)
2021-06-14  7:49 ` [PATCH v6 12/45] trace-cmd library: Add new API to get compression of input handler Tzvetomir Stoyanov (VMware)
2021-06-14  7:49 ` [PATCH v6 13/45] trace-cmd library: Inherit compression algorithm from input file Tzvetomir Stoyanov (VMware)
2021-06-14  7:49 ` [PATCH v6 14/45] trace-cmd library: Extend the create file APIs to support different compression Tzvetomir Stoyanov (VMware)
2021-06-14  7:49 ` [PATCH v6 15/45] trace-cmd record: Add new parameter --compression Tzvetomir Stoyanov (VMware)
2021-06-14  7:50 ` [PATCH v6 16/45] trace-cmd dump: Add support for trace files version 7 Tzvetomir Stoyanov (VMware)
2021-06-14  7:50 ` [PATCH v6 17/45] trace-cmd library: Add support for zlib compression library Tzvetomir Stoyanov (VMware)
2021-06-22  1:26   ` Steven Rostedt
2021-06-22 10:29     ` Tzvetomir Stoyanov
2021-06-22 13:31       ` Steven Rostedt
2021-06-14  7:50 ` [PATCH v6 18/45] trace-cmd library: Hide the logic for updating buffer offset Tzvetomir Stoyanov (VMware)
2021-06-22  2:10   ` Steven Rostedt
2021-06-14  7:50 ` [PATCH v6 19/45] trace-cmd: Move buffers description outside of options Tzvetomir Stoyanov (VMware)
2021-06-21 23:07   ` Steven Rostedt
2021-06-14  7:50 ` [PATCH v6 20/45] trace-cmd library: Track the offset in the option section in the trace file Tzvetomir Stoyanov (VMware)
2021-06-14  7:50 ` [PATCH v6 21/45] trace-cmd library: Add compression of the option section of " Tzvetomir Stoyanov (VMware)
2021-06-21 23:10   ` Steven Rostedt
2021-06-22 10:43     ` Tzvetomir Stoyanov
2021-06-14  7:50 ` [PATCH v6 22/45] trace-cmd library: Refactor the logic for writing trace data in the file Tzvetomir Stoyanov (VMware)
2021-06-21 23:12   ` Steven Rostedt
2021-06-14  7:50 ` [PATCH v6 23/45] trace-cmd library: Add APIs for read and write compressed data in chunks Tzvetomir Stoyanov (VMware)
2021-06-14  7:50 ` [PATCH v6 24/45] trace-cmd: Compress trace data Tzvetomir Stoyanov (VMware)
2021-06-14  7:50 ` [PATCH v6 25/45] trace-cmd: Read compressed " Tzvetomir Stoyanov (VMware)
2021-06-21 23:23   ` Steven Rostedt
2021-06-22 10:50     ` Tzvetomir Stoyanov
2021-06-22 13:51       ` Steven Rostedt
2021-06-14  7:50 ` [PATCH v6 26/45] trace-cmd library: Compress latency " Tzvetomir Stoyanov (VMware)
2021-06-14  7:50 ` [PATCH v6 27/45] trace-cmd: Read compressed " Tzvetomir Stoyanov (VMware)
2021-06-14  7:50 ` [PATCH v6 28/45] trace-cmd library: Reuse within the library the function that checks file state Tzvetomir Stoyanov (VMware)
2021-06-14  7:50 ` [PATCH v6 29/45] trace-cmd library: Make tracecmd_copy_headers() to work with output handler Tzvetomir Stoyanov (VMware)
2021-06-14  7:50 ` [PATCH v6 30/45] trace-cmd: Do not use trace file compression with streams Tzvetomir Stoyanov (VMware)
2021-06-14  7:50 ` [PATCH v6 31/45] trace-cmd library: Add new API to get file version of output handler Tzvetomir Stoyanov (VMware)
2021-06-14  7:50 ` [PATCH v6 32/45] trace-cmd: Add file state parameter to tracecmd_copy Tzvetomir Stoyanov (VMware)
2021-06-14  7:50 ` [PATCH v6 33/45] trace-cmd: Copy CPU count in tracecmd_copy Tzvetomir Stoyanov (VMware)
2021-06-21 23:27   ` Steven Rostedt
2021-06-14  7:50 ` [PATCH v6 34/45] trace-cmd: Copy buffers description " Tzvetomir Stoyanov (VMware)
2021-06-14  7:50 ` [PATCH v6 35/45] trace-cmd: Copy options " Tzvetomir Stoyanov (VMware)
2021-06-14  7:50 ` [PATCH v6 36/45] trace-cmd library: Refactor the logic for writing CPU trace data Tzvetomir Stoyanov (VMware)
2021-06-14  7:50 ` [PATCH v6 37/45] trace-cmd library: Refactor the logic for writing CPU instance " Tzvetomir Stoyanov (VMware)
2021-06-14  7:50 ` [PATCH v6 38/45] trace-cmd: Copy trace data in tracecmd_copy Tzvetomir Stoyanov (VMware)
2021-06-14  7:50 ` [PATCH v6 39/45] trace-cmd: Add compression parameter to tracecmd_copy Tzvetomir Stoyanov (VMware)
2021-06-14  7:50 ` [PATCH v6 40/45] trace-cmd: Add new command "trace-cmd convert" Tzvetomir Stoyanov (VMware)
2021-06-14  7:50 ` [PATCH v6 41/45] trace-cmd record: Update man page Tzvetomir Stoyanov (VMware)
2021-06-14  7:50 ` [PATCH v6 42/45] trace-cmd: Add convert " Tzvetomir Stoyanov (VMware)
2021-06-14  7:50 ` [PATCH v6 43/45] trace-cmd: Update bash completion Tzvetomir Stoyanov (VMware)
2021-06-14  7:50 ` [PATCH v6 44/45] trace-cmd list: Update the man page Tzvetomir Stoyanov (VMware)
2021-06-14  7:50 ` [PATCH v6 45/45] trace-cmd: Update trace.dat " Tzvetomir Stoyanov (VMware)
2021-06-22  0:37   ` Steven Rostedt [this message]
2021-06-22 11:05     ` Tzvetomir Stoyanov
2021-06-22 13:58       ` Steven Rostedt
2021-06-22  2:22 ` [PATCH v6 00/45] Add trace file compression Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210621203716.17121623@oasis.local.home \
    --to=rostedt@goodmis.org \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=tz.stoyanov@gmail.com \
    --subject='Re: [PATCH v6 45/45] trace-cmd: Update trace.dat man page' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).