From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30315 invoked by alias); 26 Aug 2008 16:13:28 -0000 Received: (qmail 30289 invoked by uid 22791); 26 Aug 2008 16:13:26 -0000 X-Spam-Status: No, hits=-0.4 required=5.0 tests=AWL,BAYES_40,J_CHICKENPOX_63,J_CHICKENPOX_74,KAM_MX,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 26 Aug 2008 16:09:03 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id m7QG8qgj017572; Tue, 26 Aug 2008 12:08:52 -0400 Received: from mail.boston.redhat.com (mail.boston.redhat.com [10.16.255.12]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id m7QG8f4Z011689; Tue, 26 Aug 2008 12:08:51 -0400 Received: from [10.16.3.219] (dhcp-100-3-219.bos.redhat.com [10.16.3.219]) by mail.boston.redhat.com (8.13.1/8.13.1) with ESMTP id m7QG8eA6029294; Tue, 26 Aug 2008 12:08:41 -0400 Message-ID: <48B42A17.1080106@redhat.com> Date: Tue, 26 Aug 2008 16:13:00 -0000 From: Masami Hiramatsu User-Agent: Thunderbird 2.0.0.16 (X11/20080723) MIME-Version: 1.0 To: systemtap-ml CC: ltt-dev@lists.casi.polymtl.ca, Hideo AOKI , Takahiro Yasui Subject: [Systemtap][RFC] sample test script and tapset for markers X-Enigmail-Version: 0.95.7 Content-Type: multipart/mixed; boundary="------------040801080108050806030007" X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 X-Virus-Checked: Checked by ClamAV on sourceware.org X-IsSubscribed: yes 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 X-SW-Source: 2008-q3/txt/msg00502.txt.bz2 This is a multi-part message in MIME format. --------------040801080108050806030007 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-length: 600 Hi, Here is a tapset and sample script for markers. This tapset partially covers LTTng markers(with our additional patches for markers which I attached to the previous mails). In this marker tapset, I used the marker.* namespace for markers. ex) marker.irq.softirq.exit 2nd symbol means subsystem and 3nd or later symbols are depends on the subsystem. As you can see in sample.stp, we can easily specify the events occurred on each subsystem. Thank you, -- Masami Hiramatsu Software Engineer Hitachi Computer Products (America) Inc. Software Solutions Division e-mail: mhiramat@redhat.com --------------040801080108050806030007 Content-Type: text/plain; name="marker.stp" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="marker.stp" Content-length: 7227 // // kernel marker tapset // // This file is part of systemtap, and is free software. You can // redistribute it and/or modify it under the terms of the GNU General // Public License (GPL); either version 2, or (at your option) any // later version. /* * Each marker has "name" variable which stores marker name. */ /*-------------------------------------------* * marker.irq.* - IRQ related markers *-------------------------------------------*/ /* * probe marker.irq.hardirq.entry * * Fires just before handing a hard interrupt. * * Context: * A hard interrupt occurs. * * Arguments: * irq_id - the id of hard irq. * kernel_mode - boolean indicating whether the interrupt occured * in kernel mode. */ probe marker.irq.hardirq.entry = kernel.mark("kernel_irq_entry") { name = "kernel_irq_entry" irq_id = $arg1 kernel_mode = $arg2 } /* * probe marker.irq.hardirq.exit * * Fires after handling a hard interrupt. * * Context: * A hard interrupt was handled. * * Arguments: * irq_id - the id of hard irq. * retval - return value of handle_IRQ_event(). */ probe marker.irq.hardirq.exit = kernel.mark("kernel_irq_exit") { name = "kernel_irq_exit" irq_id = $arg1 retval = $arg2 } /* * probe marker.irq.softirq.enter * * Fires before calling softirq handler. * * Context: * Softirq handler will be invoked. * * Arguments: * softirq_id - the id of softirq. * func - the pointer of softirq handler. * * Note: * On specific architecture(ex. ia64) the "func" is not the address of * the actuall function. You might need to derefer *func for getting * actuall adress. */ probe marker.irq.softirq.entry = kernel.mark("kernel_softirq_entry") { name = "kernel_softirq_entry" softirq_id = $arg1 func = $arg2 } /* * probe marker.irq.softirq.exit * * Fires after calling softirq handler. * * Context: * Softirq handler was handled. * * Arguments: * softirq_id - the id of softirq. */ probe marker.irq.softirq.exit = kernel.mark("kernel_softirq_exit") { name = "kernel_softirq_exit" softirq_id = $arg1 } /* * probe marker.irq.tasklet_low.enter * * Fires before calling tasklet_low handler. * * Context: * Tasklet(low) handler will be invoked. * * Arguments: * func - the pointer of tasklet_low handler. * data - the data passed to the handler. * * Note: * On specific architecture(ex. ia64) the "func" is not the address of * the actuall function. You might need to derefer *func for getting * actuall adress. */ probe marker.irq.tasklet_low.entry = kernel.mark("kernel_tasklet_low_entry") { name = "kernel_tasklet_low_entry" func = $arg1 data = $arg2 } /* * probe marker.irq.tasklet_low.exit * * Fires after calling tasklet_low handler. * * Context: * Tasklet(low) handler was handled. * * Arguments: * func - the pointer of tasklet_low handler. * data - the data passed to the handler. * * Note: * On specific architecture(ex. ia64) the "func" is not the address of * the actuall function. You might need to derefer *func for getting * actuall adress. */ probe marker.irq.tasklet_low.exit = kernel.mark("kernel_tasklet_low_exit") { name = "kernel_tasklet_low_exit" func = $arg1 data = $arg2 } /* * probe marker.irq.tasklet_high.enter * * Fires before calling tasklet_high handler. * * Context: * Tasklet(high) handler will be invoked. * * Arguments: * func - the pointer of tasklet_high handler. * data - the data passed to the handler. * * Note: * On specific architecture(ex. ia64) the "func" is not the address of * the actuall function. You might need to derefer *func for getting * actuall adress. */ probe marker.irq.tasklet_high.entry = kernel.mark("kernel_tasklet_high_entry") { name = "kernel_tasklet_high_entry" func = $arg1 data = $arg2 } /* * probe marker.irq.tasklet_high.exit * * Fires after calling tasklet_high handler. * * Context: * Tasklet(high) handler was handled. * * Arguments: * func - the pointer of tasklet_high handler. * data - the data passed to the handler. * * Note: * On specific architecture(ex. ia64) the "func" is not the address of * the actuall function. You might need to derefer *func for getting * actuall adress. */ probe marker.irq.tasklet_high.exit = kernel.mark("kernel_tasklet_high_exit") { name = "kernel_tasklet_high_exit" func = $arg1 data = $arg2 } /*-------------------------------------------* * marker.process.* - Process related markers *-------------------------------------------*/ /* * probe marker.process.free * * Fires when task_struct is released. * * Context: * A process is released. * * Arguments: * pid - released process pid. */ probe marker.process.free = kernel.mark("kernel_process_free") { name = "kernel_process_free" pid = $arg1 } /* * probe marker.process.wait * * Fires when do_wait() is called. * * Context: * Current process waits another process. * * Arguments: * pid - waiting target pid. */ probe marker.process.wait = kernel.mark("kernel_process_wait") { name = "kernel_process_wait" pid = $arg1 } /* * probe marker.process.exit * * Fires when do_exit() is called. * * Context: * A process exits. * * Arguments: * pid - exit process pid. */ probe marker.process.exit = kernel.mark("kernel_process_exit") { name = "kernel_process_exit" pid = $arg1 } /* * probe marker.process.fork * * Fires when a process forked/cloned. * * Context: * A process forked/cloned. * * Arguments: * pid - parent pid. * parent_pid - same as above "pid". * child_pid - forked child pid. * child_tgid - forked child thread group id. */ probe marker.process.fork = kernel.mark("kernel_process_fork") { name = "kernel_process_fork" pid = $arg1 parent_pid = $arg1 child_pid = $arg2 child_tgid = $arg3 } /*-----------------------------------------------* * marker.scheduler.* - scheduler related markers *-----------------------------------------------*/ probe __marker.scheduler.wakeup = kernel.mark("kernel_sched_wakeup") { name = "kernel_sched_wakeup" } probe __marker.scheduler.wakeup_new = kernel.mark("kernel_sched_wakeup_new") { name = "kernel_sched_wakeup_new" } /* * probe marker.scheduler.wakeup * * Fires a process wakeup. * * Context: * A process wakeup. * * Arguments: * pid - wakeup process pid. * state - process task state. * cpu_id - the id of cpu where the process wakeup. */ probe marker.scheduler.wakeup = __marker.scheduler.wakeup, __marker.scheduler.wakeup_new { pid = $arg1 state = $arg2 cpu_id = $arg3 } /* * probe marker.scheduler.switch * * Fires scheduler switches tasks. * * Context: * A process is switching to another process. * * Arguments: * prev_pid - the pid of the process from which next task is switched. * next_pid - the pid of the process to which previous task switches. * prev_state - task state of previous process * prev_prio - task priority of previous process * next_prio - task priority of next process */ probe marker.scheduler.switch = kernel.mark("kernel_sched_switch") { name = "kernel_sched_switch" prev_pid = $arg1 next_pid = $arg2 prev_state = $arg3 prev_prio = $arg4 next_prio = $arg5 } --------------040801080108050806030007 Content-Type: text/plain; name="sample.stp" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="sample.stp" Content-length: 829 #!/usr/bin/stap # # sample script for kernel marker # #------------------------------------------------------------ # Counter #------------------------------------------------------------ global num #------------------------------------------------------------ # Probes #------------------------------------------------------------ # # Interrupts # probe marker.irq.* { num[name] <<< 1 } # # Scheduler # probe marker.scheduler.* { num[name] <<< 1 } # # Process # probe marker.process.* { num[name] <<< 1 } #------------------------------------------------------------ # begin/end #------------------------------------------------------------ probe begin { printf("[STP] --- start ---\n") } probe end { printf("[STP] --- end ---\n") foreach (n+ in num) { printf("%s is hit %d times\n", n, @count(num[n])) } } --------------040801080108050806030007--