Disable Profiler Feature Removed?

I am trying out the new profiler, and I can't find the feature that was in version 3 that allowed the profiler to be disabled until needed. Even with whatever performance improvements that were added in version 4, it is still quite slow when profiling parts of the application that don't require profiling when trying to get to the part of the code that does need profiling. Is that functionality still there and I am not seeing it? Or is there some way to replicate that functionality (for example triggering profiling off an event)?

Thanks,
Scott.

Comments

  • Hi Scott,

    the ability to disable the profiler no longer exists although ANTS 4 is faster when profiling everything than ANTS 3 was when disabled. I presume you are doing line level profiling which will obviously have the greatest overhead because of the level of detail we are profiing at.

    If you want extremely quick profiling you can switch to the "only profile methods with source" although this is at the method level.

    Due to the way the new profiler core works we need to record all the stack trace information and to also keep the time line as simple as possible for users.

    We have also had reported issues that some anti-virus products significantly slow down the profiler. This is due to the use of shared memory in ANTS 4 which some anti-virus products scan. You may want to try in a safe environment if disabling your anti-virus has any effect on the performance of the profiler.

    Stephen
  • Hi Stephen,

    I just realized I misread your reply when I first read it. I read it as ANTS 4 is faster than ANTS 3 when profiling, but you said ANTS 4 when profiling is faster than ANTS 3 when it is disabled. This is most definately not my experience (see http://www.red-gate.com/MessageBoard/vi ... 7737#27737). For me, ANTS 4 is substantially slower when doing line level timing than ANTS 3 disabled (even with anti-virus disabled), slow enough that I will most likely continue to use ANTS 3 for certain profiling activities because it just takes too long to get to the point where I need to start profiling. I will also say that the ability to disable the profiler was one of the determining features in our decision to purchase ANTS 3 over its competitors.

    Apologies for mis-reading your post and thus my late reply,
    Scott.
  • Bart ReadBart Read Posts: 997 Silver 1
    Hi Scott,


    That's interesting. I generally find that profiling with ANTS Profiler 4 in detailed mode, with line level timings, is roughly twice as fast as running ANTS Profiler 3 against the same application with profiling disabled. I guess it might be down to differences in processor type, or possibly some other factor, such as level of multithreading, that we've not encountered before.

    What's your machine spec? For reference I'm on a Core 2 Duo running at (I think) 2.6 GHz, 32-bit Windows XP, 4 GB RAM (not that you can see all of it). I also have a Vista 64 machine, with roughly the same spec, although I've not yet tried it on that.

    Let me look into this a bit further and get back to you.


    Thanks,


    Bart
    Bart Read
    Principal Consultant
    bartread.com Ltd
  • Bart ReadBart Read Posts: 997 Silver 1
    Hi Scott,


    I have something for you to try here, although it's possible some of your timings may get a little weird.

    Exit ANTS Profiler 4, if it's running, and open the PerformanceProfilerSettings.xml file in your favourite text editor (although if it's TextPad, I'd use Notepad instead, because the former has a nasty habit of rendering XML files unreadable). For me this file lives in "C:\Documents and Settings\bart.read\Local Settings\Application Data\Red Gate\ANTS Performance Profiler 4\PerformanceProfilerSettings.xml". The location is slightly different on Vista, under "C:\Users" I think.

    Now find the UseThreadAffinity option (this isn't exposed through Tools > Options). It looks like this by default:

    <Property Name="UseThreadAffinity">
    <Object Type="System.Boolean">True</Object>
    </Property>

    Now change the value to "False":

    <Property Name="UseThreadAffinity">
    <Object Type="System.Boolean">False</Object>
    </Property>

    Save the file and then start up ANTS Profiler 4 again. Now try profiling, and hopefully you should see some performance improvement.

    What this does is to tell ANTS Profiler to allow your process to take advantage of additional CPU cores. Now, because the timers each CPU core in your system aren't synchronized, and because threads can be arbitrarily swapped between CPU cores, this can cause some slightly odd timing artifacts to appear. This shouldn't cause significant problems where methods take a relatively long time to execute though.

    Let me know if this helps.


    Thanks,


    Bart
    Bart Read
    Principal Consultant
    bartread.com Ltd
  • Hi Bart,

    My machine is a dual core2 2.4 GHz with 2GB RAM running Windows XP 32 bit.

    Thread affinity did not make a noticeable difference.

    I have pulled out a stop watch to get some real numbers for you. In ANTS 3 with line level timings on all methods and the profiler disabled, a particular operation takes roughly 9 seconds. In ANTS 4 with the same settings, that same operation takes roughly 35 seconds.

    As requested in the other thread, I am trying to figure out how to completely disable my virus scanner to see if that makes a difference. I disabled its file system auto-protect, and that made no difference, but there may be something else I need to disable.

    Scott.
  • Bart ReadBart Read Posts: 997 Silver 1
    Hi Scott,


    Thanks for this. It might be the virus scanner, but I think we'll need to do some deeper investigation into this. To give you an idea of what I see here I ran a typical analysis run with Exception Hunter earlier on, which is heavier weight than some of the apps I profile when I'm trying to implement new functionality (waiting several minutes to see if something is working or not can get a bit tedious, so I know how you feel about all the waiting around). I was going to post this earlier on but I had to leave the office rather abruptly.

    Anyway, what I got was this (this is with the thread affinity switched on):

    ANTS Profiler 3, detailed mode, profiler disabled: 3 minutes 50 seconds
    ANTS Profiler 4, detailed mode: 3 minutes 20 seconds

    So this isn't quite as dramatic as the differences I have sometimes seen before, but that could be for a number of reasons, such as the fact that Exception Hunter makes significant use of multiple threads, and not just for background processing; there are a couple of places where it breaks up work into chunks and becomes fully parallel. There is also a fairly significant amount of I/O traffic, with a great deal of information being cached on disk, along with a fair amount of handing of chunks of data between different threads. It can also fire off a number of child processes, although I didn't test that functionality this time around. But still, this is a significant and measurable difference. For reference, the analysis I carried out usually takes around 1 minute 30 seconds or so without the profiler attached (that's from memory, I'll time this more accurately tomorrow).

    At the moment I'm really stumped by what you're seeing, although not much surprises me these days. Discounting the AV software, I wonder if there's anything else that could be having an effect. You don't have anything like YourKit or DevPartner installed do you? I'm pretty sure it was one of these that has caused a problem in the past because it injected some code into every process that slowed everything down to a crawl. On the other hand, it could just be the way the profiler interacts with your application, or you might have found a bug, or who knows.


    Thanks,


    Bart
    Bart Read
    Principal Consultant
    bartread.com Ltd
  • You might be seeing a particularly suboptimal case for the profiler, although this is fairly unlikely. There are a few differences with the way ANTS 4 profilers from ANTS 3:

    We measure method-level performance for all methods by default, whereas ANTS 3 only instruments methods with source. Normally we'll still execute code many times faster than ANTS 3 as the method-level instrumentation is vastly faster in ANTS 4, but if you've got a piece of software where the ratio of method calls between methods with and without source is sufficiently high you might find that something appears to run more slowly. ANTS 4 still has the option to only instrument methods with source, so you might try that.

    During startup when line-level timings are turned on we do increase the amount of work the JIT has to do, which will slow things down the first time code is executed. Normally this isn't hugely significant but some types of code can require large amounts of instrumentation, and we've changed the way this works from ANTS 3. You can discover if this is happening by looking at the all methods tab and seeing where the JIT appears and what percentage time it takes. With line-level timing turned off, the JIT time is not significantly impacted. There would probably have to be something unusual about your code to make a large difference compared to ANTS 3, though.

    Finally, you may be using code where function inlining has a significant effect on the timings. We normally turn function inlining off in order to give the most complete picture of what the process was doing, but you can re-enable it through the options dialog. Methods that are inlined still appear in the call tree but we can't collect hit counts or line-level data for them. The kinds of methods that are candidates for inlining are also the kinds where adding timing instrumentation can have a disproportionately large effect on their execution time.
    Andrew Hunter
    Software Developer
    Red Gate Software Ltd.
  • Hi,

    My Visual Studio is plain vanilla except for ANTS 3 and ANTS 4. I did have DevPartner installed a while back, but I uninstalled it, so it better no be having an impact (I only used its profiler). I have some more numbers now: with only methods with source, that same operation takes about 14 seconds. With only methods with source and inlining enabled, it takes about 12 seconds. With method levels without source, inlining enabled or disabled, it takes about 31 seconds.

    So, to summarize:
    AP3 line level disabled: 9 seconds
    AP4 line level, no inlining: 35 seconds
    AP4 method level without source: 31 seconds
    AP4 method level with source, no inlining: 14 seconds
    AP4 method level with source, with inlining: 12 seconds

    I also took a look at the JIT time. In the case of AP4 method level without source, it added up to about 43% of the time, with over half of that under System.Data.DataTable.NewRowArray(int size).

    I hope that gives you something to work with. The majority of the time is spent in framework code, specifically System.Data classes.

    Thanks,
    Scott.
  • Thanks Scott,


    Another couple of questions:

    1) What happens if you uncheck "Profile child processes" in the "Performance Profiler Settings" dialog and then profile your app?

    2) Could you send us the ProfilerCore.dll that's registered with your system please? Please note: this may not be the ProfilerCore.dll under the ANTS Profiler 4 directory. To find it open up regedit.exe and navigate to "HKEY_CLASSES_ROOT\CLSID\{A07CBDF0-B23B-4A96-A889-18E3C3004EB2}\InprocServer32". The filename is the data for the "(Default)" value under this key. Once you've got this can you send the file to bartDOTreadATredHYPHENgateDOTcom.


    Thanks,


    Bart
    Bart Read
    Principal Consultant
    bartread.com Ltd
  • Hi Bart,

    Unchecking profile child processes with all methods without source made no difference (the software I am profiling is single process, single thread). I will send you the file you requested.

    Scott.
  • OK, thanks Scott. It was a bit of a long shot.
    Bart Read
    Principal Consultant
    bartread.com Ltd
  • Hi Scott,

    As another possible long shot - is your application running on the .NET 1.1 run time?

    Stephen
  • Hi Stephen,

    No, it is 2.0. I am currently corresponding with Bart via e-mail, so you may want to talk to him for the latest information.

    Scott.
Sign In or Register to comment.