Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: jistone@redhat.com (Josh Stone)
Subject: [ltt-dev] SystemTAP support in tracepoints
Date: Mon, 11 Apr 2011 15:29:41 -0700	[thread overview]
Message-ID: <4DA380D5.80608@redhat.com> (raw)
In-Reply-To: <4DA3704C.8010502@redhat.com>

On 04/11/2011 02:19 PM, Josh Stone wrote:
> AFAIK, the only roadblock is that our probes are argument-numbered
> rather than variadic.  I've been thinking for a while that it would be
> nice if we had a variadic SDT macro, e.g. STAP_PROBEV, and then UST
> could invoke it directly.  Since you and I were brainstorming this,
> here's a neat trick I found to count __VA_ARGS__:
>   http://groups.google.com/group/comp.std.c/msg/346fc464319b1ee5
> 
> I'm going to try to adapt that for SDT, so I'll post if I get it working...

Here's what I came up with:

#define _SDT_NARG(...) __SDT_NARG(__VA_ARGS__, 10,9,8,7,6,5,4,3,2,1,0)
#define __SDT_NARG(_0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10, N, ...) N
#define _SDT_PROBE_N(provider, name, N, ...) \
  _SDT_PROBE(provider, name, N, (__VA_ARGS__))
#define STAP_PROBEV(provider, name, ...) \
  _SDT_PROBE_N(provider, name, _SDT_NARG(0,##__VA_ARGS__),##__VA_ARGS__)

_SDT_NARG is actually returning the count minus one, and I call it with
an extra arg, so we can avoid non-standard empty macro args.

Comments?

Josh




  reply	other threads:[~2011-04-11 22:29 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-10 17:44 Mathieu Desnoyers
2011-04-11 21:19 ` Josh Stone
2011-04-11 22:29   ` Josh Stone [this message]
2011-04-12 16:57     ` Frank Ch. Eigler
2011-04-12 18:35     ` Mathieu Desnoyers
2011-04-12 18:45       ` Frank Ch. Eigler
2011-04-12 18:48         ` Mathieu Desnoyers
2011-04-12 18:59           ` Frank Ch. Eigler
2011-04-12 19:12           ` Mark Wielaard
2011-04-13 15:38             ` Mathieu Desnoyers
     [not found]             ` <BLU0-SMTP42E61B0C2D4283651878B896AA0@phx.gbl>
2011-04-13 16:17               ` Mark Wielaard
2011-04-13 16:58                 ` Mathieu Desnoyers
2011-04-13 17:24                   ` Josh Stone
2011-04-13 17:29                   ` Mark Wielaard

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=4DA380D5.80608@redhat.com \
    --to=jistone@redhat.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