Discussion:
Dtrace providers and C, C++
Mike DeMarco
2010-11-17 19:52:24 UTC
Permalink
Can Dtrace providers be enabled and data collected from within a C++ program?
--
This message posted from opensolaris.org
Adam Leventhal
2010-11-17 22:59:56 UTC
Permalink
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
Post by Mike DeMarco
Can Dtrace providers be enabled and data collected from within a C++ program?
--
This message posted from opensolaris.org
_______________________________________________
dtrace-discuss mailing list
--
Adam Leventhal, Delphix                        http://dtrace.org/blogs/ahl
Mike DeMarco
2010-11-18 13:00:34 UTC
Permalink
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
Mike DeMarco
2010-11-18 13:09:55 UTC
Permalink
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
James Carlson
2010-11-18 13:35:50 UTC
Permalink
Post by Mike DeMarco
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-dlRbGz2WjHhmlEb+***@public.gmane.org>
Angelo Rajadurai
2010-11-18 13:44:12 UTC
Permalink
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
Post by James Carlson
Post by Mike DeMarco
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.
--
_______________________________________________
dtrace-discuss mailing list
Mike DeMarco
2010-11-18 15:14:25 UTC
Permalink
Post by Angelo Rajadurai
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
Excellent!!! Thanks I will take a gander.....
--
This message posted from opensolaris.org
Loading...