From: Avi Kivity <avi@scylladb.com>
To: systemtap@sourceware.org
Subject: Re: Some newbie questions
Date: Sun, 07 Aug 2016 09:16:00 -0000 [thread overview]
Message-ID: <e1682dea-d14a-11b1-c6d7-bee5d31c0a7d@scylladb.com> (raw)
In-Reply-To: <f8418406-9604-ff54-7d9d-7d1b581eea51@scylladb.com>
On 08/07/2016 11:07 AM, Avi Kivity wrote:
> Hello,
>
Hi, n00b,
> A few newbie questions.
>
> 1. Static library support
>
> I am writing a static library, and would like to ship some scripts
> with the library for its consumers. The library is named "seastar"
> and one of the consumers is named "scylla".
>
> What should I write as the process name in the script? As the writer
> of the library, I don't know the name of the process that will be
> consuming the library. The consumer shouldn't have to write those
> scripts. I could play sed games to adjust the scripts, but it's very
> sad to have to do this.
>
You can use "@1" to paste a script parameter into the script.
> 2. Inlined functions
>
> From the manual pages, it seems that inlined functions can be probed
> (minus the .return probe), but I just get an error:
>
> semantic error: while resolving probe point: identifier 'process' at
> script/home/avi/seastar/debug/task-latency.stap:3:7
> source: probe
> process("scylla").function("reactor::run_tasks()") {
> ^
>
> semantic error: no match (similar functions:
> _ZN7reactor14run_exit_tasksEv, statfs, dup, mkdir, ntohs)
>
> I will note that "mkdir" does not sound very similar to
> "reactor::run_tasks()" (but I am not a native speaker).
>
> 3. Process CPU timers
>
> (more of a feature request)
>
> I'm trying to find causes of latency in my program. To do that, I'm
> running a periodic timer and checking whether a function takes more
> time than some threshold.
>
> Ideally, I'd be able to arm the timer on the function entry point and
> disarm it on exit, rather than have it run continuously; this would
> need to be a per-thread cpu-time timer (e.g. CLOCK_THREAD_CPUTIME_ID)/
>
> Here's my current script for reference ("running" and "start_time"
> need to become maps for it to be thread-safe):
>
> #!/usr/bin/stap
>
> global start_time
> global running
>
> probe begin {
> running = 0
> }
>
> probe
> process("/home/avi/urchin/build/release/scylla").mark("reactor_run_tasks_start")
> {
> start_time = gettimeofday_us()
> running = 1
> }
>
> probe
> process("/home/avi/urchin/build/release/scylla").mark("reactor_run_tasks_end")
> {
> running = 0
> }
>
> probe timer.ms(10) {
You should use timer.profile instead
> now = gettimeofday_us()
> if (running && (now - start_time) > 30000) {
And a second parameter here.
> printf("detected tasks running for >30ms\n")
> print_usyms(ubacktrace())
> }
> }
>
> I'd appreciate any tips as to whether there's a better way to do this.
>
>
next prev parent reply other threads:[~2016-08-07 9:16 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-07 8:08 Avi Kivity
2016-08-07 9:16 ` Avi Kivity [this message]
2016-08-08 14:58 ` David Smith
2016-08-09 6:51 ` Avi Kivity
2016-08-09 13:54 ` Mark Wielaard
2016-08-09 14:11 ` Avi Kivity
2016-08-10 15:33 ` Frank Ch. Eigler
2016-08-10 15:39 ` Avi Kivity
2016-08-10 15:40 ` Avi Kivity
2016-08-10 16:47 ` Frank Ch. Eigler
2016-08-11 7:51 ` Avi Kivity
2016-08-11 8:13 ` Avi Kivity
2016-08-11 16:18 ` Frank Ch. Eigler
2016-08-17 15:15 ` Avi Kivity
2016-08-17 18:06 ` David Smith
2016-08-17 18:22 ` Avi Kivity
2016-08-17 18:10 ` Frank Ch. Eigler
2016-08-17 18:30 ` Avi Kivity
2016-08-17 18:35 ` Frank Ch. Eigler
2016-08-17 18:42 ` Avi Kivity
2016-08-25 16:21 ` Avi Kivity
2016-08-25 17:37 ` David Smith
2016-08-26 18:39 ` Avi Kivity
2016-08-26 20:08 ` David Smith
2016-08-26 21:21 ` Josh Stone
2016-08-28 13:30 ` Avi Kivity
2016-08-28 13:35 ` Avi Kivity
2016-08-28 13:45 ` Avi Kivity
2016-08-29 18:26 ` David Smith
2016-08-31 16:44 ` Avi Kivity
2016-08-09 15:17 ` David Smith
2016-08-09 15:28 ` Avi Kivity
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=e1682dea-d14a-11b1-c6d7-bee5d31c0a7d@scylladb.com \
--to=avi@scylladb.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).