Re: [dtrace-discuss] Distinguish filesystem from UNIX domain socket activity in syscall provider

2010-07-13 Thread Ralph Böhme
Jim,

thanks a lot for your suggestions! I just came up with a different solution a 
few minutes ago, here it is:

as the filesystem IO read and writes are always embedded in opens and closes, 
and I know the name of the UNIX domain socket, I can match against that in 
open:entry:

syscall::open*:entry
/(((OPT_command || OPT_pid) && pid == $target) || (OPT_name && execname == 
NAME)) && copyinstr(arg0) != "/path/to/socket"/
{
/* set start details */
self->start = timestamp;
self->vstart = vtimestamp;
}

Then in open:return I can grab the fd:

syscall::*open*:return
/self->start/
{
/* save fd number */
self->fd = arg0;

/* calculate elapsed time */

}

In read:entry/return I can now test if the read/write is on the fd of the last 
open:

syscall::*read*:entry,
syscall::*write*:entry
/((OPT_command || OPT_pid) && pid == $target) || (OPT_name && execname == NAME)/
{
self->fd = self->fd == arg0 ? arg0 : 0;

/* set start details */
self->start = timestamp;
self->vstart = vtimestamp;
}

/*
 * filesystem IO
 */
syscall::*read*:return,
syscall::*write*:return
/self->start && self->fd/
{
/* calculate elapsed time */

}

/*
 * socket IO
 */
syscall::*read*:return,
syscall::*write*:return
/self->start && self->fd == 0/
{
/* calculate elapsed time */

}
-- 
This message posted from opensolaris.org
___
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org


Re: [dtrace-discuss] Distinguish filesystem from UNIX domain socket activity in syscall provider

2010-07-13 Thread Jim Mauro

You could first filter out the target file system for the file IO by
doing a count() aggregation on;

[fds[arg0].fi_fs] = count();

NOTE - this will only work for those system calls that take a file
descriptor as arg0.

Once you know the FS target for the file IO (ufs? zfs? whatever), use it
in a predicate to capture systems calls of interest;

/ fds[arg0].fi_fs == "ufs" /

(for example - replace "ufs" with whatever came up in the previous 
result.

And, again, this will only work for the system calls that take a
file descriptor as arg0.

HTH
/jim

On Jul 13, 2010, at 7:10 AM, Ralph Böhme wrote:

> Dtracers,
> 
> I'm investigating some performance issues using a simple dtrace script which 
> collects read,write,stat,... syscall data. This works fine and gives me some 
> good data.
> Unfortunately the app I'm tracing is concurrently doing file IO and IO on a 
> UNIX domain socket. As I'm only interested in data for file IO, I'm 
> investigating how I can modify my syscall probes. I'm currenty doing stuff 
> like this:
> 
> /*
> * Save syscall entry info
> */
> syscall::*stat*:entry, 
> syscall::*open*:entry,
> syscall::*read*:entry,
> syscall::*write*:entry,
> syscall::getdents*:entry,
> syscall::*sync*:entry
> /((OPT_command || OPT_pid) && pid == $target) || (OPT_name && execname == 
> NAME)/
> {
>/* set start details */
>self->start = timestamp;
>self->vstart = vtimestamp;
> }
> 
> /*
> * Print return data
> */
> 
> syscall::*stat*:return, 
> syscall::*open*:return,
> syscall::*read*:return,
> syscall::*write*:return,
> syscall::getdents*:return,
> syscall::*sync*:return
> /self->start/
> {
>/* calculate elapsed time */
>this->elapsed = (timestamp - self->start) / 1000;
>self->start = 0;
>this->cpu = (vtimestamp - self->vstart) / 1000;
>self->vstart = 0;
> 
>@count[probefunc] = count();
>@sum[probefunc] = sum(this->elapsed);
>@elapsed[probefunc] = quantize(this->elapsed);
>@oncpu[probefunc] = quantize(this->cpu);
>@avg[probefunc] = avg(this->elapsed);
> 
> }
> 
> Any hint for me? Thanks!
> -Ralph
> -- 
> This message posted from opensolaris.org
> ___
> dtrace-discuss mailing list
> dtrace-discuss@opensolaris.org

___
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org


[dtrace-discuss] Distinguish filesystem from UNIX domain socket activity in syscall provider

2010-07-13 Thread Ralph Böhme
Dtracers,

I'm investigating some performance issues using a simple dtrace script which 
collects read,write,stat,... syscall data. This works fine and gives me some 
good data.
Unfortunately the app I'm tracing is concurrently doing file IO and IO on a 
UNIX domain socket. As I'm only interested in data for file IO, I'm 
investigating how I can modify my syscall probes. I'm currenty doing stuff like 
this:

/*
 * Save syscall entry info
 */
syscall::*stat*:entry, 
syscall::*open*:entry,
syscall::*read*:entry,
syscall::*write*:entry,
syscall::getdents*:entry,
syscall::*sync*:entry
/((OPT_command || OPT_pid) && pid == $target) || (OPT_name && execname == NAME)/
{
/* set start details */
self->start = timestamp;
self->vstart = vtimestamp;
}

/*
 * Print return data
 */

syscall::*stat*:return, 
syscall::*open*:return,
syscall::*read*:return,
syscall::*write*:return,
syscall::getdents*:return,
syscall::*sync*:return
/self->start/
{
/* calculate elapsed time */
this->elapsed = (timestamp - self->start) / 1000;
self->start = 0;
this->cpu = (vtimestamp - self->vstart) / 1000;
self->vstart = 0;

@count[probefunc] = count();
@sum[probefunc] = sum(this->elapsed);
@elapsed[probefunc] = quantize(this->elapsed);
@oncpu[probefunc] = quantize(this->cpu);
@avg[probefunc] = avg(this->elapsed);

}

Any hint for me? Thanks!
-Ralph
-- 
This message posted from opensolaris.org
___
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org