From 19b83979ae27db09efa0f35b9067ea8ec2f75018 Mon Sep 17 00:00:00 2001 From: cramakri <cramakri> Date: Thu, 19 May 2011 10:59:21 +0000 Subject: [PATCH] MINOR: Added dtrace script to log disk io. SVN: 21387 --- openbis_all/source/bash/internal/disk-io.d | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 openbis_all/source/bash/internal/disk-io.d diff --git a/openbis_all/source/bash/internal/disk-io.d b/openbis_all/source/bash/internal/disk-io.d new file mode 100644 index 00000000000..f29f6bf6eee --- /dev/null +++ b/openbis_all/source/bash/internal/disk-io.d @@ -0,0 +1,42 @@ +#!/usr/sbin/dtrace -s +/* + * disk-io.d - print out calls to file open/close and read/write operations + * + * Usage -- make sure the file is executable. Then run it with the -p flag specifying the process to trace. + * Example: + * ./disk-ip.d -p {id of process to trace}) + * + * The pid of java programs can be obtained from jps. + */ + +syscall::open*:entry +/pid == $target/ +{ + self->filename = copyinstr(arg0); + printf("%s", self->filename); +} + +syscall::open*:return +/pid == $target/ +{ + self->handles[arg1] = self->filename; +} + +syscall::close*:entry +/pid == $target/ +{ + printf("%s",self->handles[arg0]); + self->handles[arg0] = 0; +} + +syscall::read*:entry +/pid == $target/ +{ + printf("%s", self->handles[arg0]); +} + +syscall::write*:entry +/pid == $target/ +{ + printf("%s", self->handles[arg0]); +} \ No newline at end of file -- GitLab