-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use CLOCK_BOOTTIME to calculate BootTime on linux #67589
Conversation
Tagging subscribers to this area: @dotnet/area-system-diagnostics-process Issue DetailsFixes #67583.
|
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Linux.cs
Outdated
Show resolved
Hide resolved
655ce42
to
2ee3868
Compare
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Linux.cs
Outdated
Show resolved
Hide resolved
2ee3868
to
82d5fb6
Compare
Just looked at SystemNative_GetTimestamp: Should this be CLOCK_MONOTONIC_RAW, since CLOCK_UPTIME_RAW is a "clock that increments monotonically, in the same manner as CLOCK_MONOTONIC_RAW, but that does not increment while the system is asleep". Yet we are adding it to the time the process was running to get a real world time.
As for this one, the man page says "CLOCK_MONOTONIC Clock that cannot be set and represents monotonic time since some unspecified starting point." which seems a little ill defined.
|
I have restructured The precision was required in |
I see you removed clock_gettime_ns_p -- is clock_gettime as good? Looks like the original change was following guidance in https://developer.apple.com/documentation/kernel/1462446-mach_absolute_time. Complicated! Do you have access to Windows and Mac to verify they give reasonable outputs, or are we relying on tests? |
Ack, we have the tests disabled on mac - could you enable these ?
|
2833b62
to
5ab65be
Compare
The conditional tests are related to The test |
5ab65be
to
91bffae
Compare
Failing leg appears to be infra issue (exit code is 0 from test runs but helix is reporting failure for some reason). @stephentoub, could you please take another look? 🙂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@am11 big thanks for your contribution! PTAL at my comments
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Linux.cs
Outdated
Show resolved
Hide resolved
28fb6ed
to
415a469
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It LGTM, thanks a lot @am11 !
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Linux.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Linux.cs
Outdated
Show resolved
Hide resolved
Do we need to add or enable any tests that validate |
37e4251
to
815d718
Compare
`time_t` on Android 32-bit (arm and x86) is typedef'd as `long`.
/azp run runtime-extra-platforms |
Azure Pipelines successfully started running 1 pipeline(s). |
Still failing on Android.
|
If this is blocked by the linked issue, let's mark this as draft meantime? |
long bootTimeTicks = Interlocked.Read(ref s_bootTimeTicks); | ||
if (bootTimeTicks == 0) | ||
{ | ||
bootTimeTicks = Interop.Sys.GetBootTimeTicks(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should check if the value is -1
and throw PlatformNotSupportedException
in that case.
Co-authored-by: Simon Rozsival <simon@rozsival.com>
Thanks a lot @simonrozsival! Could you please run |
/azp run runtime-extra-platforms |
Azure Pipelines successfully started running 1 pipeline(s). |
Android legs are green. Remaining failures are unrelated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm seeing a failure in #75055 that looks related:
|
Filed as #75329 so that I can refer to it. |
Thanks and yes, it's related. The failure is happening on Windows 11 in a modified test (on Linux, it cannot fail because we calculate time difference from fixed point). Seems like we would need to bring back Strange thing is the difference on Windows 11 is 13 seconds, which is quite big (and we have only changed Linux implementation in this PR). Unless someone object, I'll add 30 seconds precision to be on the safe side. |
I've also seen this test failure on linux-s390x (see #75329 (comment)) with a much larger time difference - it looks to me it might be picking up the wrong process? |
Yes, this assertion is not valid in GetProcessByName test when there are multiple dotnet processes running. We should just delete it from the test. Posted #75334. |
Fixes #67583.