Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitff4f533

Browse files
committed
8274560: JFR: Add test for OldObjectSample event when using Shenandoah
Backport-of: ef0922e88528bdf4fe75537ddf4e82123e3f58b3
1 parent23b4496 commitff4f533

File tree

2 files changed

+80
-1
lines changed

2 files changed

+80
-1
lines changed

‎test/jdk/jdk/jfr/event/oldobject/TestObjectDescription.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
* @test
4242
* @key jfr
4343
* @requires vm.hasJFR
44-
* @requires vm.gc != "Z"
44+
* @requires vm.gc != "Z" & vm.gc != "Shenandoah"
4545
* @library /test/lib /test/jdk
4646
* @modules jdk.jfr/jdk.jfr.internal.test
4747
* @run main/othervm -XX:TLABSize=2k jdk.jfr.event.oldobject.TestObjectDescription
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
/*
2+
* Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation.
8+
*
9+
* This code is distributed in the hope that it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
* version 2 for more details (a copy is included in the LICENSE file that
13+
* accompanied this code).
14+
*
15+
* You should have received a copy of the GNU General Public License version
16+
* 2 along with this work; if not, write to the Free Software Foundation,
17+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18+
*
19+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20+
* or visit www.oracle.com if you need additional information or have any
21+
* questions.
22+
*/
23+
24+
packagejdk.jfr.event.oldobject;
25+
26+
importjava.util.ArrayList;
27+
importjava.util.List;
28+
29+
importjdk.jfr.Recording;
30+
importjdk.jfr.consumer.RecordedEvent;
31+
importjdk.jfr.internal.test.WhiteBox;
32+
importjdk.test.lib.jfr.EventNames;
33+
importjdk.test.lib.jfr.Events;
34+
35+
/**
36+
* @test
37+
* @key jfr
38+
* @requires vm.hasJFR & vm.gc.Shenandoah
39+
* @summary Test leak profiler with Shenandoah
40+
* @library /test/lib /test/jdk
41+
* @modules jdk.jfr/jdk.jfr.internal.test
42+
* @run main/othervm -XX:TLABSize=2k -XX:+UseShenandoahGC jdk.jfr.event.oldobject.TestShenandoah
43+
*/
44+
publicclassTestShenandoah {
45+
46+
staticprivateclassFindMe {
47+
}
48+
49+
publicstaticList<FindMe[]>list =newArrayList<>(OldObjects.MIN_SIZE);
50+
51+
publicstaticvoidmain(String[]args)throwsException {
52+
WhiteBox.setWriteAllObjectSamples(true);
53+
54+
while (true) {
55+
try (Recordingr =newRecording()) {
56+
r.enable(EventNames.OldObjectSample).withStackTrace().with("cutoff","infinity");
57+
r.start();
58+
allocateFindMe();
59+
System.gc();
60+
r.stop();
61+
List<RecordedEvent>events =Events.fromRecording(r);
62+
System.out.println(events);
63+
if (OldObjects.countMatchingEvents(events,FindMe[].class,null,null, -1,"allocateFindMe") >0) {
64+
return;
65+
}
66+
System.out.println("Could not find leaking object, retrying...");
67+
}
68+
list.clear();
69+
}
70+
}
71+
72+
publicstaticvoidallocateFindMe() {
73+
for (inti =0;i <OldObjects.MIN_SIZE;i++) {
74+
// Allocate array to trigger sampling code path for interpreter / c1
75+
list.add(newFindMe[0]);
76+
}
77+
}
78+
79+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp