www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: DMD profiler very slow

reply Clemens Hofreither <clemens.hofreither gmx.net> writes:
Koroskin Denis Wrote:

[....snip....]

 Hm, something like that might be doable, though it's certainly annoying.  
 Can I compile some modules with "-profile" and some without, and the  
 linker will "do the right thing"?

 -Clemens

Yes, you can. Some module will get instrumented, while others wont. You can have a look into profiler implementation in phobos/internal/trace.d You can write your own implementation, too!

Hm, that's very interesting, I had no idea that part was open source. I'm a bit unclear on how it all fits together though, especially since I use Tango. I'm guessing the compiler inserts calls to certain functions in trace.d if it is invoked with the "-profile" switch? If so, where does that object code reside in my dmd installation? My dmd/import/std directory contains only very little stuff, and this doesn't seem to be there. So I'm guessing it must be in dmd/lib, but there is no phobos.lib there. Is that part compiled into one of the Tango libraries when I use Tango? If so, shouldn't that code be in the Tango repository somewhere too? Couldn't find it there, either. Sorry for that slew of questions... -Clemens
Jul 12 2008
parent "Koroskin Denis" <2korden gmail.com> writes:
On Sat, 12 Jul 2008 20:25:41 +0400, Clemens Hofreither  
<clemens.hofreither gmx.net> wrote:

 Koroskin Denis Wrote:

 [....snip....]

 Hm, something like that might be doable, though it's certainly  

 Can I compile some modules with "-profile" and some without, and the
 linker will "do the right thing"?

 -Clemens

Yes, you can. Some module will get instrumented, while others wont. You can have a look into profiler implementation in phobos/internal/trace.d You can write your own implementation, too!

Hm, that's very interesting, I had no idea that part was open source. I'm a bit unclear on how it all fits together though, especially since I use Tango. I'm guessing the compiler inserts calls to certain functions in trace.d if it is invoked with the "-profile" switch? If so, where does that object code reside in my dmd installation? My dmd/import/std directory contains only very little stuff, and this doesn't seem to be there. So I'm guessing it must be in dmd/lib, but there is no phobos.lib there. Is that part compiled into one of the Tango libraries when I use Tango? If so, shouldn't that code be in the Tango repository somewhere too? Couldn't find it there, either. Sorry for that slew of questions... -Clemens

That's ok. The implementation is compiled into snn.lib
Jul 12 2008