Test Your .NET Profiler/Tracer Application

With our ThreadSuspendTester application (see C# source code and downlaod) you can get an idea of the abilities of your .NET testing tool.

Performance analysis with extremely multi threading - ThreadSuspendTest

ThreadSuspendTester is a small test program which records the overhead of .NET profilers or .NET tracers, especially at high concurrency.
The test program starts 100 threads, which in turn make allocations and garbage collections.

If you use SpeedTrace Pro as tracing/profiling tool, you will not detect much difference by the presence of the profiler. In contrast to other tools on the market, the overhead is very small.

Get an idea of your Profiler/Tracer. Compare the result with SpeedTrace Pro – You will be amazed.

Download ThreadSuspendTester.zip (Program.cs) Download ThreadSuspendTester.zip (Program.cs)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Collections;
using System.Diagnostics;
 
namespace ConsoleApplication1
{
    class Program
    {
        static bool terminated = false;
 
        static void Main(string[] args)
        {
            for (int i = 0; i < 15; i++)
            {
                Console.Write(string.Format("Test {0}...", i+1));
                ExecuteTest();
            }
 
            Console.WriteLine("DONE - Press ENTER to exit");
            Console.ReadLine();
        }
 
        private static void ExecuteTest()
        {
            var sw = new Stopwatch();
            sw.Start();
 
            System.Threading.Thread.CurrentThread.Priority = ThreadPriority.Normal;
            GC.Collect();
 
            for (int i = 0; i < 50; i++)
            {
                var threads = StartThreads();
 
                foreach (Thread t in threads)
                {
                    t.Abort();
                    GC.Collect();
                }
                terminated = true;
 
                foreach (Thread t in threads)
                {
                    t.Join();
                }
            }
 
            Console.WriteLine("Done..{0} ms", sw.ElapsedMilliseconds);
        }
 
        private static List<Thread> StartThreads()
        {
            var result = new List<Thread>();
            for (int i = 0; i < 1; i++)
            {
                var thread = new Thread(doNothingTest);
                thread.Priority = ThreadPriority.Lowest;
                thread.Start();
                result.Add(thread);
            }
 
            var thread2 = new Thread(allocTest);
            thread2.Priority = ThreadPriority.Lowest;
            thread2.Start();
            result.Add(thread2);
 
            for (int i = 0; i < 100; i++)
            {
                var thread = new Thread(allocTest);
                thread.Priority = ThreadPriority.Lowest;
                thread.Start();
                result.Add(thread);
            }
            return result;
        }
 
        static void allocTest()
        {
            int j=0;
            while (!terminated)
            {
                ArrayList list = new ArrayList();
                for (int i = 0; i < 1000; i++)
                {
                    list.Add(new Program());
                }
                list.Clear();
                if (j % 1 == 0)
                {
                    GC.Collect();
                }
 
                System.Threading.Thread.Sleep(1);
            }
        }
 
        static void doNothingTest()
        {
            while (!terminated)
            {
            }
        }   
    }
}

More about SpeedTrace >>
Download Now (free evaluation) >>

3 Responses to “Test Your .NET Profiler/Tracer Application”

  1. Suspend Tester with SpeedTrace Pro fast and easy « dot.NET Profiler Says

    [...] « Test Your .NET Profiler/Tracer Application [...]

  2. .NET Multi-threading test scenario /profiler comparison results « dot.NET Profiler Says

    [...] Would you like to reproduce the test? Simple use our ThreadSuspendTester application. [...]

  3. SpeedTrace Pro stands for supreme stability and reliability. « dot.NET Profiler Says

    [...] few weeks ago we invited you to test your .NET Profiler & Tracer application. With the test application [...]

Kommentar verfassen