DTrace is an impressive, powerful tracing system, originally from Solaris, but ported to FreeBSD and Mac OSX.
DTrace uses a high-level D language other than AWK or C. Here is an example:
io:::start
/pid == $1/
{
printf("file %s offset %d size %d block %llu\n", args[2]->fi_pathname,
args[2]->fi_offset, args[0]->b_bcount, args[0]->b_blkno);
}
Using the command line sudo dtrace -q -s <name>.d <pid>, all IOs created from this process are logged.
My question is if and how you can call custom C functions from a DTrace script to perform advanced operations with trace data during the trace itself.
source
share