From: Stan Cox <scox@redhat.com>
To: Mark Wielaard <mjw@redhat.com>
Cc: "Frank Ch. Eigler" <fche@redhat.com>, systemtap@sourceware.org
Subject: Re: new static user probe types
Date: Wed, 29 Jul 2009 15:44:00 -0000 [thread overview]
Message-ID: <4A706E45.2040009@redhat.com> (raw)
In-Reply-To: <1248282602.7890.36.camel@springer.wildebeest.org>
So here is what I have for SW10013:
1. Given a 'dtrace' input file:
provider tstsyscall
{
probe test(short arg1, int arg2, int arg3, int arg4, struct astruct arg5)
}
2. The dtrace script produces a header file containing:
#define STAP_HAS_SEMAPHORES 1
...
/* TSTSYSCALL_TEST ( short arg1, int arg2, int arg3, int arg4, struct astruct arg5) */
#define TSTSYSCALL_TEST_ENABLED() test_semaphore
__extension__ extern long test_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes")));
#define TSTSYSCALL_TEST(arg1,arg2,arg3,arg4,arg5) \
STAP_PROBE5(provider,test,arg1,arg2,arg3,arg4,arg5)
// these are to help kprobe and utrace access struct astruct
struct astruct {int a; int b;};
typedef struct astruct test_arg5; test_arg5 test_arg5_v;
3. where STAP_PROBE5 is defined as:
#define STAP_PROBE5_(probe,label,parm1,parm2,parm3,parm4,parm5)
STAP_SEMAPHORE(probe)
do {
__extension__ struct {size_t arg1 __attribute__((aligned(8)));
size_t arg2 __attribute__((aligned(8)));
size_t arg3 __attribute__((aligned(8)));
size_t arg4 __attribute__((aligned(8)));
size_t arg5 __attribute__((aligned(8)));}
stap_probe5_args = {(size_t)parm1, (size_t)parm2, (size_t)parm3, (size_t)parm4,
(size_t)parm5};
STAP_PROBE_DATA(probe,STAP_GUARD,5);
syscall (STAP_SYSCALL, #probe, STAP_GUARD, &stap_probe5_args);
} while (0)
4. and STAP_SEMAPHORE is defined as (so if the dtrace script isn't
being used there is no test):
#ifdef STAP_HAS_SEMAPHORE
#define STAP_SEMAPHORE(probe)
if ( probe ## _semaphore )
#else
#define STAP_SEMAPHORE(probe) ;
#endif
5. and the dtrace script also produces tstsyscall_.c. This defines
the test value and creates a ctor where stap can set the value.
__extension__ long test_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes")));
_stap_constructor ()
{
__asm__ volatile ("/* %0 */" :: "g"(test_semaphore));
}
6. this needs to be improved but currently if stap sees a test probe then it
'automatically' produces this probe which requires -g.
process(EXECUTABLE).statement("_stap_constructor")
{ test_semaphore = 1 }
7. The execution time of a synthetic test not run under stap influence
is more or less equivalent with the above and when run under stap:
utrace 0.76user 4.30system 0:05.22elapsed
kprobe 1.38user 5.09system 0:06.92elapsed
uprobe 0.92user 10.99system 0:12.01elapsed
next prev parent reply other threads:[~2009-07-29 15:44 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-26 21:26 Stan Cox
2009-07-15 16:19 ` Stan Cox
2009-07-15 18:39 ` Josh Stone
2009-07-15 20:47 ` Stan Cox
2009-07-15 21:57 ` Josh Stone
2009-07-16 13:44 ` Stan Cox
2009-07-20 18:34 ` Stan Cox
2009-07-22 10:42 ` Mark Wielaard
2009-07-22 14:39 ` Frank Ch. Eigler
2009-07-22 17:10 ` Mark Wielaard
2009-07-29 15:44 ` Stan Cox [this message]
2009-07-29 15:51 ` Stan Cox
2009-07-23 3:07 ` Roland McGrath
2009-07-23 10:28 ` Mark Wielaard
2009-07-23 14:40 ` Frank Ch. Eigler
2009-07-23 19:33 ` Roland McGrath
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=4A706E45.2040009@redhat.com \
--to=scox@redhat.com \
--cc=fche@redhat.com \
--cc=mjw@redhat.com \
--cc=systemtap@sourceware.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 read-only IMAP folder(s) and NNTP newsgroup(s).