flang-compiler / f18-llvm-project

Fork of llvm/llvm-project for f18. In sync with f18-mlir and f18.
http://llvm.org
28 stars 16 forks source link

Prefer process time over thread time in CPU_TIME #1582

Closed Leporacanthicus closed 2 years ago

Leporacanthicus commented 2 years ago

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.