Can Dtrace providers be enabled and data collected from within a C++ program? -- This message posted from opensolaris.org
Hey Mike, Are you asking if you can programmatically control DTrace? There''s a C API (that you can certainly invoke from C++), but it''s private and not stable. intrstat and plockstat are good example whose source code you can find here: http://www.illumos.org/projects/illumos-gate/repository/show/usr/src/cmd To interact with DTrace in a stable way, I''d suggest you spawn a dtrace(1M) child process, format the output in a way that''s conducive to the parsing you need to do. Adam On Wed, Nov 17, 2010 at 11:52 AM, Mike DeMarco <mikejd42 at yahoo.com> wrote:> Can Dtrace providers be enabled and data collected from within a C++ program? > -- > This message posted from opensolaris.org > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org >-- Adam Leventhal, Delphix ? ? ? ? ? ? ? ? ? ? ? ?http://dtrace.org/blogs/ahl
I was hoping to do something as simple as link in the dtrace library, include the headers and then use a c call to invoke a provider filling data structures. I will take a look at the lockstat code you mentioned maybe gleam an idea or two from it.. Thanks -- This message posted from opensolaris.org
Kudos to whoever wrote the header files. Very well documented. I will research but looks like dtrace_probe() will do what I want.. I remember seeing a blurb somewhere saying not to trust the library as it could and will change with growth. Is this true? -- This message posted from opensolaris.org
Mike DeMarco wrote:> Kudos to whoever wrote the header files. Very well documented. > > I will research but looks like dtrace_probe() will do what I want.. > > > I remember seeing a blurb somewhere saying not to trust the library as it could and will change with growth. Is this true?The usual rule is that if there is no man page describing the interface you''re using, then it''s technically classified as "private." That doesn''t mean that it''s any sort of "secret" or that you can''t use it, but rather that it can change arbitrarily over time without notice. Unless you get special agreement from the person or team that''s maintaining the interface, you can''t depend on it remaining compatible. -- James Carlson 42.703N 71.076W <carlsonj at workingcode.com>
Hi Mike: James is right, this is private interface. You are on your own as far as stability is concerned. But if you are still interested I have provided some step by step example of using the C API in my dtrace hands on lab. See http://dtracehol.com/#Exercise_15 -Angelo On Nov 18, 2010, at 8:35 AM, James Carlson wrote:> Mike DeMarco wrote: >> Kudos to whoever wrote the header files. Very well documented. >> >> I will research but looks like dtrace_probe() will do what I want.. >> >> >> I remember seeing a blurb somewhere saying not to trust the library as it could and will change with growth. Is this true? > > The usual rule is that if there is no man page describing the interface > you''re using, then it''s technically classified as "private." That > doesn''t mean that it''s any sort of "secret" or that you can''t use it, > but rather that it can change arbitrarily over time without notice. > Unless you get special agreement from the person or team that''s > maintaining the interface, you can''t depend on it remaining compatible. > > -- > James Carlson 42.703N 71.076W <carlsonj at workingcode.com> > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org
> Hi Mike: > > James is right, this is private interface. You are on > your own as far as stability is concerned. > But if you are still interested I have provided some > step by step example of using the C API in > my dtrace hands on lab. See > http://dtracehol.com/#Exercise_15 > > -AngeloExcellent!!! Thanks I will take a gander..... -- This message posted from opensolaris.org