8268425: Show decimal nid of OSThread instead of hex format one

Reviewed-by: stuefe, kevinw
This commit is contained in:
Yi Yang 2021-07-07 01:37:50 +00:00
parent 01c29d8f2c
commit a9e201016d
3 changed files with 6 additions and 5 deletions
src
hotspot/share/runtime
jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime
test/hotspot/jtreg/serviceability/sa

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -38,7 +38,7 @@ OSThread::~OSThread() {
// Printing
void OSThread::print_on(outputStream *st) const {
st->print("nid=0x%x ", thread_id());
st->print("nid=" UINT64_FORMAT " ", (uint64_t)thread_id());
switch (_state) {
case ALLOCATED: st->print("allocated "); break;
case INITIALIZED: st->print("initialized "); break;

@ -487,7 +487,7 @@ public class JavaThread extends Thread {
out.print(" tid=");
out.print(this.getAddress());
out.print(" nid=");
out.print(String.format("0x%x ",this.getOSThread().threadId()));
out.print(String.format("%d ",this.getOSThread().threadId()));
out.print(getOSThread().getThreadState().getPrintVal());
out.print(" [");
if(this.getLastJavaSP() == null){

@ -60,8 +60,9 @@ public class JhsdbThreadInfoTest {
System.out.println(out.getStdout());
System.err.println(out.getStderr());
out.shouldMatch("\".+\" #\\d+ daemon prio=\\d+ tid=0x[0-9a-f]+ nid=0x[0-9a-f]+ .+ \\[0x[0-9a-f]+]");
out.shouldMatch("\"main\" #\\d+ prio=\\d+ tid=0x[0-9a-f]+ nid=0x[0-9a-f]+ .+ \\[0x[0-9a-f]+]");
// The character class \p{XDigit} matches any hexadecimal character.
out.shouldMatch("\".+\" #\\d+ daemon prio=\\d+ tid=0x\\p{XDigit}+ nid=\\d+ .+ \\[0x\\p{XDigit}+]");
out.shouldMatch("\"main\" #\\d+ prio=\\d+ tid=0x\\p{XDigit}+ nid=\\d+ .+ \\[0x\\p{XDigit}+]");
out.shouldMatch(" java.lang.Thread.State: .+");
out.shouldMatch(" JavaThread state: _thread_.+");