I'm trying to write a script that will log the number of stat, stat64,
lstat and lstat64 system calls whose targets (arg0) are in a particular
filesystem, "/gold/tmcache". This will run in a script (either a dtrace
script or in dtrace code embedded in a shell script) that will be run
for some unknown length of time, possibly many hours or even days, so
the idea of logging all paths and then post-processing the log becomes
problematic due to its rapid growth.

Since DTrace doesn't have pattern matching, I thought about trying
something like

syscall::stat:entry,
syscall::lstat:entry,
syscall::stat64:entry,
syscall::lstat64:entry
/something[5] == '/' && something[6] == 't' && something[7] == 'm'/
{
    calls++;
}

/* log once per hour */
tick-1s
/++n == 3600/
{
    printf("%Y %d\n", walltimestamp, calls);
    n = 0;
    calls = 0;
}

but I'm not sure how to get something[i] out of arg0, especially within
a predicate.

Any thoughts? Is this along the right line of thinking or is there some
simpler way that I'm not seeing?

Thanks,
Justin

_______________________________________________
dtrace-discuss mailing list
[email protected]

Reply via email to