From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11673 invoked by alias); 10 Jan 2014 21:30:03 -0000 Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org Received: (qmail 11630 invoked by uid 89); 10 Jan 2014 21:30:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx4-phx2.redhat.com Received: from mx4-phx2.redhat.com (HELO mx4-phx2.redhat.com) (209.132.183.25) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 10 Jan 2014 21:29:59 +0000 Received: from zmail11.collab.prod.int.phx2.redhat.com (zmail11.collab.prod.int.phx2.redhat.com [10.5.83.13]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s0ALTwkp020972 for ; Fri, 10 Jan 2014 16:29:58 -0500 Date: Fri, 10 Jan 2014 21:30:00 -0000 From: Jonathan Lebon To: systemtap@sourceware.org Message-ID: <1598992413.6664177.1389389398354.JavaMail.root@redhat.com> In-Reply-To: <1769953313.6141568.1389303043384.JavaMail.root@redhat.com> References: <1769953313.6141568.1389303043384.JavaMail.root@redhat.com> Subject: Re: SystemTap upcoming feature: boot-time probing MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2014-q1/txt/msg00018.txt.bz2 > 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")->name)) args = kernel_string(@cast($mod, "struct module", "kernel")->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())) }