RFR: 8372584: [Linux]: Replace reading proc to get thread user CPU time with clock_gettime [v3]
Thomas Stuefe
stuefe at openjdk.org
Tue Dec 2 15:08:47 UTC 2025
On Tue, 2 Dec 2025 09:15:31 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> Using a positive outcome like success to encode the outcome make it possible to return like so `return success ? os::Linux::thread_cpu_time(clockid) : -1;`. I prefer having the `-1` at the end as I find this reads easier. If we encode a failure we would need to write `return !failure ? os::Linux::thread_cpu_time(clockid) : -1;`. Hence, I would prefer keeping this as is as double-negatives may be harder to parse.
>
> Okay but you are setting up a usage requirement without documenting anywhere that that requirement exists.
I would prefer if we kept using the standard. When in Rome...
What we often do is this:
bool get_thread_clockid(Thread* thread, bool total, clock_id_t* is);
or, alternatively, what David wrote.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28556#discussion_r2581600332
More information about the hotspot-runtime-dev
mailing list