Hello Dtrace community,
Firstly dtrace rocks!  It's fun to play `from a bird's eye`  
perspective generating different observations:  performance,  
debugging, learning, and outright curiosity etc

Here's my problem using a 2 cpu AMD64 opteron desktop:
I'm experimenting with non-determinism using threads that get created  
dynamically depending on runtime contexts. The threading works fine  
and runs properly. Where i'm having debugging bouts is when i'm  
optimizing out threads for procedure calls. If the context has only 1  
thread to call, why launch it as a thread? Threading in my non- 
deterministic context is approximately 5 times slower then procedure  
calls. So this my experiment in optimizing out threads --- out damn  
spot.

Here's a simple scenario where all the code is in C++:
                        process p3
                                        |
        ----------------------------------------
        |                                                   |
        V                                                 V     p3  
dynamically launches threads 1 and 2 at the same time: they are now  
parallelizing and report back to p3
        Th1                                            Th2
                                                            ^ then  
Th2 in it's runtime  context
                                                             |  calls  
a procedure th3 instead of as a thread
                                                             |
                                                             v
                                                         proc_th3  
---  It can play in p3's address space along with the other Th1. Th2  
can't as it has just called proc th3 but after procedure return it can

Please note p3 's  critical region is properly protected and there is  
no reader / writer problem. Each thread runs at its on pace and  
eventually reports back to the snoring p3 using its conditional  
variable. This all works properly in the threading only environment  
and sometimes in mixed environment.

Th1,  th2, and proc th3 call a shared token dispenser as a reader  
only in process address space. This token dispenser is a C++  
template. The debugging bout is in how the thread's register contexts  
and how they get set.
So far i'm at the fbt:genunix:segvn_faultpage:entry using dtracing  
stack and ustack functions. i'll be writing more specific code to  
export the userland stack's contexts.

My 1st week of Dtrace learning is fun and speaks highly of its  
capabilities and well thought out implementation! The `Solaris  
Performance and Tools` has jump started my investigation and highly  
recommend buying it along with  its companion `Solaris Internals`.

Questions: I've been to the wiki site and appreciate the maturing  
documentation but i'm a bit stumped regarding the below areas of  
exploration.
1) how do i set an absolute address probe in a pid provider of C++  
code? i figured out how to set a C++ function probe by using the  
mangled name. i get a compiler error on my attempt at an absolute  
address declaration in my attempts to figure out how to declare it.  
The address is part of the process space and not specific to eg  `main`.
2) can i declare multithreaded probes so that i can observe the  
specific probe firings per declared thread?
2.1) how do i set pid probes against future threads? how do i declare  
each thread's run context in the provider's part for the potential  
probe. these threads are not static but created and launched  
depending on the runtime context.
2.2) how do i get pid functions firing on these future threads?

I started with the dbx but it is not sensitive to the OS context  
switching of these threads. the combo dtrace / mdb is much better  
suited for me when i really get down and dirty after completing my  
above tracings.

I thank u for any suggestions
Dave Bone

_______________________________________________
dtrace-discuss mailing list
[email protected]

Reply via email to