From: Aubrey Li <aubreylee@gmail.com>
To: systemtap@sourceware.org
Subject: kernel function probe overhead
Date: Fri, 25 Nov 2016 16:07:00 -0000 [thread overview]
Message-ID: <CAGPKeUKWAvBv=SL_ebVkR3ZwCeGZoCQ1MEJ5xQi-VXuF=kt3Wg@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1458 bytes --]
Hi list,
I'm trying to profiling some Linux kernel subsystems by systemtap. So
I want to know the overhead of various kinds of systemtap probes.
Basically I sampled two kernel function probes,
probe kernel.function(arch_cpu_idle_enter).call
probe kernel.function(local_touch_nmi).call
========
a snip objdump of the code:
ffffffff81035740 <arch_cpu_idle_enter>:
ffffffff81035740: e8 4b 76 55 00 callq
ffffffff8158cd90 <__fentry__>
ffffffff81035745: e8 f6 96 ff ff callq
ffffffff8102ee40 <local_touch_nmi>
========
because local irq is disabled, I suppose the duration of these two
probes to be ZERO.
However, I run the attached stp script and here is what I got:
$ stap test.stp
Press ^C to stop
Total time: 10106 miliseconds
t_end @count=2908 @min=676 @max=88152 @sum=15005802 @avg=5160
the duration varies from 676 to 88152, I understand all the tracing
mechanism should have overhead, while 676ns is acceptable, but 88152
is not.
And I have no idea why its range is so big?
Please let me know if I can provide more information on my side.
Thanks,
-Aubrey
$ stap -V
Systemtap translator/driver (version 3.1/0.167, commit
release-3.0-273-g7d27ff5084d6)
Copyright (C) 2005-2016 Red Hat, Inc. and others
This is free software; see the source for copying conditions.
tested kernel versions: 2.6.18 ... 4.8
enabled features: NLS
$ uname -a
Linux aubrey-hp 4.8.10+ #5 SMP Fri Nov 25 02:11:32 CST 2016 x86_64 GNU/Linux
[-- Attachment #2: test.stp --]
[-- Type: application/octet-stream, Size: 527 bytes --]
#!/usr/local/bin/stap
global init_time
global t_start
global t_end
probe begin{
printf("Press ^C to stop\n")
init_time = gettimeofday_ms()
}
probe kernel.function("arch_cpu_idle_enter").call
{
t_start[cpu()] = gettimeofday_ns()
}
probe kernel.function("local_touch_nmi").call
{
if (t_start[cpu()]) {
t_end <<< gettimeofday_ns() - t_start[cpu()]
t_start[cpu()] = 0
}
}
probe timer.s(10)
{
exit()
}
probe end {
printf("Total time: %d miliseconds\n", gettimeofday_ms() - init_time)
}
next reply other threads:[~2016-11-25 16:07 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-25 16:07 Aubrey Li [this message]
2016-11-25 17:22 ` Frank Ch. Eigler
2016-11-26 6:18 ` Aubrey Li
2016-11-28 19:19 ` Frank Ch. Eigler
2016-11-29 3:31 ` Aubrey Li
2016-11-29 19:21 ` Josh Stone
2016-12-01 18:47 ` Cody Santing
[not found] ` <CAGPKeUKm9EZZxL=MHZX9_0N5SUYX291mJMTCExYSspRceJgrxg@mail.gmail.com>
2016-12-12 17:07 ` Fwd: " Cody Santing
2016-12-12 17:43 ` Frank Ch. Eigler
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='CAGPKeUKWAvBv=SL_ebVkR3ZwCeGZoCQ1MEJ5xQi-VXuF=kt3Wg@mail.gmail.com' \
--to=aubreylee@gmail.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).