Using the Profiler API
The ANTS Profiler API allows fine-grained control of the profiler during a profiling session, enabling the profiler to be temporarily disabled, enabled, reset and snapshots taken.
The API is provided by RedGate.Profiler.Api.dll, found in the ANTS Profiler installation directory. You should add this to the references for your project, at which point the RedGate.Profiler.Api class will be available. This exposes four methods:
• public static void Enable()
This enables the performance profiler, if it was previously disabled. It has no effect when profiling memory usage.
• public static void Disable()
This disables the performance profiler, if it was previously enabled. It has no effect when profiling memory usage.
• public static void Reset ()
This discards any results collected by the profiler during this run of the application, resetting all hit counts and timings to zero.
• public static void TakeSnapshot ()
This causes a results snapshot to be taken and sent to the ANTS user interface.
These methods behave similarly to the controls found on the main ANTS toolbar.
Using the API does not automatically start ANTS – you must run your application from the ANTS user interface as normal in order to profile it. Failure to do this will results in a ProfilerNotRunningException being thrown.
The ANTS Profiler API allows fine-grained control of the profiler during a profiling session, enabling the profiler to be temporarily disabled, enabled, reset and snapshots taken.
The API is provided by RedGate.Profiler.Api.dll, found in the ANTS Profiler installation directory. You should add this to the references for your project, at which point the RedGate.Profiler.Api class will be available. This exposes four methods:
• public static void Enable()
This enables the performance profiler, if it was previously disabled. It has no effect when profiling memory usage.
• public static void Disable()
This disables the performance profiler, if it was previously enabled. It has no effect when profiling memory usage.
• public static void Reset ()
This discards any results collected by the profiler during this run of the application, resetting all hit counts and timings to zero.
• public static void TakeSnapshot ()
This causes a results snapshot to be taken and sent to the ANTS user interface.
These methods behave similarly to the controls found on the main ANTS toolbar.
Using the API does not automatically start ANTS – you must run your application from the ANTS user interface as normal in order to profile it. Failure to do this will results in a ProfilerNotRunningException being thrown.