linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tzvetomir Stoyanov <tz.stoyanov@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Linux Trace Devel <linux-trace-devel@vger.kernel.org>
Subject: Re: [PATCH v25 09/16] trace-cmd: Add scaling ratio for timestamp correction
Date: Thu, 3 Dec 2020 14:56:56 +0200	[thread overview]
Message-ID: <CAPpZLN6eeDSZPWwwov1+UgPsgjrQ4hMnJ2Dm7TUe=pgSnrhTjA@mail.gmail.com> (raw)
In-Reply-To: <20201202204735.61d112c8@oasis.local.home>

On Thu, Dec 3, 2020 at 3:47 AM Steven Rostedt <rostedt@goodmis.org> wrote:
>
> On Thu, 29 Oct 2020 13:18:09 +0200
> "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com> wrote:
> > @@ -2181,7 +2184,9 @@ static void tsync_offset_load(struct tracecmd_input *handle, char *buf)
> >               host->ts_samples[i].time = tep_read_number(handle->pevent,
> >                                                          buf8 + i, 8);
> >               host->ts_samples[i].offset = tep_read_number(handle->pevent,
> > -                                             buf8 + host->ts_samples_count+i, 8);
> > +                                             buf8 + host->ts_samples_count + i, 8);
> > +             host->ts_samples[i].scaling = tep_read_number(handle->pevent,
> > +                                             buf8 + (2 * host->ts_samples_count) + i, 8);
> >       }
>
>
> I was thinking the above code may read better if we changed it to:
>
>         long long *time_buf;
>         long long *offset_buf;
>         long long *scaling_buf;
>
>         time_buf = (long long *)buf;
>         offset_buf = time_buf + host->ts_samples_count;
>         scaling_buf = offset_buf + host->ts_samples_count;
>
>         for (i = 0; i < host->ts_samples_count; i++) {
>                 host->ts_samples[i].time = tep_read_number(handle->pevent,
>                                                            time_buf + i, 8);
>                 host->ts_samples[i].offset = tep_read_number(handle->   pevent,
>                                                            offset_buf + i, 8);
>                 host->ts_samples[i].scaling = tep_read_number(handle->pevent,
>                                                            scaling_buf + i, 8);
>         }
>
This code is rewritten in "trace-cmd: Add timestamp synchronization
per vCPU" patch
in a better and safer way.

> -- Steve
>
>
>
> >       qsort(host->ts_samples, host->ts_samples_count,
> >             sizeof(struct ts_offset_sample), tsync_offset_cmp);
> > @@ -2534,6 +2539,7 @@ static int handle_options(struct tracecmd_input *handle)
> >                        * long long array of size [count] of times,
> >                        *      when the offsets were calculated.
> >                        * long long array of size [count] of timestamp offsets.
> > +                      * long long array of size [count] of timestamp scaling ratios.*
> >                        */
> >                       if (size < 12 || handle->flags & TRACECMD_FL_IGNORE_DATE)
> >                               break;



-- 
Tzvetomir (Ceco) Stoyanov
VMware Open Source Technology Center

  reply	other threads:[~2020-12-03 12:58 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-29 11:18 [PATCH v25 00/16] Timestamp synchronization of host - guest tracing session Tzvetomir Stoyanov (VMware)
2020-10-29 11:18 ` [PATCH v25 01/16] trace-cmd: Replace time sync protocol ID with string Tzvetomir Stoyanov (VMware)
2020-11-05 14:52   ` Steven Rostedt
2020-12-02 22:43   ` Steven Rostedt
2020-10-29 11:18 ` [PATCH v25 02/16] trace-cmd: Add trace-cmd library APIs for ftrace clock name Tzvetomir Stoyanov (VMware)
2020-10-29 11:18 ` [PATCH v25 03/16] trace-cmd: Move VM related logic in a separate file Tzvetomir Stoyanov (VMware)
2020-10-29 11:18 ` [PATCH v25 04/16] trace-cmd: Add new libtrasefs API to get the current trace clock Tzvetomir Stoyanov (VMware)
2020-10-29 11:18 ` [PATCH v25 05/16] trace-cmd: Add clock parameter to timestamp synchronization plugins Tzvetomir Stoyanov (VMware)
2020-12-02 22:48   ` Steven Rostedt
2020-12-03 13:09     ` Tzvetomir Stoyanov
2020-10-29 11:18 ` [PATCH v25 06/16] trace-cmd: Add role " Tzvetomir Stoyanov (VMware)
2020-12-02 23:04   ` Steven Rostedt
2020-10-29 11:18 ` [PATCH v25 07/16] trace-cmd: Add host / guest role in timestamp synchronization context Tzvetomir Stoyanov (VMware)
2020-12-02 23:07   ` Steven Rostedt
2020-10-29 11:18 ` [PATCH v25 08/16] trace-cmd: Add guest CPU count PID in tracecmd_time_sync struct Tzvetomir Stoyanov (VMware)
2020-10-29 11:18 ` [PATCH v25 09/16] trace-cmd: Add scaling ratio for timestamp correction Tzvetomir Stoyanov (VMware)
2020-12-03  1:47   ` Steven Rostedt
2020-12-03 12:56     ` Tzvetomir Stoyanov [this message]
2020-10-29 11:18 ` [PATCH v25 10/16] trace-cmd: Add time sync protocol flags Tzvetomir Stoyanov (VMware)
2020-12-03  2:09   ` Steven Rostedt
2020-12-03 12:59     ` Tzvetomir Stoyanov
2020-10-29 11:18 ` [PATCH v25 11/16] trace-cmd: Add timestamp synchronization per vCPU Tzvetomir Stoyanov (VMware)
2020-10-29 11:18 ` [PATCH v25 12/16] trace-cmd: Define a macro for packed structures Tzvetomir Stoyanov (VMware)
2020-10-29 11:18 ` [PATCH v25 13/16] trace-cmd: Add dummy function to initialize timestamp sync logic Tzvetomir Stoyanov (VMware)
2020-10-29 11:18 ` [PATCH v25 14/16] trace-cmd: [POC] PTP-like algorithm for host - guest timestamp synchronization Tzvetomir Stoyanov (VMware)
2020-10-29 11:18 ` [PATCH v25 15/16] trace-cmd: Debug scripts for " Tzvetomir Stoyanov (VMware)
2020-10-29 11:18 ` [PATCH v25 16/16] trace-cmd [POC]: Add KVM timestamp synchronization plugin Tzvetomir Stoyanov (VMware)

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='CAPpZLN6eeDSZPWwwov1+UgPsgjrQ4hMnJ2Dm7TUe=pgSnrhTjA@mail.gmail.com' \
    --to=tz.stoyanov@gmail.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    /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).