This is an archive of the discontinued LLVM Phabricator instance.

[flang][runtime] Prefer process time over thread time in CPU_TIME
ClosedPublic

Authored by Leporacanthicus on Apr 8 2022, 11:30 AM.

Details

Summary

Most Fortran compilers appear to return the process time
for calls to CPU_TIME, where the flang implementation
prior to this change was returning the time used by the
current thread. This would cause incorrect time being
reported when for example OpenMP is used to share work
across multiple CPUs.

This patch changes the order so the selection of "what
time to return" so that if there is a process time to
report, that is the reported value, and only if that is
not available, the thread time is considerd instead.

Diff Detail

Event Timeline

Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptApr 8 2022, 11:30 AM
Leporacanthicus requested review of this revision.Apr 8 2022, 11:30 AM
jeanPerier accepted this revision.Apr 10 2022, 11:58 PM

LGTM, thanks

This revision is now accepted and ready to land.Apr 10 2022, 11:58 PM