From: Craig Ringer <craig@2ndquadrant.com>
To: systemtap@sourceware.org, "Frank Ch. Eigler" <fche@redhat.com>
Subject: Re: Command line systemtap macro setting
Date: Wed, 13 Jan 2021 12:39:11 +0800 [thread overview]
Message-ID: <CAMsr+YF2pFSie4VJq_fozYpr1jNR1Ua5L2g3Em45afetSFKjgA@mail.gmail.com> (raw)
In-Reply-To: <CAMsr+YEUFMA72d64hYrnG+9YcP_XgbU3A2f2AiFUhHrLbPhG6A@mail.gmail.com>
Frank,
Any thoughts on this? I'd be happy to submit a patch but I'd like to know
if you think it's reasonable to do first, so I don't spend the time writing
something that won't be committable.
It'd be a big usability improvement in systemtap for me to be able to
define systemtap language macros on the command line.
On Fri, 8 Jan 2021 at 13:07, Craig Ringer <craig@2ndquadrant.com> wrote:
> 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
>
--
Craig Ringer http://www.2ndQuadrant.com/
2ndQuadrant - PostgreSQL Solutions for the Enterprise
next prev parent reply other threads:[~2021-01-13 4:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-08 5:07 Craig Ringer
2021-01-13 4:39 ` Craig Ringer [this message]
[not found] ` <20210113150431.GC25762@redhat.com>
2021-01-15 2:18 ` Craig Ringer
2021-01-15 2:38 ` Craig Ringer
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=CAMsr+YF2pFSie4VJq_fozYpr1jNR1Ua5L2g3Em45afetSFKjgA@mail.gmail.com \
--to=craig@2ndquadrant.com \
--cc=fche@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).