RFR: 8268425: Show decimal nid of OSThread instead of hex format one [v5]

David Holmes david.holmes at oracle.com
Tue Jul 6 03:31:26 UTC 2021


On 6/07/2021 1:25 pm, Yi Yang wrote:
> On Tue, 6 Jul 2021 03:08:42 GMT, David Holmes <dholmes at openjdk.org> wrote:
> 
>>> Yi Yang has updated the pull request incrementally with one additional commit since the last revision:
>>>
>>>    use \p{XDigit}
>>
>> src/hotspot/share/runtime/osThread.cpp line 41:
>>
>>> 39: // Printing
>>> 40: void OSThread::print_on(outputStream *st) const {
>>> 41:   st->print("nid=" UINT64_FORMAT " ", (uint64_t)thread_id());
>>
>> Why are you forcing this to be a 64-bit type?
> 
> IMHO, I prefer using `%d` since a large portion of existing code using `%d`. Thomas suggests using UINT64_FORMAT rather than `%d`:
>> You'd do:
> 
>> print("nid: " UINT64_FORMAT, (uint64_t) id):;
> 
>> thread_t is, among other things, pthread_t, which is opaque. Any current code treating that as signed int is incorrect too.
> 
> There is no uniform format for the formatted output of thread_id in hotspot. As far as I can see, `%ld` `%d` and `UINTX_FORMAT` are used, so I want to left the decision to reviewers.

Okay. This is a mess but that's not your issue. At least a 64-bit 
decimal value won't show any leading zeroes so it doesn't really matter.

If Thomas and Keven are happy with the latest changes then that is fine.

Thanks,
David

> -------------
> 
> PR: https://git.openjdk.java.net/jdk/pull/4449
> 


More information about the serviceability-dev mailing list