Skip to content
Permalink
Browse files
8268425: Show decimal nid of OSThread instead of hex format one
Reviewed-by: stuefe, kevinw
  • Loading branch information
y1yang0 committed Jul 7, 2021
1 parent 01c29d8 commit a9e2010
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
@@ -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 void printThreadInfoOn(PrintStream out){
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 static void main(String[] args) throws Exception {
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_.+");

3 comments on commit a9e2010

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@y1yang0
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/backport jdk17u

@openjdk
Copy link

@openjdk openjdk bot commented on a9e2010 Nov 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kelthuzadx @kelthuzadx the backport was successfully created on the branch kelthuzadx-backport-a9e20101 in my personal fork of openjdk/jdk17u. To create a pull request with this backport targeting openjdk/jdk17u:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

this pull request contains a backport of commit a9e20101 from the openjdk/jdk repository.

The commit being backported was authored by Yi Yang on 7 Jul 2021 and was reviewed by Thomas Stuefe and Kevin Walls.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk17u:

$ git fetch https://github.com/openjdk-bots/jdk17u kelthuzadx-backport-a9e20101:kelthuzadx-backport-a9e20101
$ git checkout kelthuzadx-backport-a9e20101
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk17u kelthuzadx-backport-a9e20101

Please sign in to comment.