Skip to content

Commit 12d7f62

Browse files
committed
Showing stack trace of the selected event in JFR Browser
- introduced JFREvent.getID() - introduced JFRModel.getEvent(id) - introduced JFRMethod.getDescription() - introduced JFRStackTrace.isTruncated() - improved performance & memory of the JFR Browser
1 parent 9db4278 commit 12d7f62

File tree

26 files changed

+308
-73
lines changed

26 files changed

+308
-73
lines changed

visualvm/jfr.generic/manifest.mf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ AutoUpdate-Essential-Module: true
44
OpenIDE-Module: org.graalvm.visualvm.jfr.generic/2
55
OpenIDE-Module-Install: org/graalvm/visualvm/jfr/generic/Installer.class
66
OpenIDE-Module-Localizing-Bundle: org/graalvm/visualvm/jfr/generic/Bundle.properties
7-
OpenIDE-Module-Specification-Version: 2.0
7+
OpenIDE-Module-Specification-Version: 2.1
88
OpenIDE-Module-Provides: jfr.implementation

visualvm/jfr.generic/nbproject/project.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<compile-dependency/>
2222
<run-dependency>
2323
<release-version>2</release-version>
24-
<specification-version>2.0</specification-version>
24+
<specification-version>2.1</specification-version>
2525
</run-dependency>
2626
</dependency>
2727
<dependency>

