Tracing/Profiling D Applications

Ali Çehreli acehreli at yahoo.com
Thu May 26 20:19:06 UTC 2022


On 5/26/22 12:54, Christian Köstlin wrote:

 > I want to be able to dump
 > tracings even while the program is still running. Then I would have to
 > collect the tls data of all still running threads.

I am not sure without testing but I am under the impression that mutexes 
can be very slow especially if the data collection is happening very 
frequently. The threads may not have breathing room to perform their 
tasks. Since dumping would be much slower compared to the performance 
penalty of grabbing a mutex that it can be measured as zero-cost in the 
dumping time. :) So, you may still want to collect per-thread and 
combine incrementally as you dump? Perhaps a premature optimization... 
Please test. :)

If you want to combine before dumping, then collector registration may 
be needed so that the dumper can contact each collector and say "please 
add your data".

 > __gshared does not put
 > the shared type attribute the the profiler.

Correct.

 > If I use shared I would also
 > have to make all methods I call on the shared profiler shared and also
 > would have to have a shared appender (or cast shared away)?

Possibly. :/

Ali



More information about the Digitalmars-d-learn mailing list