public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* Command line systemtap macro setting
@ 2021-01-08  5:07 Craig Ringer
  2021-01-13  4:39 ` Craig Ringer
  0 siblings, 1 reply; 4+ messages in thread
From: Craig Ringer @ 2021-01-08  5:07 UTC (permalink / raw)
  To: systemtap

Hi

I keep on finding situations where I want to set systemtap language macros
on the command line. AFAICS there is no such feature. Right? The closest
seems to be to generate a .stpm file with the desired macro definition and
put on the include path.

Would you object to a patch that added this capability? If so, how do you
think it should be spelled on the command line? "-D" is taken. So maybe
"-M" ?

The most important time I need command line macro definitions is to work
around the issues with relative paths. I pretty much always require
absolute paths for executables in my tapscripts. Otherwise @var("var@cu",
"exec_path") doesn't work properly or didn't last I checked. And probes
that fail to match seem to like to fail silently if the executable isn't
found on the PATH, where they'll report an explicit error if the executable
is a fully qualified path. So I try to run with absolute paths all the
time. But I don't really want users to have to hack the script to supply
them, so I'd like to be able to e.g.

    -D POSTGRES_EXECUTABLE="/path/to/postgres"

However, this won't work - it'd set a C preprocessor macro for the runtime
compilation, not the systemtap language processing phase. And you can't

    -G POSTGRES_EXECUTABLE="/path/to/postgres"

because probes don't accept globals in their arguments; this isn't legal:

    probe process(POSTGRES_EXECUTABLE).function("foo") { ...}

That can be handled with a positional parameter instead, but doing so is
less user friendly. It's much less obvious what the param is and does when
reading the cmdline.

Similarly, if I want to make it easy to customise script behaviour,
something like this won't work:

    global stats_report_interval_ms=5000
    probe timer.ms(stats_report_interval_ms ) { do_something(); }




-- 
 Craig Ringer                   http://www.2ndQuadrant.com/
 2ndQuadrant - PostgreSQL Solutions for the Enterprise

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-01-15  2:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-08  5:07 Command line systemtap macro setting Craig Ringer
2021-01-13  4:39 ` Craig Ringer
     [not found]   ` <20210113150431.GC25762@redhat.com>
2021-01-15  2:18     ` Craig Ringer
2021-01-15  2:38       ` Craig Ringer

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).