From patchwork Wed Jan 26 09:55:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Tzvetomir Stoyanov (VMware)" X-Patchwork-Id: 12724872 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7677C2BA4C for ; Wed, 26 Jan 2022 09:55:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239416AbiAZJzh (ORCPT ); Wed, 26 Jan 2022 04:55:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230405AbiAZJzg (ORCPT ); Wed, 26 Jan 2022 04:55:36 -0500 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C99A1C06161C for ; Wed, 26 Jan 2022 01:55:35 -0800 (PST) Received: by mail-ed1-x535.google.com with SMTP id j23so63041598edp.5 for ; Wed, 26 Jan 2022 01:55:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MGXHuQX5vwaqYPPtMcMPtJdnP+a4bN96V7nhqFeCZ9w=; b=ZI0yeNtS3qxuBuv3JMtK9zI9vO6kBLA5ZN/dlz9/R5gh5UJz5sBl8hPA36M+0pSctp b0EhaNHbZB+QpKAW7gs4PEKNr1SUDa9jabHKzeQSj2PnIdWTxScgqTifuIZuqHoKcIxG njMH7p9lgJ0TYEC99/w0QzCT0Q1nteXm7PDadTSRDqnwbuWX5Z5lxKhCcHUdHR7+R/3T Nu2M1LAcdIKuM6yhD0RUd9ooJ+ObstnXmkwpEcf37EgpN6sAOsTFx2n+hDwvijdmEHDi EEpNRtgN5ZDmQudBXSUp8Rp/f0cxMhQ2FFu+S27TmFYS1di/JmK7q1LAn00teOwRvR7g o8mA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MGXHuQX5vwaqYPPtMcMPtJdnP+a4bN96V7nhqFeCZ9w=; b=MjgldQPT5X8wYoc+p7tDmMTTFt7QWEzyJXkEWYSukdCvC1RORKM9855sxWHU458rW5 XBut/9BoGeHpYdUSEjWGYt+Fl+htaGLq9ABDLmDC8XEzH2sEs0DCWTwUG75RgnIF84rT umAcRaXGmwKTwuLPL5pVaeqkBx53DnrUUmkabcB0aPw0rjCH6bS8a8/CmlcS5tjfuZpE 6DX1gz44qHC/4Jfr2/EQEOsnwSKant4XowQvyfu9Q/CMMNmVHAI/0JqmG47V7rQ9u0dI bCVGkFGIK2sZDSwQaPCRaoxZGefeZJTYTzD6J641SmEC+LrugSg9P0aACp4nQJpMK2f7 J9bQ== X-Gm-Message-State: AOAM531DQjmPsrOu8UeWRWSmd5cHkqAMw0WTmZMVrOUO0lS+YfNqXhbv 4/nv66Klxjb+z0FhLw8DszHWtBq2JuQ= X-Google-Smtp-Source: ABdhPJwhxOq3j70gk3WQM6vAUqiWfnHcEErlMbY/luuhFwcMPYqBWhIIbdlbeaQRK78hoH7fVUReXg== X-Received: by 2002:a05:6402:5109:: with SMTP id m9mr10580561edd.337.1643190934423; Wed, 26 Jan 2022 01:55:34 -0800 (PST) Received: from oberon.zico.biz ([151.251.254.11]) by smtp.gmail.com with ESMTPSA id z25sm9563070edm.60.2022.01.26.01.55.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jan 2022 01:55:33 -0800 (PST) From: "Tzvetomir Stoyanov (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org Subject: [PATCH v8 1/4] trace-cmd: Update bash completion Date: Wed, 26 Jan 2022 11:55:27 +0200 Message-Id: <20220126095530.571035-2-tz.stoyanov@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220126095530.571035-1-tz.stoyanov@gmail.com> References: <20220126095530.571035-1-tz.stoyanov@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org Added convert subcommand and its arguments to bash completion logic. Signed-off-by: Tzvetomir Stoyanov (VMware) --- tracecmd/trace-cmd.bash | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/tracecmd/trace-cmd.bash b/tracecmd/trace-cmd.bash index b01c7a07..6639c143 100644 --- a/tracecmd/trace-cmd.bash +++ b/tracecmd/trace-cmd.bash @@ -64,6 +64,13 @@ plugin_options() COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) } +compression_param() +{ + local opts=$(trace-cmd list -c | grep -v 'Supported' | cut -d "," -f1) + opts+=" any none " + COMPREPLY=( $(compgen -W "${opts}") ) +} + __trace_cmd_list_complete() { local prev=$1 @@ -181,6 +188,9 @@ __trace_cmd_record_complete() cmd_options record "$cur" fi ;; + --compression) + compression_param + ;; *) # stream start and profile do not show all options cmd_options record "$cur" @@ -222,6 +232,29 @@ __trace_cmd_dump_complete() esac } +__trace_cmd_convert_complete() +{ + local prev=$1 + local cur=$2 + shift 2 + local words=("$@") + + case "$prev" in + -i) + __show_files + ;; + -o) + __show_files + ;; + --compression) + compression_param + ;; + *) + cmd_options convert "$cur" + ;; + esac +} + __show_command_options() { local command="$1" @@ -298,6 +331,10 @@ _trace_cmd_complete() __trace_cmd_dump_complete "${prev}" "${cur}" ${words[@]} return 0 ;; + convert) + __trace_cmd_convert_complete "${prev}" "${cur}" ${words[@]} + return 0 + ;; *) __show_command_options "$w" "${prev}" "${cur}" ;; From patchwork Wed Jan 26 09:55:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Tzvetomir Stoyanov (VMware)" X-Patchwork-Id: 12724873 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7173C63684 for ; Wed, 26 Jan 2022 09:55:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230405AbiAZJzi (ORCPT ); Wed, 26 Jan 2022 04:55:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239417AbiAZJzh (ORCPT ); Wed, 26 Jan 2022 04:55:37 -0500 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF522C061744 for ; Wed, 26 Jan 2022 01:55:36 -0800 (PST) Received: by mail-ed1-x536.google.com with SMTP id a18so67977222edj.7 for ; Wed, 26 Jan 2022 01:55:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xuzowlWIX2UC2O8JefGA4cnKiIjtzXvEFXeW0uStPxY=; b=akbjtsvMrHdA14aZpQdr/lK5v3CQtbQqTR7CR6MWyEDyokffD3Ggzs+bazFQ1SI+kO S4XHqUzywjUPLAJG5r4Xyf+pR3LJAhYm4+tYrK1yzimucLGMMl5xpefTQWfemhp349wA /nLW4h6QoYKunANZ7dRrQd1Mer8NoCUhP+ng4i297JilODKRnS8a63XOpbSC9Xx2HHTC OJfSQb8UU5+ZstdlohvrcZIp5+26tog8CNOGNA55Eu9FuvON2mg1TYbk9BwxFU6+2613 flNfJEB1lPanmF8QwYxs7Uv+nMLE387B0+SPDV2Nmrq9mbDgfKuTaFWcs8iAOc4ECx3j KyWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xuzowlWIX2UC2O8JefGA4cnKiIjtzXvEFXeW0uStPxY=; b=VrAX1jvvsqjwRTNs9zbNfpRlcA66+KJDSQeKhvRXZkXQOqrQXofll4/rKW03fcaR+m 99My5lnPs5dt2UL3NHVcBxCNZADsLhWIRxF8QjO0KwAd7bugdpJCKzT8Ebqi4N/rl10Q dnKqKUFbtKGbtc64zxNKoQA3ThIJdvnn4P1AxPhaVxL8hA+5/7cyk3wGUqnxTqofQCdw InXDE3zUaP1AXJBth9msLzIMMCAgGuOBCPX3dE5bz1LZcveNWstF6j3QZKsunye8rLDS UtxDyYzLGDpc6YcLIb7rAw3aKDNZmdwQfKBt1DikLFs9+DImyITVHFWhzOtB5ZNYBMJR s0DQ== X-Gm-Message-State: AOAM5331gPB5qkciv7NHWQ3L2Esa74nd3mccdg5JeUeiU6Ws7/+CiJKV KMlX8W/KUYc6KsSb3MLoQykvJxI7Pow= X-Google-Smtp-Source: ABdhPJxTNd+wBqZDCmOJKchmVpVKJGuU1hH7ob2Qxbzywq6dlo/VUwYljbUq09WlxwYW2Z4zUfqYig== X-Received: by 2002:a05:6402:5106:: with SMTP id m6mr15358554edd.292.1643190935571; Wed, 26 Jan 2022 01:55:35 -0800 (PST) Received: from oberon.zico.biz ([151.251.254.11]) by smtp.gmail.com with ESMTPSA id z25sm9563070edm.60.2022.01.26.01.55.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jan 2022 01:55:35 -0800 (PST) From: "Tzvetomir Stoyanov (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org Subject: [PATCH v8 2/4] tarce-cmd: Man page for "trace-cmd convert" Date: Wed, 26 Jan 2022 11:55:28 +0200 Message-Id: <20220126095530.571035-3-tz.stoyanov@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220126095530.571035-1-tz.stoyanov@gmail.com> References: <20220126095530.571035-1-tz.stoyanov@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org Documented new "trace-cmd convert" subcommand. Signed-off-by: Tzvetomir Stoyanov (VMware) --- .../trace-cmd/trace-cmd-convert.1.txt | 65 +++++++++++++++++++ Documentation/trace-cmd/trace-cmd.1.txt | 4 +- 2 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 Documentation/trace-cmd/trace-cmd-convert.1.txt diff --git a/Documentation/trace-cmd/trace-cmd-convert.1.txt b/Documentation/trace-cmd/trace-cmd-convert.1.txt new file mode 100644 index 00000000..7c13cf3d --- /dev/null +++ b/Documentation/trace-cmd/trace-cmd-convert.1.txt @@ -0,0 +1,65 @@ +TRACE-CMD-CONVERT(1) +=================== + +NAME +---- +trace-cmd-convert - convert trace files + +SYNOPSIS +-------- +*trace-cmd convert* ['OPTIONS'] ['output-file'] + +DESCRIPTION +----------- +The trace-cmd(1) convert command converts trace file. It reads the input file and copies the data +into an output file. The output file may be in different format, depending on the command line +arguments. + +OPTIONS +------- +*-i* 'input-file':: + By default, trace-cmd convert will read the file 'trace.dat'. But the *-i* + option open up the given 'input-file' instead. + +*-o* 'out-file':: + The name of the output file, this parameter is mandatory. Note, the output file may also be + specified as the last item on the command line. + +*--file-version*:: + Desired version of the output file. Supported versions are 6 or 7. + +*--compression*:: + Compression of the trace output file, one of these strings can be passed: + + 'any' - auto select the best available compression algorithm + + 'none' - do not compress the trace file + + 'name' - the name of the desired compression algorithms. Available algorithms can be listed with + trace-cmd list -c + +*--help*:: + Print usage information. + +EXAMPLES +-------- + +# trace-cmd convert --compression any trace_compress.dat + +SEE ALSO +-------- +trace-cmd(1), trace-cmd.dat(1) + +AUTHOR +------ +*Steven Rostedt* , author of *trace-cmd*. +*Tzvetomir Stoyanov* , author of this man page. + +RESOURCES +--------- +https://git.kernel.org/pub/scm/utils/trace-cmd/trace-cmd.git/ + +COPYING +------- +Copyright \(C) 2021 VMware. Free use of this software is granted under +the terms of the GNU Public License (GPL). diff --git a/Documentation/trace-cmd/trace-cmd.1.txt b/Documentation/trace-cmd/trace-cmd.1.txt index b330b4fe..27c6e973 100644 --- a/Documentation/trace-cmd/trace-cmd.1.txt +++ b/Documentation/trace-cmd/trace-cmd.1.txt @@ -58,6 +58,8 @@ COMMANDS check-events - parse format strings for all trace events and return whether all formats are parseable + convert - convert trace files + OPTIONS ------- @@ -70,7 +72,7 @@ SEE ALSO -------- trace-cmd-record(1), trace-cmd-report(1), trace-cmd-hist(1), trace-cmd-start(1), trace-cmd-stop(1), trace-cmd-extract(1), trace-cmd-reset(1), -trace-cmd-restore(1), trace-cmd-stack(1), +trace-cmd-restore(1), trace-cmd-stack(1), trace-cmd-convert(1), trace-cmd-split(1), trace-cmd-list(1), trace-cmd-listen(1), trace-cmd.dat(5), trace-cmd-check-events(1) trace-cmd-stat(1) From patchwork Wed Jan 26 09:55:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Tzvetomir Stoyanov (VMware)" X-Patchwork-Id: 12724874 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6244C2BA4C for ; Wed, 26 Jan 2022 09:55:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239425AbiAZJzj (ORCPT ); Wed, 26 Jan 2022 04:55:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239417AbiAZJzi (ORCPT ); Wed, 26 Jan 2022 04:55:38 -0500 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 216A2C06161C for ; Wed, 26 Jan 2022 01:55:38 -0800 (PST) Received: by mail-ej1-x631.google.com with SMTP id me13so37860303ejb.12 for ; Wed, 26 Jan 2022 01:55:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pk2Jdd+0pV2MRmI4hP30SWHmhN1KGy5w659LlLasgEc=; b=JTWUftGoa+k0fL+6PFbuWSk7DQ8QiJhTYwAE5czA8zbty85CvQaQzzZy7dB6iJeXDa 6xne85gIC1kVbmKi5gKS92H/ruepr6aIXBinsBKhqDvneI0QJX982+y039zc+4ToThun 1QHvKrO635O1sJUoGd6D6lAlg57RW0iUX9u9evc+9M534qkcVqxpr1+5uZW0cX1wm2wl 9QR1oy6g2G0Io1J2sS6h4OmkLiT/Eb+9AKR9MbDdyTMo3nwEGTlLC4M5bRJwiZlb4cXG FH0XvXzDyD+/Sefpy8T5BZT97TMEaVhrI/vlzaRCaTOyww7sbvatWzYepK1+yaQ8THAu 1Plg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pk2Jdd+0pV2MRmI4hP30SWHmhN1KGy5w659LlLasgEc=; b=aIk346yRpIwMOmNvqr6v+8mzpNkjHujLAppeelN2WKxR7OYVMuDk9FZep6OWnzwIJ1 QGUV/xH3smIAhZeo9EHStrWF5MWszmpBm2wmB7S72XlKQOwmz+mzYHJ5b7KDTU2/5ElW r6xQg1V25q7ng8S7U/gk478rYgWSTJNqVV/NzJvBJPoxX+cZr7/Kwyu4HgriqGG3Saxe gUQZZdxziGm6aLfzaMw/9Tr7wpPLaJWOMZbJC6Ikb2asC4XM5jJrVrm5cWo3ArK5gMMC 23VoYeAZg3wJMNfvlcxR1yVb54t/BUpPAe9QT7PUMOwAGVeLy8wHImaqccjv8u0ZjVs4 KJeQ== X-Gm-Message-State: AOAM533Wwf+x/XRG3aJpKSj/7z1tk1N38n8RGTcx3ycK1G74oGDFlp3w t0/5WZ12rXUYMFlpBxxoEOREVVTznJc= X-Google-Smtp-Source: ABdhPJxQG2kqs43ZxgkqDMHAkGVnltwmlX+1PjexV/DSTMzNiyHvonhF2r/5xl2yZ58rTeLV0fDPLw== X-Received: by 2002:a17:906:4945:: with SMTP id f5mr19255453ejt.429.1643190936766; Wed, 26 Jan 2022 01:55:36 -0800 (PST) Received: from oberon.zico.biz ([151.251.254.11]) by smtp.gmail.com with ESMTPSA id z25sm9563070edm.60.2022.01.26.01.55.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jan 2022 01:55:36 -0800 (PST) From: "Tzvetomir Stoyanov (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org Subject: [PATCH v8 3/4] tarce-cmd: Update record man page Date: Wed, 26 Jan 2022 11:55:29 +0200 Message-Id: <20220126095530.571035-4-tz.stoyanov@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220126095530.571035-1-tz.stoyanov@gmail.com> References: <20220126095530.571035-1-tz.stoyanov@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org Documented new arguments of the "trace-cmd record" subcommand: --compression --file-version Signed-off-by: Tzvetomir Stoyanov (VMware) --- Documentation/trace-cmd/trace-cmd-record.1.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Documentation/trace-cmd/trace-cmd-record.1.txt b/Documentation/trace-cmd/trace-cmd-record.1.txt index 96c27108..b3620474 100644 --- a/Documentation/trace-cmd/trace-cmd-record.1.txt +++ b/Documentation/trace-cmd/trace-cmd-record.1.txt @@ -377,6 +377,19 @@ OPTIONS trace-cmd record --verbose=warning +*--file-version*:: + Desired version of the output file. Supported versions are 6 or 7. + +*--compression*:: + Compression of the trace output file, one of these strings can be passed: + + 'any' - auto select the best available compression algorithm + + 'none' - do not compress the trace file + + 'name' - the name of the desired compression algorithms. Available algorithms can be listed with + trace-cmd list -c + EXAMPLES -------- From patchwork Wed Jan 26 09:55:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Tzvetomir Stoyanov (VMware)" X-Patchwork-Id: 12724875 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83A08C2BA4C for ; Wed, 26 Jan 2022 09:55:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239428AbiAZJzl (ORCPT ); Wed, 26 Jan 2022 04:55:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239427AbiAZJzk (ORCPT ); Wed, 26 Jan 2022 04:55:40 -0500 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAB0DC06161C for ; Wed, 26 Jan 2022 01:55:39 -0800 (PST) Received: by mail-ej1-x62f.google.com with SMTP id s13so37762228ejy.3 for ; Wed, 26 Jan 2022 01:55:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hvb6amZJl7bvYTdKpfIXtpCwW1HiTW6w3thUoE4zrLU=; b=H3uR7BBBt3gFOh9GKH8v5WCRZdb8qKymiE0iGuQJc8kO0sCJq2Wxr51thDaeU6MHk7 bmLbAkiPsjs37QFknA8StZuGr03ELM+WZjfFdpgOKWzOUmeqNPKqpqyqKv1XDKajTByu MeUtpztVfb6yQArFxI4/MjrerdeP6nnAU3BitrXb8YpWY9hPcmFqsw45yS6JtDIbQBWL FJJtakoryvwRm3djIlaLImlSZE3rKjHMmhsPsKndZpn5bl8qCWb2xeWS9YvnPE3w4tS8 DaS/8LlqfjhQdkH7QmJCucw6eCUnrGMzyTSVQFthY2RMX5ASq/ClMIR/wNisuBN5dZF2 FRmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hvb6amZJl7bvYTdKpfIXtpCwW1HiTW6w3thUoE4zrLU=; b=Fwl8HXu1R7RxETb872TQM7c/iNAcdTdp9CY+9+Q7vSx+gAt1kAiNRcz3xJ9HRCtbfb VCqZa7AwheMaG7seAuwMHU4RZalGexCprEKmhXleZWlsfCKOeDLDe2Ypvy/7PFYOpN9X VJGtCinpLnwrtxtQJjSCTJ26N4XSOrWuM8tm/SRHgR3eRMNFKTVLCsrTw0W/uWV4tkmT NL1w3wFB3yc8qs8/md81z1sPJZaoY14GEPiRSnFgcV1QKkppV3IpiWNW1k75guZLJiV1 ZbLS71W28ANvwnpWIqWEx3hanYiP2RVlTIQE5enejdQtbLNgPkrOVcP3Puz0Vt1RQd5p KFHQ== X-Gm-Message-State: AOAM5333XYVj/VD9B1IjShdlvNzJxv5b0WxmTC7ZjQxyiXjSsnZcmnbI 4SjsUm4mdZAekRCkUrA3ikNdzZObmOs= X-Google-Smtp-Source: ABdhPJxedKV+J6a6b+jp5Ylrbq5QMKYPQJ61Ob6MYJJkpIS4c3wXatlxgEc5Gyu8Yy3FCapX39Ircg== X-Received: by 2002:a17:906:58c8:: with SMTP id e8mr18688216ejs.380.1643190938135; Wed, 26 Jan 2022 01:55:38 -0800 (PST) Received: from oberon.zico.biz ([151.251.254.11]) by smtp.gmail.com with ESMTPSA id z25sm9563070edm.60.2022.01.26.01.55.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jan 2022 01:55:37 -0800 (PST) From: "Tzvetomir Stoyanov (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org Subject: [PATCH v8 4/4] trace-cmd: Document trace file version 7 Date: Wed, 26 Jan 2022 11:55:30 +0200 Message-Id: <20220126095530.571035-5-tz.stoyanov@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220126095530.571035-1-tz.stoyanov@gmail.com> References: <20220126095530.571035-1-tz.stoyanov@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org Trace file versions 6 and 7 have a lot of differences. Added new man page describing the version 7 and renamed the existing trace-cmd.dat page for version 6 only. Signed-off-by: Tzvetomir Stoyanov (VMware) --- ...e-cmd.dat.5.txt => trace-cmd.dat.v6.5.txt} | 9 +- .../trace-cmd/trace-cmd.dat.v7.5.txt | 450 ++++++++++++++++++ 2 files changed, 454 insertions(+), 5 deletions(-) rename Documentation/trace-cmd/{trace-cmd.dat.5.txt => trace-cmd.dat.v6.5.txt} (98%) create mode 100644 Documentation/trace-cmd/trace-cmd.dat.v7.5.txt diff --git a/Documentation/trace-cmd/trace-cmd.dat.5.txt b/Documentation/trace-cmd/trace-cmd.dat.v6.5.txt similarity index 98% rename from Documentation/trace-cmd/trace-cmd.dat.5.txt rename to Documentation/trace-cmd/trace-cmd.dat.v6.5.txt index 8d285353..8437b363 100644 --- a/Documentation/trace-cmd/trace-cmd.dat.5.txt +++ b/Documentation/trace-cmd/trace-cmd.dat.v6.5.txt @@ -1,9 +1,9 @@ -TRACE-CMD.DAT(5) -================ +TRACE-CMD.DAT.v6(5) +=================== NAME ---- -trace-cmd.dat - trace-cmd file format +trace-cmd.dat.v6 - trace-cmd version 6 file format SYNOPSIS -------- @@ -30,7 +30,7 @@ INITIAL FORMAT "tracing" The next set of characters contain a null '\0' terminated string - that contains the version of the file (for example): + that contains the version of the file: "6\0" @@ -264,4 +264,3 @@ COPYING ------- Copyright \(C) 2010 Red Hat, Inc. Free use of this software is granted under the terms of the GNU Public License (GPL). - diff --git a/Documentation/trace-cmd/trace-cmd.dat.v7.5.txt b/Documentation/trace-cmd/trace-cmd.dat.v7.5.txt new file mode 100644 index 00000000..1b556bba --- /dev/null +++ b/Documentation/trace-cmd/trace-cmd.dat.v7.5.txt @@ -0,0 +1,450 @@ +TRACE-CMD.DAT.v7(5) +=================== + +NAME +---- +trace-cmd.dat.v7 - trace-cmd version 7 file format + +SYNOPSIS +-------- +*trace-cmd.dat* ignore + +DESCRIPTION +----------- +The trace-cmd(1) utility produces a "trace.dat" file. The file may also +be named anything depending if the user specifies a different output name, +but it must have a certain binary format. The file is used +by trace-cmd to save kernel traces into it and be able to extract +the trace from it at a later point (see *trace-cmd-report(1)*). + + +INITIAL FORMAT +-------------- + + The first three bytes contain the magic value: + + 0x17 0x08 0x44 + + The next 7 bytes contain the characters: + + "tracing" + + The next set of characters contain a null '\0' terminated string + that contains the version of the file: + + "7\0" + + The next 1 byte contains the flags for the file endianess: + + 0 = little endian + 1 = big endian + + The next byte contains the number of bytes per "long" value: + + 4 - 32-bit long values + 8 - 64-bit long values + + Note: This is the long size of the target's user space. Not the + kernel space size. + + [ Now all numbers are written in file defined endianess. ] + + The next 4 bytes are a 32-bit word that defines what the traced + host machine page size was. + + The compression algorithm header is written next: + "name\0version\0" + where "name" and "version" are strings, name and version of the + compression algorithm used to compress the trace file. If the name + is "none", the data in the file is not compressed. + + The next 8 bytes are 64-bit integer, the offset within the file where + the first OPTIONS section is located. + + The rest of the file consists of different sections. The only mandatory + is the first OPTIONS section, all others are optional. The location and + the order of the sections is not strict. Each section starts with a header: + +FORMAT OF THE SECTION HEADER +---------------------------- + <2 bytes> unsigned short integer, ID of the section. + <2 bytes> unsigned short integer, section flags: + 1 = the section is compressed. + <4 bytes> ID of a string, description of the section. + <4 bytes> unsigned integer, size of the section in the file. + + If the section is compressed, the above is the compressed size. + The section must be uncompressed on reading. The described format of + the sections refers to the uncompressed data. + +COMPRESSION FORMAT OF THE FILE SECTIONS +--------------------------------------- + + Some of the sections in the file may be compressed with the compression algorithm, + specified in the compression algorithm header. Compressed sections have a compression + header, written after the section header and right before the compressed data: + <4 bytes> unsigned int, size of compressed data in this section. + <4 bytes> unsigned int, size of uncompressed data. + binary compressed data, with the specified size. + +COMPRESSION FORMAT OF THE TRACE DATA +------------------------------------ + + There are two special sections, BUFFER FLYRECORD and BUFFER LATENCY, containing + trace data. These sections may be compressed with the compression algorithm, specified + in the compression header. Usually the size of these sections is huge, that's why its + compression format is different from the other sections. The trace data is compressed + in chunks The size of one chunk is specified in the file creation time. The format + of compressed trace data is: + <4 bytes> unsigned int, count of chunks. + Follows the compressed chunks of given count. For each chunk: + <4 bytes> unsigned int, size of compressed data in this chunk. + <4 bytes> unsigned int, size of uncompressed data, aligned with the trace page size. + binary compressed data, with the specified size. + These chunks must be uncompressed on reading. The described format of + trace data refers to the uncompressed data. + +OPTIONS SECTION +--------------- + + Section ID: 0 + + This is the the only mandatory section in the file. There can be multiple + options sections, the first one is located at the offset specified right + after the compression algorithm header. The section consists of multiple + trace options, each option has the following format: + <2 bytes> unsigned short integer, ID of the option. + <4 bytes> unsigned integer, size of the option's data. + bytes of the size specified above, data of the option. + + + Options, supported by the trace file version 7: + + DONE: id 0, size 8 + This option indicates the end of the options section, it is written + always as last option. The DONE option data is: + <8 bytes> long long unsigned integer, offset in the trace file where + the next options section is located. If this offset is 0, then there + are no more options sections. + + DATE: id 1, size vary + The DATE option data is a null terminated ASCII string, which represents + the time difference between trace events timestamps and the Generic Time + of Day of the system. + + CPUSTAT: id 2, size vary + The CPUSTAT option data is a null terminated ASCII string, the content of the + "per_cpu/cpu/stats" file from the trace directory. There is a CPUSTAT option + for each CPU. + + BUFFER: id 3, size vary + The BUFFER option describes the flyrecord trace data saved in the file, collected + from one trace instance. There is BUFFER option for each trace instance. The format + of the BUFFER data is: + <8 bytes> long long unsigned integer, offset in the trace file where the + BUFFER FLYRECORD section is located, containing flyrecord trace data. + a null terminated ASCII string, name of the trace instance. Empty string "" + is saved as name of the top instance. + a null terminated ASCII string, trace clock used for events timestamps in + this trace instance. + <4 bytes> unsigned integer, count of the CPUs with trace data. + For each CPU of the above count: + <4 bytes> unsigned integer, ID of the CPU. + <8 bytes> long long unsigned integer, offset in the trace file where the trace data + for this CPU is located. + <8 bytes> long long unsigned integer, size of the trace data for this CPU. + + TRACECLOCK: id 4, size vary + The TRACECLOCK option data is a null terminated ASCII string, the content of the + "trace_clock" file from the trace directory. + + UNAME: id 5, size vary + The UNAME option data is a null terminated ASCII string, identifying the system where + the trace data is collected. The string is retrieved by the uname() system call. + + HOOK: id 6, size vary + The HOOK option data is a null terminated ASCII string, describing event hooks: custom + event matching to connect any two events together. + + OFFSET: id 7, size vary + The OFFSET option data is a null terminated ASCII string, representing a fixed time that + is added to each event timestamp on reading. + + CPUCOUNT: id 8, size 4 + The CPUCOUNT option data is: + <4 bytes> unsigned integer, number of CPUs in the system. + + VERSION: id 9, size vary + The VERSION option data is a null terminated ASCII string, representing the version of + the trace-cmd application, used to collect these trace logs. + + PROCMAPS: id 10, size vary + The PROCMAPS option data is a null terminated ASCII string, representing the memory map + of each traced filtered process. The format of the string is, for each filtered process: + \n + \n + ... + separate line for each library, used by this process + ... + ... + + TRACEID: id 11, size 8 + The TRACEID option data is a unique identifier of this tracing session: + <8 bytes> long long unsigned integer, trace session identifier. + + TIME_SHIFT: id 12, size vary + The TIME_SHIFT option stores time synchronization information, collected during host and guest + tracing session. Usually it is saved in the guest trace file. This information is used to + synchronize guest with host events timestamps, when displaying all files from this tracing + session. The format of the TIME_SHIFT option data is: + <8 bytes> long long unsigned integer, trace identifier of the peer (usually the host). + <4 bytes> unsigned integer, flags specific to the time synchronization protocol, used in this + trace session. + <4 bytes> unsigned integer, number of traced CPUs. For each CPU, timestamps corrections + are recorded: + <4 bytes> unsigned integer, count of the recorded timestamps corrections for this CPU. + , times when the corrections are calculated + , corrections offsets + , corrections scaling ratio + + GUEST: id 13, size vary + The GUEST option stores information about traced guests in this tracing session. Usually it is + saved in the host trace file. There is a separate GUEST option for each traced guest. + The information is used when displaying all files from this tracing session. The format of + the GUEST option data is: + a null terminated ASCII string, name of the guest. + <8 bytes> long long unsigned integer, trace identifier of the guest for this session. + <4 bytes> unsigned integer, number of guest's CPUs. For each CPU: + <4 bytes> unsigned integer, ID of the CPU. + <4 bytes> unsigned integer, PID of the host task, emulating this guest CPU. + + TSC2NSEC: id 14, size 16 + The TSC2NSEC option stores information, used to convert TSC events timestamps to nanoseconds. + The format of the TSC2NSEC option data is: + <4 bytes> unsigned integer, time multiplier. + <4 bytes> unsigned integer, time shift. + <8 bytes> unsigned long long integer, time offset. + + HEADER_INFO: id 16, size 8 + The HEADER_INFO option data is: + <8 bytes> long long unsigned integer, offset into the trace file where the HEADER INFO + section is located + + FTRACE_EVENTS: id 17, size 8 + The FTRACE_EVENTS option data is: + <8 bytes> long long unsigned integer, offset into the trace file where the + FTRACE EVENT FORMATS section is located. + + EVENT_FORMATS: id 18, size 8 + The EVENT_FORMATS option data is: + <8 bytes> long long unsigned integer, offset into the trace file where the EVENT FORMATS + section is located. + + KALLSYMS: id 19, size 8 + The KALLSYMS option data is: + <8 bytes> long long unsigned integer, offset into the trace file where the KALLSYMS + section is located. + + PRINTK: id 20, size 8 + The PRINTK option data is: + <8 bytes> long long unsigned integer, offset into the trace file where the TRACE_PRINTK + section is located. + + CMDLINES: id 21, size 8 + The CMDLINES option data is: + <8 bytes> long long unsigned integer, offset into the trace file where the + SAVED COMMAND LINES section is located. + + BUFFER_TEXT: id 22, size + The BUFFER_LAT option describes the latency trace data saved in the file. The format + of the BUFFER_LAT data is: + <8 bytes> long long unsigned integer, offset in the trace file where the + BUFFER LATENCY section is located, containing latency trace data. + a null terminated ASCII string, name of the trace instance. Empty string "" + is saved as name of the top instance. + a null terminated ASCII string, trace clock used for events timestamps in + this trace instance. + + +HEADER INFO SECTION +------------------- + + Section ID: 16 + + The first 12 bytes of the section, after the section header, contain the string: + + "header_page\0" + + The next 8 bytes are a 64-bit word containing the size of the + page header information stored next. + + The next set of data is of the size read from the previous 8 bytes, + and contains the data retrieved from debugfs/tracing/events/header_page. + + Note: The size of the second field \fBcommit\fR contains the target + kernel long size. For example: + + field: local_t commit; offset:8; \fBsize:8;\fR signed:1; + + shows the kernel has a 64-bit long. + + The next 13 bytes contain the string: + + "header_event\0" + + The next 8 bytes are a 64-bit word containing the size of the + event header information stored next. + + The next set of data is of the size read from the previous 8 bytes + and contains the data retrieved from debugfs/tracing/events/header_event. + + This data allows the trace-cmd tool to know if the ring buffer format + of the kernel made any changes. + +FTRACE EVENT FORMATS SECTION +---------------------------- + + Section ID: 17 + + Directly after the section header 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. + + The next 4 bytes contain a 32-bit word of the number of Ftrace event + format files that are stored in the file. + + For the number of times defined by the previous 4 bytes is the + following: + + 8 bytes for the size of the Ftrace event format file. + + The Ftrace event format file copied from the target machine: + debugfs/tracing/events/ftrace//format + +EVENT FORMATS SECTION +--------------------- + + Section ID: 18 + + Directly after the section header comes the information about + the event layout. + + The next 4 bytes are a 32-bit word containing the number of + event systems that are stored in the file. These are the + directories in debugfs/tracing/events excluding the \fBftrace\fR + directory. + + For the number of times defined by the previous 4 bytes is the + following: + + A null-terminated string containing the system name. + + 4 bytes containing a 32-bit word containing the number + of events within the system. + + For the number of times defined in the previous 4 bytes is the + following: + + 8 bytes for the size of the event format file. + + The event format file copied from the target machine: + debugfs/tracing/events///format + +KALLSYMS SECTION +---------------- + + Section ID: 19 + + Directly after the section header comes the information of the mapping + of function addresses to the function names. + + The next 4 bytes are a 32-bit word containing the size of the + data holding the function mappings. + + The next set of data is of the size defined by the previous 4 bytes + and contains the information from the target machine's file: + /proc/kallsyms + + +TRACE_PRINTK SECTION +-------------------- + + Section ID: 20 + + If a developer used trace_printk() within the kernel, it may + store the format string outside the ring buffer. + This information can be found in: + debugfs/tracing/printk_formats + + The next 4 bytes are a 32-bit word containing the size of the + data holding the printk formats. + + The next set of data is of the size defined by the previous 4 bytes + and contains the information from debugfs/tracing/printk_formats. + + +SAVED COMMAND LINES SECTION +--------------------------- + + Section ID: 21 + + Directly after the section header comes the information mapping + a PID to a process name. + + The next 8 bytes contain a 64-bit word that holds the size of the + data mapping the PID to a process name. + + The next set of data is of the size defined by the previous 8 bytes + and contains the information from debugfs/tracing/saved_cmdlines. + + +BUFFER FLYRECORD SECTION +------------------------ + + This section contains flyrecord tracing data, collected in one trace instance. + The data is saved per CPU. Each BUFFER FLYRECORD section has a corresponding BUFFER + option, containing information about saved CPU's trace data. Padding is placed between + the section header and the CPU data, placing the CPU data at a page aligned (target page) + position in the file. + + This data is copied directly from the Ftrace ring buffer and is of the + same format as the ring buffer specified by the event header files + loaded in the header format file. + + The trace-cmd tool will try to \fBmmap(2)\fR the data page by page with the + target's page size if possible. If it fails to mmap, it will just read the + data instead. + +BUFFER TEXT SECTION +------------------------ + + This section contains latency tracing data, ASCII text taken from the + target's debugfs/tracing/trace file. + +STRINGS SECTION +------------------------ + + All strings from trace file metadata are stored in string section in the file. The section + contains a list of NULL terminated ASCII strings. An ID of the string is used in the file + meta data, which is the offset of the actual string into the string section. Strings can be stored + into multiple string sections in the file. + +SEE ALSO +-------- +trace-cmd(1), trace-cmd-record(1), trace-cmd-report(1), trace-cmd-start(1), +trace-cmd-stop(1), trace-cmd-extract(1), trace-cmd-reset(1), +trace-cmd-split(1), trace-cmd-list(1), trace-cmd-listen(1), +trace-cmd.dat(5) + +AUTHOR +------ +Written by Steven Rostedt, + +RESOURCES +--------- +https://git.kernel.org/pub/scm/utils/trace-cmd/trace-cmd.git/ + +COPYING +------- +Copyright \(C) 2010 Red Hat, Inc. Free use of this software is granted under +the terms of the GNU Public License (GPL).