Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mono / profiler / test-traces.cs
1 using System;
2 using System.Runtime.CompilerServices;
3
4 class T {
5
6         static object o = null;
7
8         [MethodImpl (MethodImplOptions.NoInlining)]
9         static void level3 (int op) {
10                 level2 (op);
11         }
12
13         [MethodImpl (MethodImplOptions.NoInlining)]
14         static void level2 (int op) {
15                 level1 (op);
16         }
17
18         [MethodImpl (MethodImplOptions.NoInlining)]
19         static void level1 (int op) {
20                 level0 (op);
21         }
22
23         [MethodImpl (MethodImplOptions.NoInlining)]
24         static void level0 (int op) {
25                 switch (op) {
26                 case 0: o = new T (); break;
27                 case 1: throw new Exception (); break;
28                 }
29         }
30
31         static void Main (string[] args) {
32                 int count = 1010;
33                 for (int i = 0; i < count; ++i) {
34                         level3 (0);
35                 }
36                 for (int i = 0; i < count; ++i) {
37                         try {
38                                 level3 (1);
39                         } catch {
40                         }
41                 }
42         }
43 }
44