What are the challenges you face when working across database platforms? Take the survey

Controlling Performance Profiling via an API

I am reposting this question because the previous response was only relevant to the Memory Profiler, but I am using the Performance Profiler:

To help me focus on important code, I would like to turn profiling on and off with an API (from C#).  Is this available?  Google finds documentation for ANTS v3 (http://help.red-gate.com/help/antsprofiler3/0/en/topics/AP_UsingTheAPI.html).  I guess the other alternative is to put some Sleeps in my code, before and after the important area, so I can use the time selector.


  • Options
    Jessica RJessica R Posts: 1,319 Rose Gold 4

    Hi @OliverB,

    Thanks for your post!

    I'm sorry to say that there's no way to pause the profiler at the moment. I believe there were some technical reasons why the option was removed but I've +1'd a feature request that we have to bring it back (PP-3496).

    However, it sounds like you might find the custom event markers helpful, described here: https://documentation.red-gate.com/app10/working-with-profiling-results/the-timeline#Thetimeline-Addingcustomeventmarkers. You can use them to mark events in your code, so you can find the time region you want to focus on:

    1. Copy %ProgramFles%/Red Gate/ANTS Performance Profiler 8/RedGate.Profiler.UserEvents.dll to your application's bin folder. (Create the bin folder using Windows Explorer if it does not already exist.)
    2. Reference the DLL from your application.
    3. Add the following line to your application wherever you want to see an event marker on the profiler's timeline. (Replace 'The message' with a short description of the event.)

      RedGate.Profiler.UserEvents.ProfilerEvent.SignalEvent("The message");
    When you profile your application, the event is shown in the ANTS Performance Profiler timeline with a black event marker. To see more detail about the event, click on the event marker:

    Hope that helps!

    Jessica Ramos | Product Support Engineer | Redgate Software

    Have you visited our Help Center?

  • Options
    OliverBOliverB Posts: 4 New member
    Thank you, that should work for me.
Sign In or Register to comment.