From: Steven Rostedt <rostedt@goodmis.org>
To: "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com>
Cc: linux-trace-devel@vger.kernel.org
Subject: Re: [PATCH v2 3/3] trace-cmd: Get the timestamp of the first recorded event as TSC offset
Date: Fri, 16 Apr 2021 15:28:21 -0400 [thread overview]
Message-ID: <20210416152821.2d954280@gandalf.local.home> (raw)
In-Reply-To: <20210416103409.24597-4-tz.stoyanov@gmail.com>
On Fri, 16 Apr 2021 13:34:09 +0300
"Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com> wrote:
> +int get_first_ts_instance(struct buffer_instance *instance)
> +{
> + struct tracecmd_ts_corrections corrections;
> + unsigned long long first_ts = 0;
> + enum kbuffer_long_size long_size;
> + enum kbuffer_endian endian;
> + struct kbuffer *kbuf = NULL;
Small nit, but I'll leave it as it doesn't really hurt anything. But
assigning kbuf to NULL isn't needed. It gets assigned in the
kbuffer_alloc() before it is ever referenced, and the only error path
before that is a return. But if we ever add another error path, it's safe
to have it NULL.
-- Steve
> + unsigned long long ts;
> + unsigned int flags;
> + int first_ts_cpu;
> + bool first = true;
> + char *page;
> + char *file;
> + int psize;
> + int ret;
> + int i;
> +
> + psize = getpagesize();
> + page = calloc(1, psize);
> + if (!page)
> + return -1;
> +
> + if (tracecmd_host_bigendian())
> + endian = KBUFFER_ENDIAN_BIG;
> + else
> + endian = KBUFFER_ENDIAN_LITTLE;
> + if (sizeof(long) == 8)
> + long_size = KBUFFER_LSIZE_8;
> + else
> + long_size = KBUFFER_LSIZE_4;
> +
> + kbuf = kbuffer_alloc(long_size, endian);
> + if (!kbuf)
> + goto out;
> +
prev parent reply other threads:[~2021-04-16 19:28 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-16 10:34 [PATCH v2 0/3] Fix overflow when applying tsc2nsec calculations Tzvetomir Stoyanov (VMware)
2021-04-16 10:34 ` [PATCH v2 1/3] trace-cmd library: Add new trace-cmd library APIs for guest ts corrections Tzvetomir Stoyanov (VMware)
2021-04-16 10:34 ` [PATCH v2 2/3] trace-cmd library: Add check before applying tsc2nsec offset Tzvetomir Stoyanov (VMware)
2021-04-16 20:12 ` Steven Rostedt
2021-04-19 8:08 ` Tzvetomir Stoyanov
2021-04-19 13:45 ` Steven Rostedt
2021-04-19 15:14 ` Steven Rostedt
2021-04-28 12:31 ` Tzvetomir Stoyanov
2021-04-16 10:34 ` [PATCH v2 3/3] trace-cmd: Get the timestamp of the first recorded event as TSC offset Tzvetomir Stoyanov (VMware)
2021-04-16 19:28 ` 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=20210416152821.2d954280@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).