Following are the code I am working on. Welcome suggestions to make
improvement or alternative approaches :-)
In this project, I add DTrace probe before and after rfs3call() function
call to collect useful information. Currently the overhead in my
implementation comes from tsd_set() and tsd_get() functions. (By the
way, the overhead from memory allocation has been removed by using local
variables.). The purpose of using tsd_set() and tsd_get() functions is
to collect some data from rfscall() function, which is *called* by
rfs3call(). This introduce overhead to nfs client system when DTrace is
not enabled. A simple experiment show that, in the worst case, the
overhead from these two functions is about 2% of the whole rfs3call()
operation.
Following are my code. Two probes are declared before and after
rfs3call(). To collect an argument value from rfscall(), which is called
by rfs3call(), we instrument two pieces of code:
1. add tsd_set() function call nbefore rfs3cll() to set the address to
store a value from rfscall() functions
{
...
uint32_t xid = 0;
DTRACE_NFSV3CLIENT_5(op__getattr__request, rnode_t, VTOR(vp), cred_t *, cr,
uint32_t *, &xid, GETATTR3args *, &args, caddr_t, uts_nodename());
tsd_set(dtrace_nfsv3client_key,&xid); // instrumented code
error = rfs3call(VTOMI(vp), NFSPROC3_GETATTR,
xdr_nfs_fh3, (caddr_t)&args,
xdr_GETATTR3vres, (caddr_t)&res, cr,
&douprintf, &res.status, 0, &fi);
DTRACE_NFSV3CLIENT_5(op__getattr__reply, rnode_t, VTOR(vp), cred_t *, cr,
uint32_t *, &xid, GETATTR3res*, &res, caddr_t, uts_nodename());
...
}
2. Within rfscll(), (which is called by nfs3call), add tsd_get()
function call.
rfscall()
{
...
status = CLNT_CALL(client, which, xdrargs, argsp,
xdrres, resp, wait);
// instrumented code begin
uint32_t xid;
(void) CLNT_CONTROL(client, CLGET_XID, (char *)&xid);
uint32_t noi_xid;
noi_xid = htonl(xid);
uint32_t *pxid;
pxid = tsd_get(dtrace_nfsv3client_key);
if (pxid != NULL){
*pxid = noi_xid;
}
// instrumented code end;
....
}
Regards,
Danhua
On 11/04/08 07:52, Adam Leventhal wrote:
> Hi Danhua,
>
> As has been mentioned. This functionality doesn't yet exist in the
> kernel. If you post the exact code that you're working on, we can try
> to suggest some alternatives. At some point, we would like an is-
> enabled equivalent in the kernel.
>
> Adam
>
>
> --
> Adam Leventhal, Fishworks http://blogs.sun.com/ahl
>
> _______________________________________________
> dtrace-discuss mailing list
> [email protected]
>
_______________________________________________
dtrace-discuss mailing list
[email protected]