All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Frank Ch. Eigler" <fche@redhat.com>
To: David Ahern <dsahern@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
	"Kornievskaia, Olga" <Olga.Kornievskaia@netapp.com>,
	"linux-perf-users@vger.kernel.org"
	<linux-perf-users@vger.kernel.org>
Subject: Re: timing information with perf
Date: Tue, 17 Nov 2015 08:31:11 -0500	[thread overview]
Message-ID: <20151117133111.GF25870@redhat.com> (raw)
In-Reply-To: <564AA5AE.1020303@gmail.com>

Hi -

> >>    global s, t%
> >>    probe kernel.trace("foobar_enter") {
> >>        t[tid()]=gettimeofday_us()
> >>    }
> >>    probe kernel.trace("foobar_exit") {
> >>        if (tid() in t) { s <<< gettimeofday_us() - t[tid()] }
> >>    }
> >>    probe timer.s(5),end {
> >>        printf("cumulative average us: %d\n", @avg(s))
> >>    }
> > [...]
> 
> Interesting solution. How does it scale with CPUs and tasks?

It's not a simple question, as there are several factors, but
generally fine.

systemtap compiles down to native code, so execution is very fast and
CPU consumption is not a problem (better than streaming to userspace &
processing there).

Depending on actual runtime behavior, there may be contention over the
t[] array that tracks start-time.  systemtap automagically safely
locks these for correctness.  If contention is high, trylock/timeouts
can fail and some probes will be missed.  Fail too many and the script
will self-terminate.  (See [man stap] for some of the related
configurables.)

There is no contention over the s scalar value tracks elapsed time,
since it is implicitly aggregated on a per-cpu basis.  That scales
without problem.

- FChE

  reply	other threads:[~2015-11-17 13:31 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-12 21:07 timing information with perf Kornievskaia, Olga
2015-11-12 21:57 ` Arnaldo Carvalho de Melo
2015-11-12 22:04   ` Arnaldo Carvalho de Melo
2015-11-12 23:19     ` David Ahern
2015-11-12 23:09   ` Kornievskaia, Olga
2015-11-12 23:22     ` David Ahern
2015-11-12 23:34     ` Arnaldo Carvalho de Melo
2015-11-13 17:01       ` Kornievskaia, Olga
2015-11-13 19:47         ` Arnaldo Carvalho de Melo
2015-11-13 21:57           ` Kornievskaia, Olga
2015-11-16 18:08 ` Frank Ch. Eigler
2015-11-17  0:12   ` Arnaldo Carvalho de Melo
2015-11-17  0:30     ` Frank Ch. Eigler
2015-11-17  1:31       ` Arnaldo Carvalho de Melo
2015-11-17  3:57     ` David Ahern
2015-11-17 13:31       ` Frank Ch. Eigler [this message]
2015-11-17 13:39         ` Arnaldo Carvalho de Melo
2015-11-17 14:04           ` Frank Ch. Eigler

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=20151117133111.GF25870@redhat.com \
    --to=fche@redhat.com \
    --cc=Olga.Kornievskaia@netapp.com \
    --cc=acme@kernel.org \
    --cc=dsahern@gmail.com \
    --cc=linux-perf-users@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.