Re: Support for Whidbey.
Matthew Mastracci <[email protected]> Tue, 02 Nov 2004 20:33:13 -0700
| Newsgroups | gmane.comp.windows.dotnet.nprof.devel |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format. --------------010808030909080601010702 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Starting/stopping the profiler (profiler snapshots) is the feature that I most want to have finished before calling nprof "1.0". It's not necessarily a rewrite, but it requires some pretty key integration with the C++ DLL (NProf.Hook). I'll describe it here and you can see how you feel about working on it. Basically, we need to run the profiler in "stack observation mode", pushing and popping methods off the execution stack - even if the profiler hasn't started capturing yet. [1] The reason we do this is so that we know which methods are on the stack as we start the profiling run. We can then set the entry time of each of those methods to be the exact moment that the profiler snapshot was started and use that for the calculations of method times. [2] The same applies for the end of a snapshot - we use the current time as a pseudo end-time to determine time spent in each method. The tough bit is suspending the .NET runtime while we take our snapshot and getting it going again. This requires us to either hold a common lock or find some way to indicate to the runtime that it cannot proceed. Since multiple Win32 threads are running at any time, we need this suspended state to get a clear and consistent picture of everything that is going on. Timings are currently saved to stl lists and structures within the C++ profiling DLL. [3] I don't forsee any of this changing - the snapshots will just need to clear all profiling counts and reset start times. This will all be coordinated in the C++ DLL by messages sent back over the control socket. [4] Note that the profiler socket doesn't really listen right now - it will have to sit and wait for messages from the profiler GUI on another thread. [1] http://cvs.sourceforge.net/viewcvs.py/nprof/nprof/NProf.Hook/NProfCORHook.h?rev=1.1.1.1&view=auto http://cvs.sourceforge.net/viewcvs.py/nprof/nprof/NProf.Hook/profiler.cpp?rev=1.3&view=auto [2] *void* *StackInfo::PushFunction*( FunctionInfo* pFunctionInfo, INT64 llCycleCount ) http://cvs.sourceforge.net/viewcvs.py/nprof/nprof/NProf.Hook/stackinfo.cpp?rev=1.2&view=auto [3] StackInfo, FunctionInfo, ThreadInfo, etc... http://cvs.sourceforge.net/viewcvs.py/nprof/nprof/NProf.Hook/threadinfo.h?rev=1.2&view=auto http://cvs.sourceforge.net/viewcvs.py/nprof/nprof/NProf.Hook/stackinfo.h?rev=1.2&view=auto http://cvs.sourceforge.net/viewcvs.py/nprof/nprof/NProf.Hook/functioninfo.h?rev=1.2&view=auto [4] *void* *ProfilerSocket::SendInitialize*() http://cvs.sourceforge.net/viewcvs.py/nprof/nprof/NProf.Hook/profiler_socket.cpp?rev=1.5&view=auto Matt. Eric Hewitt wrote: >Matt - > >Indeed, it did work fine (on one of two machines I tried--I haven't tracked >down the problem with the other). > >So far it is working very well for us. I do have one question, however: Is >it possible to start and stop the profiler, allowing profiling of a specific >section of code. Our app takes a few seconds to boot, and I don't want the >boot code profiled. > >If not, maybe you could point me to where in the source I might be able to >add such support. If it is not too much work I'd be willing to add the >feature. > >Eric > > >-----Original Message----- >From: Matthew Mastracci [mailto:[email protected]] >Sent: Tuesday, October 19, 2004 3:14 PM >To: Eric Hewitt >Cc: nprof-developers-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org >Subject: Re: [Nprof-developers] Support for Whidbey. > >Eric Hewitt wrote: > > > >>Stumbled upon your .NET profiler, and am very impressed by the data on >>the web page. Excellent work! >> >>My question is if you have attempted support for .NET 2.0 (codenamed >>Whidbey), which is available via Beta from Microsoft. I'm sure I'm >>ahead of the curve, but figured it was worth asking. >> >>Thanks, >> >>Eric Hewitt >> >> >> >I haven't tried anything in .NET 2.0. If the profiling API is the same, it >should just work. I think someone was trying it out with .NET 2.0 installed >earlier - I had to fix a bug related to some changes in the API. > >Feel free to try it out - it might just work. :) > >Matt. > > > --------------010808030909080601010702 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type"> <title></title> </head> <body bgcolor="#ffffff" text="#000000"> Starting/stopping the profiler (profiler snapshots) is the feature that I most want to have finished before calling nprof "1.0". It's not necessarily a rewrite, but it requires some pretty key integration with the C++ DLL (NProf.Hook). I'll describe it here and you can see how you feel about working on it.<br> <br> Basically, we need to run the profiler in "stack observation mode", pushing and popping methods off the execution stack - even if the profiler hasn't started capturing yet. [1] The reason we do this is so that we know which methods are on the stack as we start the profiling run. We can then set the entry time of each of those methods to be the exact moment that the profiler snapshot was started and use that for the calculations of method times. [2] The same applies for the end of a snapshot - we use the current time as a pseudo end-time to determine time spent in each method.<br> <br> The tough bit is suspending the .NET runtime while we take our snapshot and getting it going again. This requires us to either hold a common lock or find some way to indicate to the runtime that it cannot proceed. Since multiple Win32 threads are running at any time, we need this suspended state to get a clear and consistent picture of everything that is going on.<br> <br> Timings are currently saved to stl lists and structures within the C++ profiling DLL. [3] I don't forsee any of this changing - the snapshots will just need to clear all profiling counts and reset start times. This will all be coordinated in the C++ DLL by messages sent back over the control socket. [4] Note that the profiler socket doesn't really listen right now - it will have to sit and wait for messages from the profiler GUI on another thread.<br> <br> [1] <a class="moz-txt-link-freetext" href="http://cvs.sourceforge.net/viewcvs.py/nprof/nprof/NProf.Hook/NProfCORHook.h?rev=1.1.1.1&view=auto">http://cvs.sourceforge.net/viewcvs.py/nprof/nprof/NProf.Hook/NProfCORHook.h?rev=1.1.1.1&view=auto</a><br> <a class="moz-txt-link-freetext" href="http://cvs.sourceforge.net/viewcvs.py/nprof/nprof/NProf.Hook/profiler.cpp?rev=1.3&view=auto">http://cvs.sourceforge.net/viewcvs.py/nprof/nprof/NProf.Hook/profiler.cpp?rev=1.3&view=auto</a><br> <br> [2]<br> <pre><font color="#228b22"><b>void</b></font> <b><font color="#0000ff">StackInfo::PushFunction</font></b>( FunctionInfo* pFunctionInfo, INT64 llCycleCount )</pre> <a class="moz-txt-link-freetext" href="http://cvs.sourceforge.net/viewcvs.py/nprof/nprof/NProf.Hook/stackinfo.cpp?rev=1.2&view=auto">http://cvs.sourceforge.net/viewcvs.py/nprof/nprof/NProf.Hook/stackinfo.cpp?rev=1.2&view=auto</a><br> <br> [3]<br> StackInfo, FunctionInfo, ThreadInfo, etc...<br> <a class="moz-txt-link-freetext" href="http://cvs.sourceforge.net/viewcvs.py/nprof/nprof/NProf.Hook/threadinfo.h?rev=1.2&view=auto">http://cvs.sourceforge.net/viewcvs.py/nprof/nprof/NProf.Hook/threadinfo.h?rev=1.2&view=auto</a><br> <a class="moz-txt-link-freetext" href="http://cvs.sourceforge.net/viewcvs.py/nprof/nprof/NProf.Hook/stackinfo.h?rev=1.2&view=auto">http://cvs.sourceforge.net/viewcvs.py/nprof/nprof/NProf.Hook/stackinfo.h?rev=1.2&view=auto</a><br> <a class="moz-txt-link-freetext" href="http://cvs.sourceforge.net/viewcvs.py/nprof/nprof/NProf.Hook/functioninfo.h?rev=1.2&view=auto">http://cvs.sourceforge.net/viewcvs.py/nprof/nprof/NProf.Hook/functioninfo.h?rev=1.2&view=auto</a><br> <br> [4]<br> <pre><font color="#228b22"><b>void</b></font> <b><font color="#0000ff">ProfilerSocket::SendInitialize</font></b>()</pre> <a class="moz-txt-link-freetext" href="http://cvs.sourceforge.net/viewcvs.py/nprof/nprof/NProf.Hook/profiler_socket.cpp?rev=1.5&view=auto">http://cvs.sourceforge.net/viewcvs.py/nprof/nprof/NProf.Hook/profiler_socket.cpp?rev=1.5&view=auto</a><br> <br> Matt.<br> <br> Eric Hewitt wrote: <blockquote cite="mid200411030119.iA31Jq025675-SyIhpr/[email protected]" type="cite"> <pre wrap="">Matt - Indeed, it did work fine (on one of two machines I tried--I haven't tracked down the problem with the other). So far it is working very well for us. I do have one question, however: Is it possible to start and stop the profiler, allowing profiling of a specific section of code. Our app takes a few seconds to boot, and I don't want the boot code profiled. If not, maybe you could point me to where in the source I might be able to add such support. If it is not too much work I'd be willing to add the feature. Eric -----Original Message----- From: Matthew Mastracci [<a class="moz-txt-link-freetext" href="mailto:[email protected]">mailto:[email protected]</a>] Sent: Tuesday, October 19, 2004 3:14 PM To: Eric Hewitt Cc: <a class="moz-txt-link-abbreviated" href="mailto:nprof-developers-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org">nprof-developers-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org</a> Subject: Re: [Nprof-developers] Support for Whidbey. Eric Hewitt wrote: </pre> <blockquote type="cite"> <pre wrap="">Stumbled upon your .NET profiler, and am very impressed by the data on the web page. Excellent work! My question is if you have attempted support for .NET 2.0 (codenamed Whidbey), which is available via Beta from Microsoft. I'm sure I'm ahead of the curve, but figured it was worth asking. Thanks, Eric Hewitt </pre> </blockquote> <pre wrap=""><!---->I haven't tried anything in .NET 2.0. If the profiling API is the same, it should just work. I think someone was trying it out with .NET 2.0 installed earlier - I had to fix a bug related to some changes in the API. Feel free to try it out - it might just work. :) Matt. </pre> </blockquote> <br> </body> </html> --------------010808030909080601010702-- ------------------------------------------------------- This SF.Net email is sponsored by: Sybase ASE Linux Express Edition - download now for FREE LinuxWorld Reader's Choice Award Winner for best database on Linux. http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click