This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: SystemTap upcoming feature: boot-time probing
- From: Jonathan Lebon <jlebon at redhat dot com>
- To: systemtap at sourceware dot org
- Date: Fri, 10 Jan 2014 16:29:58 -0500 (EST)
- Subject: Re: SystemTap upcoming feature: boot-time probing
- Authentication-results: sourceware.org; auth=none
- References: <1769953313 dot 6141568 dot 1389303043384 dot JavaMail dot root at redhat dot com>
> procmod_watcher.stp
> ===================
Here's a nicer version which also doesn't require debuginfo nor guru-mode for exec() args:
procmod_watcher.stp
===================
function print_time() {
timer = read_stopwatch_us("timer")
printf("%4d.%.6d: ", timer/1000000, timer%1000000)
}
probe begin {
start_stopwatch("timer")
printf(" 0.000000: Started module_watcher on %s\n",
ctime(gettimeofday_s()))
}
probe nd_syscall.execve {
print_time()
printf("EXEC: (%4d) %s: file %s\n",
pid(), execname(), argstr)
}
probe nd_syscall.fork.return {
print_time()
printf("FORK: (%4d) %s: pid %s\n",
pid(), execname(), retstr)
}
probe nd_syscall.exit {
print_time()
sig = status & 0x7F
code = sig ? sig : status >> 8
printf("EXIT: (%4d) %s: %s %d\n",
pid(), execname(),
sig ? "signal" : "exit code", code)
}
probe kernel.trace("module_load") {
print_time()
printf("LOAD: (%4d) %s: module %s",
pid(), execname(),
kernel_string(@cast($mod, "struct module", "kernel<linux/module.h>")->name))
args = kernel_string(@cast($mod, "struct module", "kernel<linux/module.h>")->args)
if (args != "")
printf(" with args \"%s\"", args)
println("")
}
probe nd_syscall.delete_module {
print_time()
printf("UNLD: (%4d) %s: module %s with flags 0x%x\n",
pid(), execname(), name_user, flags);
}
probe end {
print_time()
printf("Exiting module_watcher on %s\n",
ctime(gettimeofday_s()))
}