AzureAD / microsoft-authentication-library-for-dotnet

Microsoft Authentication Library (MSAL) for .NET
https://aka.ms/msal-net
MIT License
1.36k stars 330 forks source link

MeasureDurationResult incorrect when running in linux #4785

Closed SingleCopy closed 1 month ago

SingleCopy commented 1 month ago

Fixes: #4784

Changes proposed in this request The MeasureDurationResult time calculations do not work when running in linux as the Stopwatch.Frequency is not taken into account. This change correctly calculates the Milliseconds and Microseconds by taking the Stopwatch.Frequency into account.

Testing Difficult without running the tests on different O/S

Performance impact N/A

Documentation N/A

bgavrilMS commented 1 month ago

This is a very good catch @SingleCopy . I found some mention about this here: https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.stopwatch.elapsedticks?view=net-8.0&redirectedfrom=MSDN#System_Diagnostics_Stopwatch_ElapsedTicks

@GeoK - I think this code is common with our other SDKs

bgavrilMS commented 1 month ago

CC @jennyf19 as I believe this code was copied from MISE. Also adding @pmaytak for a review

SingleCopy commented 1 month ago

@microsoft-github-policy-service agree

bgavrilMS commented 1 month ago

@neha-bhargava - please review this PR. There may be implications in how we interpret some of our telemetry.