visualvm/jfr.generic/src/org/graalvm/visualvm/jfr/generic/model/impl/JFRGenericEvent.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2019, 2020, 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
@@ -56,7 +56,8 @@ abstract class JFRGenericEvent extends JFREvent {
5656
final IItem item;
5757

5858

59-
protected JFRGenericEvent(IItem event) {
59+
protected JFRGenericEvent(IItem event, long id) {
60+
super(id);
6061
this.item = event;
6162
}
6263

@@ -289,8 +290,8 @@ public String toString() {
289290
// JFREvent for .jfr v0 (JDK 7 & 8)
290291
static final class V0 extends JFRGenericEvent {
291292

292-
V0(IItem event) {
293-
super(event);
293+
V0(IItem event, long id) {
294+
super(event, id);
294295
}
295296

296297
@Override
@@ -327,8 +328,8 @@ protected Object getThreadThread() throws JFRPropertyNotAvailableException {
327328
// JFREvent for .jfr v1 and v2 (JDK 9+)
328329
static final class V1 extends JFRGenericEvent {
329330

330-
V1(IItem event) {
331-
super(event);
331+
V1(IItem event, long id) {
332+
super(event, id);
332333
}
333334

334335
@Override

visualvm/jfr.generic/src/org/graalvm/visualvm/jfr/generic/model/impl/JFRGenericEventFactory.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2019, 2020, 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
@@ -35,7 +35,7 @@
3535
*/
3636
abstract class JFRGenericEventFactory {
3737

38-
abstract JFRGenericEvent createEvent(IItem item);
38+
abstract JFRGenericEvent createEvent(IItem item, long id);
3939

4040

4141
static JFRGenericEventFactory resolve(EventArray[] types) {
@@ -51,13 +51,13 @@ static JFRGenericEventFactory resolve(EventArray[] types) {
5151

5252
static class V0 extends JFRGenericEventFactory {
5353

54-
@Override JFRGenericEvent createEvent(IItem item) { return new JFRGenericEvent.V0(item); }
54+
@Override JFRGenericEvent createEvent(IItem item, long id) { return new JFRGenericEvent.V0(item, id); }
5555

5656
}
5757

5858
static class V1 extends JFRGenericEventFactory {
5959

60-
@Override JFRGenericEvent createEvent(IItem item) { return new JFRGenericEvent.V1(item); }
60+
@Override JFRGenericEvent createEvent(IItem item, long id) { return new JFRGenericEvent.V1(item, id); }
6161

6262
}
6363

visualvm/jfr.generic/src/org/graalvm/visualvm/jfr/generic/model/impl/JFRGenericMethod.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2019, 2020, 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
@@ -47,6 +47,11 @@ final class JFRGenericMethod extends JFRMethod {
4747
public String getName() {
4848
return method.getMethodName();
4949
}
50+
51+
@Override
52+
public String getDescriptor() {
53+
return method.getFormalDescriptor();
54+
}
5055

5156
@Override
5257
public JFRClass getType() {

visualvm/jfr.generic/src/org/graalvm/visualvm/jfr/generic/model/impl/JFRGenericModel.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2019, 2020, 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
@@ -79,12 +79,13 @@ public void visitEvents(JFREventVisitor... visitors) {
7979
try {
8080
List<JFREventVisitor> _visitors = new ArrayList(Arrays.asList(visitors));
8181
Iterator<EventArray> iterables = Arrays.asList(types).iterator();
82+
long id = 0;
8283
while (!_visitors.isEmpty() && iterables.hasNext()) {
8384
EventArray type = iterables.next();
8485
String typeId = type.getType().getIdentifier();
8586
Iterator<IItem> items = Arrays.asList(type.getEvents()).iterator();
8687
while (!_visitors.isEmpty() && items.hasNext()) {
87-
JFREvent event = factory.createEvent(items.next());
88+
JFREvent event = factory.createEvent(items.next(), id++);
8889
Iterator<JFREventVisitor> _visitorsI = _visitors.iterator();
8990
while (_visitorsI.hasNext())
9091
if (_visitorsI.next().visit(typeId, event))

visualvm/jfr.generic/src/org/graalvm/visualvm/jfr/generic/model/impl/JFRGenericStackTrace.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2019, 2020, 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
@@ -56,6 +56,11 @@ public List<JFRStackFrame> getFrames() {
5656
return frames;
5757
}
5858

59+
@Override
60+
public boolean isTruncated() {
61+
return stackTrace.getTruncationState().isTruncated();
62+
}
63+
5964

6065
@Override
6166
public int hashCode() {

visualvm/jfr.jdk11/manifest.mf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ OpenIDE-Module: org.graalvm.visualvm.jfr.jdk11/2
44
OpenIDE-Module-Install: org/graalvm/visualvm/jfr/jdk11/Installer.class
55
OpenIDE-Module-Java-Dependencies: Java > 11
66
OpenIDE-Module-Localizing-Bundle: org/graalvm/visualvm/jfr/jdk11/Bundle.properties
7-
OpenIDE-Module-Specification-Version: 2.0
7+
OpenIDE-Module-Specification-Version: 2.1
88
OpenIDE-Module-Provides: jfr.implementation

visualvm/jfr.jdk11/nbproject/project.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<compile-dependency/>
2222
<run-dependency>
2323
<release-version>2</release-version>
24-
<specification-version>2.0</specification-version>
24+
<specification-version>2.1</specification-version>
2525
</run-dependency>
2626
</dependency>
2727
<dependency>
@@ -30,7 +30,7 @@
3030
<compile-dependency/>
3131
<run-dependency>
3232
<release-version>2</release-version>
33-
<specification-version>2.0</specification-version>
33+
<specification-version>2.1</specification-version>
3434
</run-dependency>
3535
</dependency>
3636
<dependency>

visualvm/jfr.jdk11/src/org/graalvm/visualvm/jfr/jdk11/Bundle.properties

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
OpenIDE-Module-Display-Category=JFR Loaders
2626
OpenIDE-Module-Long-Description=\
2727
Support for the JFR loader bundled with JDK 11 and newer (requires running VisualVM on JDK 11+) reading JFR snapshots created from JDK 9 and newer. \
28-
Requires VisualVM-JFR-JDK9 to be installed as well.\n\
29-
<BR>\n<BR>\nIf you run VisualVM on JDK 9 or JDK 10, please install only the <B>VisualVM-JFR-JDK9</B> loader support.
28+
Requires VisualVM-JFR-JDK9 to be installed as well.
3029
OpenIDE-Module-Name=VisualVM-JFR-JDK11
3130
OpenIDE-Module-Short-Description=Support for the JFR loader bundled with JDK 11 and newer reading JFR snapshots created from JDK 11 and newer

0 commit comments

Comments
 (0)