Calling C function from DTrace scripts
Posted
by dmeister
on Stack Overflow
See other posts from Stack Overflow
or by dmeister
Published on 2010-02-02T12:35:21Z
Indexed on
2010/04/28
5:33 UTC
Read the original article
Hit count: 344
dtrace
DTrace is impressive, powerful tracing system originally from Solaris, but it is ported to FreeBSD and Mac OSX.
DTrace uses a high-level language called D not unlike 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 originated from that process are logged.
My question is if and how it is possible to call custom C functions from a DTrace script to do advanced operations with that tracing data during the tracing itself.
© Stack Overflow or respective owner