Imported Upstream version 5.12.0.220

Former-commit-id: c477e03582759447177c6d4bf412cd2355aad476
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-04-24 09:31:23 +00:00
parent 8bd104cef2
commit 8fc30896db
1200 changed files with 29534 additions and 26161 deletions

View File

@ -255,5 +255,31 @@ namespace MonoTests.System.Threading
Assert.AreEqual (0, var_3, "var_3");
}
#if !MOBILE
// This is test related to bug https://bugzilla.xamarin.com/show_bug.cgi?id=41294.
// The bug is that the performance counters return 0.
// "Work Items Added" and "# of Threads" are fixed, the others are not.
[Test]
public void PerformanceCounter_WorkItems ()
{
var workItems = new PerformanceCounter ("Mono Threadpool", "Work Items Added");
var threads = new PerformanceCounter ("Mono Threadpool", "# of Threads");
var workItems0 = workItems.NextValue();
int N = 99;
for (var i = 0; i < N; i++)
ThreadPool.QueueUserWorkItem (_ => {});
var workItems1 = workItems.NextValue();
var threads0 = threads.NextValue();
//Console.WriteLine ("workItems0:{0} workItems1:{1}", workItems0, workItems1);
//Console.WriteLine ("threads:{0}", threads0);
Assert.AreEqual (N, workItems1 - workItems0, "#1");
Assert.IsTrue (threads0 > 0, "#2");
}
#endif
}
}
}