diff options
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | tapset/ioscheduler.stp | 81 | ||||
-rw-r--r-- | tapset/memory.stp | 16 | ||||
-rw-r--r-- | tapset/networking.stp | 31 | ||||
-rw-r--r-- | tapset/process.stp | 7 | ||||
-rw-r--r-- | tapset/scsi.stp | 79 | ||||
-rw-r--r-- | tapset/tskschedule.stp | 27 |
7 files changed, 250 insertions, 0 deletions
@@ -1,3 +1,12 @@ +2006-05-18 Li Guanglei <guanglei@cn.ibm.com> + + * tapset/ioscheduler.stp: generic IO scheduler tapsets from LKET + * tapset/ioscheduler.stp: generic pagefault tapsets from LKET + * tapset/ioscheduler.stp: generic networking tapsets from LKET + * tapset/scsi.stp: generic scsi tapsets from LKET + * tapset/tskschedule.stp: generic task scheduler tapsets from LKET + * tapset/process.stp: changes to process.exec alias + 2006-05-16 David Smith <dsmith@redhat.com> * parse.cxx (parser::parser): Added initializer for 'context' diff --git a/tapset/ioscheduler.stp b/tapset/ioscheduler.stp new file mode 100644 index 00000000..1871772f --- /dev/null +++ b/tapset/ioscheduler.stp @@ -0,0 +1,81 @@ +// IO scheduler tapset +// Copyright (C) 2005, 2006 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. + +%{ +#include <linux/blkdev.h> +#include <linux/elevator.h> +%} + +/* when a request is retrieved from request queue */ +probe ioscheduler.elv_next_request + = kernel.function("elv_next_request") +{ +%( kernel_v >= "2.6.10" %? + elevator_name = kernel_string($q->elevator->elevator_type->elevator_name) +%: + elevator_name = kernel_string($q->elevator.elevator_name) +%) + disk_major = disk_major_from_request($q) + disk_minor = disk_minor_from_request($q) +} + +/* when a request is added to the request queue */ +probe ioscheduler.elv_add_request + = kernel.function("__elv_add_request") +{ +%( kernel_v >= "2.6.10" %? + elevator_name = kernel_string($q->elevator->elevator_type->elevator_name) +%: + elevator_name = kernel_string($q->elevator.elevator_name) +%) + disk_major = $rq->rq_disk->major + disk_minor = $rq->rq_disk->first_minor +} + +/* when a request is completed */ +probe ioscheduler.elv_completed_request + = kernel.function("elv_completed_request") +{ +%( kernel_v >= "2.6.10" %? + elevator_name = kernel_string($q->elevator->elevator_type->elevator_name) +%: + elevator_name = kernel_string($q->elevator.elevator_name) +%) + disk_major = $rq->rq_disk->major + disk_minor = $rq->rq_disk->first_minor +} + +function disk_major_from_request:long(var_q:long) +%{ + struct request_queue *q; + struct request *rq; + + q = (struct request_queue *)((long)THIS->var_q); + + if(list_empty(&(q->queue_head))) + THIS->__retvalue = -1; + else { + rq = list_entry_rq(q->queue_head.next); + THIS->__retvalue = rq->rq_disk->first_minor; + } +%} + +function disk_minor_from_request:long(var_q:long) +%{ + struct request_queue *q; + struct request *rq; + + q = (struct request_queue *)((long)THIS->var_q); + + if(list_empty(&(q->queue_head))) + THIS->__retvalue = -1; + else { + rq = list_entry_rq(q->queue_head.next); + THIS->__retvalue = rq->rq_disk->first_minor; + } +%} diff --git a/tapset/memory.stp b/tapset/memory.stp new file mode 100644 index 00000000..9289ae5e --- /dev/null +++ b/tapset/memory.stp @@ -0,0 +1,16 @@ +// memory related tapset +// Copyright (C) 2005, 2006 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. + +/* Record the page fault event */ +probe pagefault + = kernel.function(%( kernel_v >= "2.6.13" %? "__handle_mm_fault" + %: "handle_mm_fault" %)) +{ + write_access = $write_access + address = $address +} diff --git a/tapset/networking.stp b/tapset/networking.stp new file mode 100644 index 00000000..f32953fd --- /dev/null +++ b/tapset/networking.stp @@ -0,0 +1,31 @@ +// networking tapset +// Copyright (C) 2005, 2006 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. + +%{ +#include <linux/netdevice.h> +%} + +/* Main device receive routine, be called when packet arrives on network device */ +probe netdev.receive + = kernel.function("netif_receive_skb") +{ + dev_name = kernel_string($skb->dev->name) + length = $skb->len + protocol = $skb->protocol + truesize = $skb->truesize +} + +/* Queue a buffer for transmission to a network device */ +probe netdev.transmit + = kernel.function("dev_queue_xmit") +{ + dev_name = kernel_string($skb->dev->name) + length = $skb->len + protocol = $skb->protocol + truesize = $skb->truesize +} diff --git a/tapset/process.stp b/tapset/process.stp index 6f983603..3c8f299d 100644 --- a/tapset/process.stp +++ b/tapset/process.stp @@ -25,6 +25,7 @@ function _IS_ERR:long(ptr) %{ */ probe process.create = kernel.function("copy_process").return { task = retval() + new_pid = $pid if (_IS_ERR(task)) next } @@ -50,10 +51,13 @@ probe process.start = kernel.function("schedule_tail") { } * filename - the path to the new executable */ probe process.exec = +/* kernel.function("do_execve") %( arch != "i586" %? %( arch != "i686" %? , kernel.function("compat_do_execve") %) %) +*/ + kernel.function("*do_execve") { filename = kernel_string($filename) } @@ -72,10 +76,13 @@ probe process.exec = * success - a boolean indicating whether the exec was successful */ probe process.exec.complete = +/* kernel.function("do_execve").return %( arch != "i586" %? %( arch != "i686" %? , kernel.function("compat_do_execve").return %) %) +*/ + kernel.function("*do_execve").return { errno = retval() success = (errno >= 0) diff --git a/tapset/scsi.stp b/tapset/scsi.stp new file mode 100644 index 00000000..0cd74be2 --- /dev/null +++ b/tapset/scsi.stp @@ -0,0 +1,79 @@ +// scsi tapset +// Copyright (C) 2005, 2006 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. + +%{ +#include <linux/types.h> +#include <scsi/scsi_cmnd.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_host.h> +#include <linux/timer.h> +#include <linux/blkdev.h> +%} + +/* mid-layer prepare a IO request */ +probe scsi.ioentry + = module("*").function("scsi_prep_fn@drivers/scsi/scsi_lib.c") +{ + disk_major = $req->rq_disk->major + disk_minor = $req->rq_disk->first_minor + device_state = get_devstate_from_req($q) +} + +/* Dispatch a command to the low-level driver. */ +probe scsi.iodispatching + = module("*").function("scsi_dispatch_cmd@drivers/scsi/scsi.c") +{ + + host_no = $cmd->device->host->host_no + channel = $cmd->device->channel + lun = $cmd->device->lun + dev_id = $cmd->device->id + device_state = $cmd->device->sdev_state + data_direction = $cmd->sc_data_direction + request_buffer = $cmd->request_buffer + req_bufflen = $cmd->request_bufflen +} + +/* I/O is done by low-level driver*/ +probe scsi.iodone + = module("*").function("scsi_done@drivers/scsi/scsi.c") +{ + host_no = $cmd->device->host->host_no + channel = $cmd->device->channel + lun = $cmd->device->lun + dev_id = $cmd->device->id + device_state = $cmd->device->sdev_state + data_direction = $cmd->sc_data_direction + scsi_timer_pending = scsi_timer_pending($cmd); +} + +/* mid-layer processes the completed IO */ +probe scsi.iocompleted + = module("*").function("scsi_io_completion@drivers/scsi/scsi_lib.c") +{ + host_no = $cmd->device->host->host_no + channel = $cmd->device->channel + lun = $cmd->device->lun + dev_id = $cmd->device->id + device_state = $cmd->device->sdev_state + data_direction = $cmd->sc_data_direction + goodbytes = $good_bytes +} + +function scsi_timer_pending:long(var:long) +%{ + struct scsi_cmnd *cmd = (struct scsi_cmnd *)((long)THIS->var); + THIS->__retvalue = timer_pending(&cmd->eh_timeout); +%} + +function get_devstate_from_req:long(var:long) +%{ + struct request_queue *q = (struct request_queue *)((long)THIS->var); + struct scsi_device *sdev = (struct scsi_device *)(q->queuedata); + THIS->__retvalue = sdev->sdev_state; +%} diff --git a/tapset/tskschedule.stp b/tapset/tskschedule.stp new file mode 100644 index 00000000..75ccb221 --- /dev/null +++ b/tapset/tskschedule.stp @@ -0,0 +1,27 @@ +// task scheduler tapset +// Copyright (C) 2005, 2006 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. + +/* Only applicable to SMP systems */ +probe tskdispatch.cpuidle + = kernel.inline("idle_balance") +{ +} + +probe tskdispatch.ctxswitch + = kernel.function("__switch_to") +{ +%( arch == "ppc64" %? + prev_pid = $prev->pid + next_pid = $new->pid + prevtsk_state = $prev->state +%: + prev_pid = $prev_p->pid + next_pid = $next_p->pid + prevtsk_state = $prev_p->pid +%) +} |