This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: Some newbie questions
- From: Avi Kivity <avi at scylladb dot com>
- To: systemtap at sourceware dot org
- Date: Sun, 7 Aug 2016 12:16:18 +0300
- Subject: Re: Some newbie questions
- Authentication-results: sourceware.org; auth=none
- References: <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.