[10] RFR 8181647: jhsdb jstack could not output thread name
Jini George
jini.george at oracle.com
Thu Jun 8 07:42:39 UTC 2017
Hi Chihiro,
Thank you for making this useful change. Your changes look good.
It would be great though if you could add a test case for this. Could
you also modify the copyright year to 2017 ? One additional suggestion:
The addition of the thread name makes the separator lines unaligned in
the pstack/jstack --mixed cases. Like:
----------------- "Service Thread" nid=16051 -----------------
and
----------------- nid=16052 -----------------
So I am wondering if it would make sense to have the name printed out on
a separate line to keep the separator lines aligned. But this is a nit,
and I would leave it to you to decide on this.
Thanks,
Jini (Not a (R)eviewer)
On 6/7/2017 3:16 PM, chihiro ito wrote:
> Hi all,
>
> I changed to output Java thread name in jhsdb jstack as following.
>
> jhsdb jstack --pid 25879
> "main" nid=25884: (state = BLOCKED)
>
> jhsdb jstack --mixed --pid 25879
> ----------------- "main" nid=25884 -----------------
>
> Could you possibly review for this following small change? If review
> is ok, please commit this as cito.
>
> Source:
> diff --git
> a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/PStack.java
> b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/PStack.java
> ---
> a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/PStack.java
> +++
> b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/PStack.java
> @@ -86,6 +86,13 @@
> try {
> CFrame f = cdbg.topFrameForThread(th);
> out.print("----------------- ");
> + JavaThread jthread = (JavaThread) proxyToThread.get(th);
> + if (jthread != null) {
> + out.print("\"");
> + out.print(jthread.getThreadName());
> + out.print("\" ");
> + }
> + out.print("nid=");
> out.print(th);
> out.println(" -----------------");
> while (f != null) {
> diff --git
> a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/StackTrace.java
> b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/StackTrace.java
>
> ---
> a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/StackTrace.java
> +++
> b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/StackTrace.java
> @@ -75,7 +75,9 @@
> for (JavaThread cur = threads.first(); cur != null; cur =
> cur.next(), i++) {
> if (cur.isJavaThread()) {
> Address sp = cur.getLastJavaSP();
> - tty.print("Thread ");
> + tty.print("\"");
> + tty.print(cur.getThreadName());
> + tty.print("\" nid=");
> cur.printThreadIDOn(tty);
> tty.print(": (state = " + cur.getThreadState());
> if (verbose) {
>
> Regards,
> Chihiro
>
More information about the serviceability-dev
mailing list