Libin Varghese
2006-Feb-11 22:09 UTC
[dtrace-discuss] Probe for load and store of global data
Hi, Is there a probe, for letting me know when a global data is accessed, or when data is access from the heap (that is where globals are stored, i guess). I just want to keep track of which thread is accessing the global/shared data. Libin Varghese. P.S: Why am I doing this? I am doing a small study on data races. By access, I mean is probes for load and store. This message posted from opensolaris.org
Libin Varghese
2006-Feb-11 22:47 UTC
[dtrace-discuss] Probe for load and store of global data
Hi, I was studying another instrumentation tool called ATOM originally (DEC Alpha), I am using INTEL ATOM. It has this probe called "IsInstMemAccess" IsInstMemAccess Routine : Use the IsInstMemAccess routine to identify if the type of memory access the instruction does. The following are valid values for IMemAccessType: InstImpMemRead, /* True if instruction reads memory implicitly */ InstImpMemWrite, /* True if instruction writes memory implicitly */ InstMemRead, /* True if instruction reads memory explicitly */ InstMemWrite, /* True if instruction writes memory explicitly */ Is there something similar to this, in DTrace. -- Libin Varghese. Libin Varghese wrote:> Hi, > Is there a probe, for letting me know when a global data is accessed, or when data is access from the heap (that is where globals are stored, i guess). I just want to keep track of which thread is accessing the global/shared data. > > Libin Varghese. > > P.S: Why am I doing this? I am doing a small study on data races. > By access, I mean is probes for load and store. > This message posted from opensolaris.org > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org
Nicolas Williams
2006-Feb-12 00:18 UTC
[dtrace-discuss] Probe for load and store of global data
On Sat, Feb 11, 2006 at 02:09:55PM -0800, Libin Varghese wrote:> Hi, > Is there a probe, for letting me know when a global data is accessed, or when data is access from the heap (that is where globals are stored, i guess). I just want to keep track of which thread is accessing the global/shared data.You can put probes all instructions of interest to you, with a little effort (and at some price, if you really mean *all* load/store instructions in some program). Check out these blog entries: http://blogs.sun.com/roller/page/ejo?entry=dtrace_instruction_tracing http://blogs.sun.com/roller/page/ejo?entry=dtrace_instruction_tracing_continues http://blogs.sun.com/roller/page/ejo?entry=perl_dtrace_instruction_tracing> Libin Varghese. > > P.S: Why am I doing this? I am doing a small study on data races.Of course, DTrace, as light-weight as its instrumentation is, can affect the timing of events enough to throw off your study. Nico --
Libin Varghese
2006-Feb-12 18:12 UTC
[dtrace-discuss] Probe for load and store of global data
Nicolas Williams wrote:> On Sat, Feb 11, 2006 at 02:09:55PM -0800, Libin Varghese wrote: > >> Hi, >> Is there a probe, for letting me know when a global data is accessed, or when data is access from the heap (that is where globals are stored, i guess). I just want to keep track of which thread is accessing the global/shared data. >> > > You can put probes all instructions of interest to you, with a little > effort (and at some price, if you really mean *all* load/store > instructions in some program). > > Check out these blog entries: > > http://blogs.sun.com/roller/page/ejo?entry=dtrace_instruction_tracing > http://blogs.sun.com/roller/page/ejo?entry=dtrace_instruction_tracing_continues > http://blogs.sun.com/roller/page/ejo?entry=perl_dtrace_instruction_tracing > >I read the blogs, they had a lot of technical stuff, which I didnt understand (cause I am a newbie to DTrace). Ok, let me tell u what I understand of a probe, it is an entry point, for the analysis routine defined in the start, like syscall:::read (correct me if i am wrong). I am searching for a probe which could be called as pid:::load or pid:::store . Is there something like this?? And can the following be used, to serve my purpose ?? phread -> Probe that fires whenever a raw I/O read is about to be performed. lread -> Probe that fires whenever a buffer is logically read from a device. -- Libin Varghese -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.opensolaris.org/pipermail/dtrace-discuss/attachments/20060212/e1a382ec/attachment.html>
> I read the blogs, they had a lot of technical stuff, which I didnt understand > (cause I am a newbie to DTrace). Ok, let me tell u what I understand of a > probe, it is an entry point, for the analysis routine defined in the start, > like syscall:::read (correct me if i am wrong). I am searching for a probe > which could be called as pid:::load or pid:::store . Is there something like > this??Hi Libin, Are you trying to instrument specific loads and stores, or every load and store on the system? If you are looking to instrument specific loads and stores, you could do the following: 1. Run `dis -F function` to get the offset of the ld / st instruction you are interested in instrumenting: $ dis -F ap_discard_request_body /usr/apache2/bin/httpd |more ap_discard_request_body() ap_discard_request_body: 9d e3 bf 88 save %sp, -0x78, %sp ap_discard_request_body+0x4: c2 06 20 14 ld [%i0 + 0x14], %g1 ap_discard_request_body+0x8: 80 a0 60 00 cmp %g1, 0x0 ap_discard_request_body+0xc: 32 80 00 5a bne,a ...... 2. Once you locate the offset (ap_discard_request_body + 0x04 in this example) you are interested in, you can specify that as the probe NAME: $ dtrace -p `pgrep httpd` -n ''pid$target::ap_discard_request_body:4 { ustack(); exit(0); }'' dtrace: description ''pid$target::ap_discard_request_body:4 '' matched 1 probe CPU ID FUNCTION:NAME 0 37164 ap_discard_request_body:4 httpd`ap_discard_request_body+0x4 httpd`default_handler+0x68 httpd`ap_run_handler+0x3c httpd`ap_invoke_handler+0xb8 httpd`ap_internal_redirect+0x40 mod_negotiation.so`handle_map_file+0xf8 httpd`ap_run_handler+0x3c httpd`ap_invoke_handler+0xb8 httpd`ap_process_request+0x14c httpd`ap_process_http_connection+0xfc httpd`ap_run_process_connection+0x3c httpd`child_main+0x46c httpd`make_child+0xc0 httpd`startup_children+0x68 httpd`ap_mpm_run+0x76c httpd`main+0x63c httpd`_start+0x5c Hope this is helpful. Thanks, - Ryan -- UNIX Administrator http://daemons.net/~matty
Nicolas Williams
2006-Feb-12 20:49 UTC
[dtrace-discuss] Probe for load and store of global data
On Sun, Feb 12, 2006 at 11:42:12PM +0530, Libin Varghese wrote:> Nicolas Williams wrote: > >Check out these blog entries: > > > > > I read the blogs, they had a lot of technical stuff, which I didnt > understand (cause I am a newbie to DTrace). Ok, let me tell u what I > understand of a probe, it is an entry point, for the analysis routine > defined in the start, like syscall:::read (correct me if i am wrong). I > am searching for a probe which could be called as pid:::load or > pid:::store . Is there something like this??The last component in the name of a probe has to be, in the case of the pid provider, ''entry'', ''return'', and offsets from the start of a function; the first two trace function entry/return, and the third traces individual instructions at the given offset from the start of a function. There are no probes named "store" or "load." To trace load/store instructions you''ll have to find their addresses (relative to functions) with a dissassembler and then write a D script that probes all the instructions of interest to you. The blog entries I linked to were about doing something very much like that, but using a Perl5 script to do most of the hard work. I''m sure you can adapt that script according to your needs: change it to search for instructions that interest you. The above applies to user-land only; if I remember correctly the fbt provider does not provide for probes at instructions other than function entry/return.> And can the following be used, to serve my purpose ?? > phread -> Probe that fires whenever a raw I/O read is about to be performed. > lread -> Probe that fires whenever a buffer is logically read from a device.You can trace such details, but there are no probe names like that. Instead you have to figure out which parts of the system you want to look at and go from there. Check out: - http://users.tpg.com.au/adsln4yb/dtrace.html - http://docs.sun.com/app/docs/doc/817-6223