On Fri, 15 Aug 2025 08:05:06 GMT, Albert Mingkun Yang <ay...@openjdk.org> wrote:
>>> My concern is that we get a number on cpu-time without knowing the number >>> is off by a large margin when failure occurs, so there should probably be >>> some warning/msg somewhere. >> >> Sure, that could be helpful. I don't think it should be a warning on the OS >> API though. Looking at the code a log message like that could be added to >> `CPUTimeThreadClosure::do_thread(...)`. To me it would be enough to have >> that on `log_info(cpu)` possibly even on debug-level. What do you think? > >> I don't think it should be a warning on the OS API though. > > Agree. At this level, returning `-1` already indicates the error -- callers > should/can check the return-value and act on it. > >> ... could be added to CPUTimeThreadClosure::do_thread(...) > > There are dozens of callers though; `CPUTimeThreadClosure` is just one. For > this particular patch, I think emitting some msg/warning somewhere inside > `static void log_cpu_time` may be enough. WDYT? I don't have super strong opinion here, but to be able to add some message in `log_cpu_time` we would need to add logic to the `CPUTimeThreadClosure` to know if something went wrong or am I missing what you are suggesting? And that message would not know what thread we failed to measure, but the closure have that information. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/26621#discussion_r2278524140