Skip to content

Commit a9e2010

Browse files
committed
8268425: Show decimal nid of OSThread instead of hex format one
Reviewed-by: stuefe, kevinw
1 parent 01c29d8 commit a9e2010

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

src/hotspot/share/runtime/osThread.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -38,7 +38,7 @@ OSThread::~OSThread() {
3838

3939
// Printing
4040
void OSThread::print_on(outputStream *st) const {
41-
st->print("nid=0x%x ", thread_id());
41+
st->print("nid=" UINT64_FORMAT " ", (uint64_t)thread_id());
4242
switch (_state) {
4343
case ALLOCATED: st->print("allocated "); break;
4444
case INITIALIZED: st->print("initialized "); break;

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/JavaThread.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ public void printThreadInfoOn(PrintStream out){
487487
out.print(" tid=");
488488
out.print(this.getAddress());
489489
out.print(" nid=");
490-
out.print(String.format("0x%x ",this.getOSThread().threadId()));
490+
out.print(String.format("%d ",this.getOSThread().threadId()));
491491
out.print(getOSThread().getThreadState().getPrintVal());
492492
out.print(" [");
493493
if(this.getLastJavaSP() == null){

test/hotspot/jtreg/serviceability/sa/JhsdbThreadInfoTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,9 @@ public static void main(String[] args) throws Exception {
6060
System.out.println(out.getStdout());
6161
System.err.println(out.getStderr());
6262

63-
out.shouldMatch("\".+\" #\\d+ daemon prio=\\d+ tid=0x[0-9a-f]+ nid=0x[0-9a-f]+ .+ \\[0x[0-9a-f]+]");
64-
out.shouldMatch("\"main\" #\\d+ prio=\\d+ tid=0x[0-9a-f]+ nid=0x[0-9a-f]+ .+ \\[0x[0-9a-f]+]");
63+
// The character class \p{XDigit} matches any hexadecimal character.
64+
out.shouldMatch("\".+\" #\\d+ daemon prio=\\d+ tid=0x\\p{XDigit}+ nid=\\d+ .+ \\[0x\\p{XDigit}+]");
65+
out.shouldMatch("\"main\" #\\d+ prio=\\d+ tid=0x\\p{XDigit}+ nid=\\d+ .+ \\[0x\\p{XDigit}+]");
6566
out.shouldMatch(" java.lang.Thread.State: .+");
6667
out.shouldMatch(" JavaThread state: _thread_.+");
6768

0 commit comments

Comments
 (0)