lttng-dev.lists.lttng.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
To: bhanu kiran chaluvadi <nthdimensionalreality@gmail.com>
Cc: lttng-dev@lists.lttng.org
Subject: Re: Measure loop rate
Date: Thu, 23 Jan 2020 14:53:01 -0500	[thread overview]
Message-ID: <20200123195301.GA8988@joraj-alpa> (raw)
In-Reply-To: <CAJYn_wgBrfB+nY8nSajyDUnj81sOr6Q9wb5MFhiW5ShC5n8Kvw@mail.gmail.com>

Hi,

On Wed, Jan 22, 2020 at 06:28:14PM +0100, bhanu kiran chaluvadi wrote:
> Hi ,
> 
> I am trying to observer loop rate of a while loop.  Ideally it should take
> maximum of 2 ms to finish the cycle (500 Hz at least). And i would like to
> trace the loop rate using LTTng user space. whats the better way of doing
> it ..Just place one trace point at the start and one at the end ? or is
> there any library that i can take advantage of?

I'm not completely sure what you mean by "loop rate" but if you are looking for
the duration of a single iteration of your while loop then yes, one at the start
and one at the end. Keep in mind that tracing is *not* free and that you will
need to account for the tracing overhead here. I would suggest having no payload
at all if you can.

There is other ways of deducing the time taken by one iteration (time_for_n/n)
to reduce impact of tracing if you can have an upper bound (or know the number
of iterations that took place) for the number of iterations but it will only
give you the mean time for the loop execution. In that case, the tracepoints
would be outside the while loop.

You could also hit an event only each X loop iterations and deduce the
rate from there. Keep in mind that this will require accounting and
will add to the workload etc.

It all depends on the granularity you are looking for.

Cheers
-- 
Jonathan Rajotte-Julien
EfficiOS

      reply	other threads:[~2020-01-23 19:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-22 17:28 Measure loop rate bhanu kiran chaluvadi
2020-01-23 19:53 ` Jonathan Rajotte-Julien [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=20200123195301.GA8988@joraj-alpa \
    --to=jonathan.rajotte-julien@efficios.com \
    --cc=lttng-dev@lists.lttng.org \
    --cc=nthdimensionalreality@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).