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 v5 09/25] trace-cmd record: Append trace options after the trace data are written
Date: Wed, 24 Nov 2021 14:27:08 -0500	[thread overview]
Message-ID: <20211124142708.4a1f1cdf@gandalf.local.home> (raw)
In-Reply-To: <20211111150933.86678-1-tz.stoyanov@gmail.com>

On Thu, 11 Nov 2021 17:09:33 +0200
"Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com> wrote:

> In trace file version 7, the CPU trace metadata is saved in a trace
> option. As this metadata has file offsets, which depend on the CPU trace
> data, the option must be written in the file after the CPU trace data.
> 
> Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
> ---
>  tracecmd/trace-record.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c
> index 757dab0f..32270e20 100644
> --- a/tracecmd/trace-record.c
> +++ b/tracecmd/trace-record.c
> @@ -4449,6 +4449,9 @@ static void write_guest_file(struct buffer_instance *instance)
>  
>  	if (tracecmd_write_cpu_data(handle, cpu_count, temp_files, NULL) < 0)
>  		die("failed to write CPU data");
> +	if (tracecmd_get_out_file_version(handle) >= FILE_VERSION_SECTIONS)

Can't this be detected on close?

That is, if the handle has pending options to write out, and the handle has
sections, can't the tracecmd_output_close() write it out then?

Why make this something the user must worry about?

-- Steve

> +		tracecmd_write_options(handle);
> +
>  	tracecmd_output_close(handle);
>  
>  	for (i = 0; i < cpu_count; i++)
> @@ -4597,7 +4600,8 @@ static void record_data(struct common_record_context *ctx)
>  				append_buffer(handle, instance, temp_files);
>  			}
>  		}
> -
> +		if (tracecmd_get_out_file_version(handle) >= FILE_VERSION_SECTIONS)
> +			tracecmd_write_options(handle);
>  		free(temp_files);
>  	}
>  	if (!handle)


      reply	other threads:[~2021-11-24 19:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-11 15:09 [PATCH v5 09/25] trace-cmd record: Append trace options after the trace data are written Tzvetomir Stoyanov (VMware)
2021-11-24 19:27 ` Steven Rostedt [this message]

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=20211124142708.4a1f1cdf@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=tz.stoyanov@gmail.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).