Finish spliting sgen-nursery-allocator into a separate compilation unit
[mono-project.git] / mono / profiler / test-busy.cs
blob76e1a5b2b54cf198bd8062150fb3acca4ce674eb
1 using System.Threading;
3 class T {
5 static int count = 10;
6 static void test2 () {
7 //Thread.Sleep (500);
8 //return;
9 int v = 0;
10 for (int i = 0; i < count; ++i) {
11 v += test3 ();
15 static int test3 () {
16 int v = 33;
17 for (int i = 0; i < 10000000; ++i) {
18 v += i * 1000;
19 v /= (1 + i) * 2;
21 return v > 0? 0: 1;
23 static int test () {
24 int v = 33;
25 for (int i = 0; i < 10000000; ++i) {
26 v += i * 1000;
27 v /= (1 + i) * 2;
29 return v > 0? 0: 1;
31 static int Main (string[] args) {
32 if (args.Length > 0)
33 count = int.Parse (args [0]);
34 Thread t = new Thread (test2);
35 t.Name = "BusyHelper";
36 t.Start ();
37 int v = 0;
38 for (int i = 0; i < count; ++i) {
39 v += test ();
41 t.Join ();
42 return v > 0? 0: 1;