From: Andi Kleen <andi@firstfloor.org>
To: Daniel Gutson <daniel.gutson@tallertechnologies.com>
Cc: Andi Kleen <andi@firstfloor.org>,
Leonardo Boquillon <leonardo.boquillon@tallertechnologies.com>,
linux-perf-users@vger.kernel.org
Subject: Re: Ability for classifying of measurements\
Date: Wed, 20 Apr 2016 10:47:24 -0700 [thread overview]
Message-ID: <20160420174724.GP9407@two.firstfloor.org> (raw)
In-Reply-To: <CAF5HaEW29wA6ZtNkGhTdFQGwoZp=QWaxEgt3n_7Ph+iA2YVyxQ@mail.gmail.com>
> Agree, this was the first step. What we would like to see implemented from
> this feature is, 1) some dwarf-aided ability to specify watched variables in
> the perf record command (e.g. perf record --groupby="::var1,
> class1::staticvar2" ),
> and 2) provide an API to the applications so they can
> communicate with perf_events telling what's going on, such as the example we
> are showing here (which is *just* an example to fuel this discussion). This
> API would lead to intrusively mess the code of the app but not more than
> people already do with debugging printfs; this would be very important for
> performance-centric applications.
perf probe has an ability to reference variables relative
to a register or in a register, and parse dwarf for it.
I'm not sure it's a good idea to have a lot of arbitrary memory
accesses in the PMI handler (although there is already some for stack
walking)
One problem with global variables is that they can move
around with ASLR, so it can be difficult to find them.
If the variable is in a register you can already get it from the PEBS
record on Intel CPUs. There is no good tooling for it currently,
but the information is in perf script output, and can be enabled
for perf record.
An easy way to implement it would be to use a
global register variable (register asm("...") ...).
However you would need to rebuild all your libraries to preserve
the global register.
Best would be to use an unused register. One that comes to
mind on x86-64bit Linux is GS, which is normally only used by the kernel.
With this pending patchkit[1] the application can write to it
using WRGSBASE, previously it needed a syscall.
Currently perf cannot log GS I believe, but that would be fairly
easy to add. Would also need some tooling to make the value
an extra sort key in perf report.
-Andi
next prev parent reply other threads:[~2016-04-20 17:47 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-19 20:51 Ability for classifying of measurements Leonardo Boquillon
2016-04-20 13:08 ` Andi Kleen
[not found] ` <CAF5HaEXOwn0_b=an2RR2FT++ktRXLpAP2WHPE7O=kdVKVRYKVQ@mail.gmail.com>
2016-04-20 16:08 ` Daniel Gutson
2016-04-20 17:47 ` Andi Kleen [this message]
2016-05-04 17:20 ` Ability for classifying of measurements\ Daniel Gutson
2016-05-04 17:26 ` Daniel Gutson
2016-05-04 21:41 ` Andi Kleen
2016-05-04 21:56 ` Daniel Gutson
2016-05-04 23:19 ` Vince Weaver
2016-05-04 23:50 ` Andi Kleen
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=20160420174724.GP9407@two.firstfloor.org \
--to=andi@firstfloor.org \
--cc=daniel.gutson@tallertechnologies.com \
--cc=leonardo.boquillon@tallertechnologies.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 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).