Hi All, I am new to DTrace and was wondering if it was possible to integrate DTrace into a C application. I would like to monitor File I/O within a C program but need access to the fileinfo_t struct and DTrace functions. Does anyone have some insight into this? Thanks, Matt -- This message posted from opensolaris.org
You integrate DTrace into an application using USDT probes: http://docs.sun.com/app/docs/doc/817-6223/6mlkidlms?a=view But that''s overkill if all you need to do is track file IO activity - that can be done very effectively with DTrace without the need to modify application code. Use the syscall provider to track file IO related system calls (open(2), read(2), write(2), etc). Use the IO provider to get file info and track IO system-wide. Use the pid provider to track file IO from user functions. These are all broad strokes. There are several ways to IO information for a workload. If you can be more specific, we can provide actual DTrace examples to help. Thanks, /jim Matt Bailey wrote:> Hi All, > > I am new to DTrace and was wondering if it was possible to integrate DTrace into a C application. > > I would like to monitor File I/O within a C program but need access to the fileinfo_t struct and DTrace functions. > > Does anyone have some insight into this? > > Thanks, > Matt > > > -- > This message posted from opensolaris.org > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org >
Adam Leventhal
2007-Jul-30 22:54 UTC
[dtrace-discuss] Integrating Dtrace into C Applications
Hi Matt, It sounds like you want to correlate activity in your C application back to I/O events. You can do something as simple as this to get started: # dtrace -n ''io:::start/execname == "myapp"/{ @[ustack()] = count(); }'' Adam On Mon, Jul 30, 2007 at 08:16:10AM -0700, Matt Bailey wrote:> Hi All, > > I am new to DTrace and was wondering if it was possible to integrate DTrace into a C application. > > I would like to monitor File I/O within a C program but need access to the fileinfo_t struct and DTrace functions. > > Does anyone have some insight into this? > > Thanks, > Matt > > > -- > This message posted from opensolaris.org > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org-- Adam Leventhal, Solaris Kernel Development http://blogs.sun.com/ahl