ANTS Performance Profiler 10

Showing the amount of time taken for a method in one particular thread

ANTS Performance Profiler's results screen has a dropdown list labeled "Thread". This allows you to choose results relative to a particular thread.

For instance, in the example code below, the same method is called from two different threads: one is called "FirstThread" and the other is called "SecondThread". Viewing the profiling results with "all threads" selected will show a hit count of "2" and a total time of "6 seconds", assuming ANTS Performance Profiler is set up to display wall-clock time.

Selecting "FirstThread" or "SecondThread" from the dropdown will show a hit count of "1" for the same method, and a total runtime of "3 seconds". The source code view will reflect the same behavior. The following is the code of the example C# application created to demonstrate this result:

using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;

namespace TestThreadTimes
    class Program
        static void Main(string[] args)
            Thread t1=new Thread(new ThreadStart(WaitThreeSeconds));
            t1.Name = "FirstThread";
            Thread t2 = new Thread(new ThreadStart(WaitThreeSeconds));
            t2.Name = "SecondThread";
        static void WaitThreeSeconds()

Didn't find what you were looking for?