vijay meena
2006-Oct-11 09:57 UTC
[dtrace-discuss] data object sharing between DTRACE script and c program
Is there any method by which a DTRACE script and a user-defined C program can share a data object? I am looking for some method by which a C-program can access some buffer allocated by DTRACE script. Any help on it ? Vijay This message posted from opensolaris.org
Chip Bennett
2006-Oct-11 12:07 UTC
[dtrace-discuss] data object sharing between DTRACE script and c program
I suspect you''re looking for a more elegant way than this, but what about having your C program "popen" the DTrace program and capture the recorded data as it''s being consumed. And I suppose that data could flow the other way, if the D program had PID provider probes for the C program that invoked it. Seems a bit sticky doesn''t it. :-) Chip vijay meena wrote:> Is there any method by which a DTRACE script and a user-defined C program can share a data object? > > I am looking for some method by which a C-program can access some buffer allocated by DTRACE script. > > Any help on it ? > > Vijay > > > This message posted from opensolaris.org > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org >
Wee Yeh Tan
2006-Oct-11 14:21 UTC
[dtrace-discuss] data object sharing between DTRACE script and c program
I''d suggest you take a look at libdtrace but the library is still private so you risk your application failing upon the next patch. However, at least you get great examples like plockstat(1M) and intrstat(1M). On 10/11/06, Chip Bennett <cbennett at laurustech.com> wrote:> I suspect you''re looking for a more elegant way than this, but what > about having your C program "popen" the DTrace program and capture the > recorded data as it''s being consumed. > > And I suppose that data could flow the other way, if the D program had > PID provider probes for the C program that invoked it. > > Seems a bit sticky doesn''t it. :-) > > Chip > > vijay meena wrote: > > Is there any method by which a DTRACE script and a user-defined C program can share a data object? > > > > I am looking for some method by which a C-program can access some buffer allocated by DTRACE script. > > > > Any help on it ? > > > > Vijay > > > > > > This message posted from opensolaris.org > > _______________________________________________ > > dtrace-discuss mailing list > > dtrace-discuss at opensolaris.org > > > > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org >-- Just me, Wire ...
Adam Leventhal
2006-Oct-11 15:15 UTC
[dtrace-discuss] data object sharing between DTRACE script and c program
Hi Vijay, One of the powerful things about DTrace is that it allows you to write scripts that emit whatever output you want. I''d argue that the best way to have a C program interact with DTrace is to invoke the dtrace(1M) command with a script that feeds your program the data it wants in a convenient form (e.g. XML). It''s possible to use libdtrace directly, but it''s not a stable interface and could (easily) break not just between releases of Solaris, but from one nightly build to the next. Adam On Wed, Oct 11, 2006 at 02:57:12AM -0700, vijay meena wrote:> Is there any method by which a DTRACE script and a user-defined C program can share a data object? > > I am looking for some method by which a C-program can access some buffer allocated by DTRACE script. > > Any help on it ? > > Vijay > > > 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
vijay meena
2006-Oct-11 15:51 UTC
[dtrace-discuss] Re: data object sharing between DTRACE script and c program
Hi Adam. Thanks for your suggestion. I like the idea of feeding the data from Dtrace script to C program but since the amount of data is more, I do not want to create any intermediate disk file to pass this data to C program, because my design cant afford disk i/o. If you could suggest me any other means of communication , like - socket communication, shared memory between Dtrace script and C program. That would be very helpful for me. Thanks Vijay This message posted from opensolaris.org
Tom Erickson
2006-Oct-12 00:02 UTC
[dtrace-discuss] Re: data object sharing between DTRACE script and c program
Vijay, If a Java program rather than a C program works with your design, you could use the Java DTrace API in Solaris Express: /usr/share/lib/java/dtrace.jar /usr/share/lib/java/javadoc/dtrace/api/index.html You would then listen for probe data in the dataReceived() method of your ConsumerListener. Tom On Wed, Oct 11, 2006 at 08:51:52AM -0700, vijay meena wrote:> Hi Adam. > > Thanks for your suggestion. I like the idea of feeding the data from Dtrace script to C program but since the amount of data is more, I do not want to create any intermediate disk file to pass this data to C program, because my design cant afford disk i/o. > If you could suggest me any other means of communication , like - socket communication, shared memory between Dtrace script and C program. That would be very helpful for me. > > Thanks > Vijay > > > This message posted from opensolaris.org > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org
Premal Gandhi
2007-Mar-19 20:21 UTC
[dtrace-discuss] Re: Re: data object sharing between DTRACE script and c program
Is there a way that a structure defined in "C" library could be accessed through the d script? I know that we could use -c option and #include the header file, but what I am looking for it accessing the data structure by referencing the library file through may be "-L" option. However it really does not seem to work. Any help will be great. This message posted from opensolaris.org