diff --git a/test/OpenTelemetry.Tests/Metrics/MetricAPITest.cs b/test/OpenTelemetry.Tests/Metrics/MetricAPITest.cs index 668a6aa1328..f2e06df3a31 100644 --- a/test/OpenTelemetry.Tests/Metrics/MetricAPITest.cs +++ b/test/OpenTelemetry.Tests/Metrics/MetricAPITest.cs @@ -284,8 +284,7 @@ void ProcessExport(Batch batch) // Block until all threads started. mreToEnsureAllThreadsStarted.WaitOne(); - Stopwatch sw = new Stopwatch(); - sw.Start(); + Stopwatch sw = Stopwatch.StartNew(); // unblock all the threads. // (i.e let them start counter.Add) @@ -354,8 +353,7 @@ void ProcessExport(Batch batch) // Block until all threads started. mreToEnsureAllThreadsStarted.WaitOne(); - Stopwatch sw = new Stopwatch(); - sw.Start(); + Stopwatch sw = Stopwatch.StartNew(); // unblock all the threads. // (i.e let them start counter.Add) diff --git a/test/StressTestMetrics/Program.cs b/test/StressTestMetrics/Program.cs index bd2e102f957..872fb4af49e 100644 --- a/test/StressTestMetrics/Program.cs +++ b/test/StressTestMetrics/Program.cs @@ -38,8 +38,7 @@ public static void Main(string[] args) using var meterProvider = Sdk.CreateMeterProviderBuilder() .AddSource("TestMeter") .Build(); - Stopwatch sw = new Stopwatch(); - sw.Start(); + Stopwatch sw = Stopwatch.StartNew(); Parallel.Invoke( () =>