diff options
author | Prerna Saxena <prerna@linux.vnet.ibm.com> | 2009-11-09 11:36:11 +0530 |
---|---|---|
committer | Prerna Saxena <prerna@linux.vnet.ibm.com> | 2009-11-09 11:36:11 +0530 |
commit | a476086d1ef0448c86e466f5955f78d282b473fd (patch) | |
tree | c2e4c6752c451de3b1137da53b5095ba664bfaef | |
parent | fafeaf8e5874e6855343421b5dd91403fc49c991 (diff) | |
download | systemtap-steved-a476086d1ef0448c86e466f5955f78d282b473fd.tar.gz systemtap-steved-a476086d1ef0448c86e466f5955f78d282b473fd.tar.xz systemtap-steved-a476086d1ef0448c86e466f5955f78d282b473fd.zip |
IRQ tapset, sample script, testsuite, man page updates, etc
-rw-r--r-- | man/stapprobes.irq.3stap | 155 | ||||
-rw-r--r-- | man/stapprobes.irq.3stap.in | 155 | ||||
-rw-r--r-- | tapset/irq.stp | 172 | ||||
-rw-r--r-- | testsuite/buildok/irq.stp | 7 | ||||
-rw-r--r-- | testsuite/systemtap.examples/interrupt/interrupts-by-dev.stp | 31 |
5 files changed, 520 insertions, 0 deletions
diff --git a/man/stapprobes.irq.3stap b/man/stapprobes.irq.3stap new file mode 100644 index 00000000..b5315c86 --- /dev/null +++ b/man/stapprobes.irq.3stap @@ -0,0 +1,155 @@ +.\" -*- nroff -*- +.TH STAPPROBES.SNMP 3stap 2009-05-11 "IBM" +.SH NAME +stapprobes.irq \- Systemtap probes for IRQ, workqueue,etc + +.\" macros +.de SAMPLE +.br +.RS +.nf +.nh +.. +.de ESAMPLE +.hy +.fi +.RE +.. + +.SH DESCRIPTION + +Probe points for probing irq handler execution, softirqs, workqueues,etc + +.P +.TP +.B workqueue.create +probes creation of a new workqueue + +.B Arguments: +.I wq_thread + task_struct of the workqueue thread. +.I cpu + cpu for which the worker thread is created. + +.P +.TP +.B workqueue.insert +probes queuing of work on a workqueue. + +.B Arguments: +.I wq_thread + task_struct of the workqueue thread. +.I work + work_struct* being executed. +.I work_func + pointer to handler func. + +.P +.TP +.B workqueue.execute +probes execution of deferred work. + +.B Arguments: +.I wq_thread + task_struct of the workqueue thread. +.I work + work_struct* being executed. +.I work_func + pointer to handler func. + +.P +.TP +.B workqueue.destroy +probes destruction of each worker thread of each cpu for a workqueue. + +.B Arguments: +.I wq_thread + task_struct of the workqueue thread. + +.P +.TP +.B irq_handler.entry +Fires prior to execution of interrupt handler. +.B Arguments: +.I irq + irq number +.I action + struct irqaction* for this interrupt number +.I handler + interrupt handler function +.I flags + flags for this irq. +.I flags_str + A formatted string of flags. +.I dev_name + name of device +.I dev_id + cookie to identify device +.I next_irqaction + pointer to next irqaction for shared interrupts +.I dir + pointer to the /proc/irq/NN/name entry +.I thread_fn + interrupt handler function for threaded interrupts +.I thread + thread pointer for threaded interrupts +.I thread_flags + flags related to thread + +.P +.TP +.B irq_handler.exit +Fires post execution of interrupt handler. +.B Arguments: +.I irq + irq number +.I action + struct irqaction* for this interrupt number +.I ret + return value from interrupt handler that just executed. +.I handler + interrupt handler function +.I flags + flags for this irq. +.I flags_str + A formatted string of flags. +.I dev_name + name of device +.I dev_id + cookie to identify device +.I next_irqaction + pointer to next irqaction for shared interrupts +.I dir +.I thread_fn + interrupt handler function for threaded interrupts +.I thread + thread pointer for threaded interrupts +.I thread_flags + flags related to thread + +.P +.TP +.B softirq.entry +triggered just before executing handler for a pending softirq +.I h + struct softirq* for current pending softirq. +.I vec + softirq_action vector +.I action + pointer to softirq handler just about to execute. + +.P +.TP +.B softirq.exit +triggered just after executing handler for a pending softirq +.I h + struct softirq* for just executed softirq. +.I vec + softirq_action vector +.I action + pointer to softirq handler that just finished execution. + +.SH SEE ALSO +.IR stap (1), +.IR stapprobes (3stap) + diff --git a/man/stapprobes.irq.3stap.in b/man/stapprobes.irq.3stap.in new file mode 100644 index 00000000..84eaab16 --- /dev/null +++ b/man/stapprobes.irq.3stap.in @@ -0,0 +1,155 @@ +.\" -*- nroff -*- +.TH STAPPROBES.SNMP 3stap @DATE@ "IBM" +.SH NAME +stapprobes.irq \- Systemtap probes for IRQ, workqueue,etc + +.\" macros +.de SAMPLE +.br +.RS +.nf +.nh +.. +.de ESAMPLE +.hy +.fi +.RE +.. + +.SH DESCRIPTION + +Probe points for probing irq handler execution, softirqs, workqueues,etc + +.P +.TP +.B workqueue.create +probes creation of a new workqueue + +.B Arguments: +.I wq_thread + task_struct of the workqueue thread. +.I cpu + cpu for which the worker thread is created. + +.P +.TP +.B workqueue.insert +probes queuing of work on a workqueue. + +.B Arguments: +.I wq_thread + task_struct of the workqueue thread. +.I work + work_struct* being executed. +.I work_func + pointer to handler func. + +.P +.TP +.B workqueue.execute +probes execution of deferred work. + +.B Arguments: +.I wq_thread + task_struct of the workqueue thread. +.I work + work_struct* being executed. +.I work_func + pointer to handler func. + +.P +.TP +.B workqueue.destroy +probes destruction of each worker thread of each cpu for a workqueue. + +.B Arguments: +.I wq_thread + task_struct of the workqueue thread. + +.P +.TP +.B irq_handler.entry +Fires prior to execution of interrupt handler. +.B Arguments: +.I irq + irq number +.I action + struct irqaction* for this interrupt number +.I handler + interrupt handler function +.I flags + flags for this irq. +.I flags_str + A formatted string of flags. +.I dev_name + name of device +.I dev_id + cookie to identify device +.I next_irqaction + pointer to next irqaction for shared interrupts +.I dir + pointer to the /proc/irq/NN/name entry +.I thread_fn + interrupt handler function for threaded interrupts +.I thread + thread pointer for threaded interrupts +.I thread_flags + flags related to thread + +.P +.TP +.B irq_handler.exit +Fires post execution of interrupt handler. +.B Arguments: +.I irq + irq number +.I action + struct irqaction* for this interrupt number +.I ret + return value from interrupt handler that just executed. +.I handler + interrupt handler function +.I flags + flags for this irq. +.I flags_str + A formatted string of flags. +.I dev_name + name of device +.I dev_id + cookie to identify device +.I next_irqaction + pointer to next irqaction for shared interrupts +.I dir + pointer to the /proc/irq/NN/name entry +.I thread_fn + interrupt handler function for threaded interrupts +.I thread + thread pointer for threaded interrupts +.I thread_flags + flags related to thread + +.P +.TP +.B softirq.entry +triggered just before executing handler for a pending softirq +.I h + struct softirq* for current pending softirq. +.I vec + softirq_action vector +.I action + pointer to softirq handler just about to execute. + +.P +.TP +.B softirq.exit +triggered just after executing handler for a pending softirq +.I h + struct softirq* for just executed softirq. +.I vec + softirq_action vector +.I action + pointer to softirq handler that just finished execution. + +.SH SEE ALSO +.IR stap (1), +.IR stapprobes (3stap) diff --git a/tapset/irq.stp b/tapset/irq.stp new file mode 100644 index 00000000..6a9b9147 --- /dev/null +++ b/tapset/irq.stp @@ -0,0 +1,172 @@ +/* + * Copyright (C) 2009 IBM Corp. + * 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. + * + * Version 1.0 prerna@linux.vnet.ibm.com 2009-10-28 + * + * Tracepoint based tapset for IRQs, Workqueues, etc + * + */ +// Probes for workqueues. + +/** + * probe workqueue.create : probes creation of a new workqueue + * @wq_thread : task_struct of the workqueue thread. + * @cpu : cpu for which the worker thread is created. + */ +probe workqueue.create = kernel.trace("workqueue_creation") +{ + wq_thread = $wq_thread + cpu = $cpu +} + +/** + * probe workqueue.insert : probes queuing of work on a workqueue + * @wq_thread : task_struct of the workqueue thread. + * @work : work_struct* being queued. + * @work_func : pointer to handler func. + */ +probe workqueue.insert = kernel.trace("workqueue_insertion") +{ + wq_thread = $wq_thread + work = $work + work_func = $work->func +} + +/** + * probe workqueue.execute : probes execution of deferred work. + * @wq_thread : task_struct of the workqueue thread. + * @work : work_struct* being executed. + * @work_func : pointer to handler func. + */ +probe workqueue.execute = kernel.trace("workqueue_execution") +{ + wq_thread = $wq_thread + work = $work + work_func = $work->func +} + +/** + * probe workqueue.destroy : probes destruction of each worker thread of each cpu for a workqueue. + * @wq_thread : task_struct of the workqueue thread. + */ +probe workqueue.destroy = kernel.trace("workqueue_destruction") +{ + wq_thread = $wq_thread +} + +// Probes for IRQ handlers. + +/** + * probe irq_handler.entry : Fires prior to execution of interrupt handler. + * @irq : irq number. + * @action : struct irqaction* for this interrupt num. + * @handler : interrupt handler function. + * @flags : Flags for IRQ handler + * IRQF_DISABLED [0x00000020] : keep irqs disabled when calling action handler. + * IRQF_SAMPLE_RANDOM [0x00000040] : irq is used to feed the random generator + * IRQF_SHARED [0x00000080] : allow sharing the irq among several devices + * IRQF_PROBE_SHARED [0x00000100] : set by callers when they expect sharing mismatches to occur + * IRQF_TIMER [0x00000200] : Flag to mark this interrupt as timer interrupt + * IRQF_PERCPU [0x00000400] : Interrupt is per cpu. + * IRQF_NOBALANCING [0x00000800] : Flag to exclude this interrupt from irq balancing + * IRQF_IRQPOLL [0x00001000] : Interrupt is used for polling. + * IRQF_ONESHOT [0x00002000] : Interrupt is not reenabled after the hardirq handler finished. + * @flags_str : symbolic string representation of IRQ flags. + * @dev_name : name of device. + * @dev_id : Cookie to identify device. + * @next_irqaction : pointer to next irqaction for shared interrupts. + * @dir : pointer to the proc/irq/NN/name entry + * @thread_fn : interupt handler function for threaded interrupts. + * @thread : thread pointer for threaded interrupts. + * @thread_flags : Flags related to thread. + */ +probe irq_handler.entry = kernel.trace("irq_handler_entry") +{ + irq = $irq + action = $action + handler = $action->handler + flags = $action->flags + flags_str = irqflags_str(flags) + dev_name = $action->name + dev_id = $action->dev_id + next_irqaction = $action->next + dir = $action->dir + thread_fn = $action->thread_fn + thread = $action->thread + thread_flags = $action->thread_flags +} + +/** + * probe irq_handler.exit : Fires just after execution of interrupt handler. + * @irq : interrupt number + * @action : struct irqaction* + * @ret : return value of the handler + * @handler : interrupt handler function that was executed. + * @flags : flags for IRQ handler + * IRQF_DISABLED [0x00000020] : keep irqs disabled when calling action handler. + * IRQF_SAMPLE_RANDOM [0x00000040] : irq is used to feed the random generator + * IRQF_SHARED [0x00000080] : allow sharing the irq among several devices + * IRQF_PROBE_SHARED [0x00000100] : set by callers when they expect sharing mismatches to occur + * IRQF_TIMER [0x00000200] : Flag to mark this interrupt as timer interrupt + * IRQF_PERCPU [0x00000400] : Interrupt is per cpu. + * IRQF_NOBALANCING [0x00000800] : Flag to exclude this interrupt from irq balancing + * IRQF_IRQPOLL [0x00001000] : Interrupt is used for polling. + * IRQF_ONESHOT [0x00002000] : Interrupt is not reenabled after the hardirq handler finished. + * @flags_str : symbolic string representation of IRQ flags. + * @dev_name : name of device. + * @dev_id : Cookie to identify device. + * @next_irqaction : pointer to next irqaction for shared interrupts. + * @dir : pointer to the proc/irq/NN/name entry + * @thread_fn : interupt handler function for threaded interrupts. + * @thread : thread pointer for threaded interrupts. + * @thread_flags : Flags related to thread. + */ +probe irq_handler.exit = kernel.trace("irq_handler_exit") +{ + irq = $irq + action = $action + ret = $ret + handler = $action->handler + flags = $action->flags + flags_str = irqflags_str(flags) + dev_name = $action->name + dev_id = $action->dev_id + next_irqaction = $action->next + dir = $action->dir + thread_fn = $action->thread_fn + thread = $action->thread + thread_flags = $action->thread_flags +} + +// Softirq based probes. +/** + * probe softirq.entry : triggered just before executing handler + * for a pending softirq. + * @h : struct softirq_action* for current pending softirq. + * @vec : softirq_action vector. + * @action : pointer to softirq handler just about to execute. + */ +probe softirq.entry = kernel.trace("softirq_entry") +{ + h = $h + vec = $vec + action = $h->action +} + +/** + * probe softirq.exit : triggered just after executing handler for a pending + * softirq. + * @h : struct softirq_action* for just executed softirq. + * @vec : softirq_action vector. + * @action : pointer to softirq handler that just finished execution. + */ +probe softirq.exit = kernel.trace("softirq_exit") +{ + h = $h + vec = $vec + action = $h->action +} diff --git a/testsuite/buildok/irq.stp b/testsuite/buildok/irq.stp new file mode 100644 index 00000000..b1a141dc --- /dev/null +++ b/testsuite/buildok/irq.stp @@ -0,0 +1,7 @@ +#! stap -p4 + +// Tests if all probes in irq tapset are resolvable + +probe workqueue.* {} +probe irq_handler.* {} +probe softirq.* {} diff --git a/testsuite/systemtap.examples/interrupt/interrupts-by-dev.stp b/testsuite/systemtap.examples/interrupt/interrupts-by-dev.stp new file mode 100644 index 00000000..3bcfd5e1 --- /dev/null +++ b/testsuite/systemtap.examples/interrupt/interrupts-by-dev.stp @@ -0,0 +1,31 @@ +#! /usr/bin/env stap +/* + * Copyright (C) 2009 IBM Corp. + * 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. + * + * Version 1.0 prerna@linux.vnet.ibm.com 2009-10-28 + * + * Name: + * interrupts-by-dev.stp + * + * Description: + * Script to profile interrupts received by each device per 100 ms. + * + * + */ + +global devices + +probe irq_handler.entry { + devices[dev_name]++; +} + +probe timer.ms(100) { + printf("\t DEVICE \t NUMBER OF INTERRUPTS \n"); + foreach ( devname in devices ) + printf(" %20s : %5d\n",kernel_string(devname),devices[devname]); + delete devices +} |