public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* kernel function probe overhead
@ 2016-11-25 16:07 Aubrey Li
  2016-11-25 17:22 ` Frank Ch. Eigler
  0 siblings, 1 reply; 9+ messages in thread
From: Aubrey Li @ 2016-11-25 16:07 UTC (permalink / raw)
  To: systemtap

[-- 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)
}

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

end of thread, other threads:[~2016-12-12 17:43 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-25 16:07 kernel function probe overhead Aubrey Li
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

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