KEMBAR78
Add corretto-8 to test matrix by fandreuz · Pull Request #1274 · async-profiler/async-profiler · GitHub
Skip to content

Conversation

fandreuz
Copy link
Contributor

Description

In this PR I extend the test matrix to run Java integration tests on JDK 8.

Related issues

Fixes #1213

Motivation and context

We should test JDK 8 as well.

How has this been tested?

GHA


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@fandreuz fandreuz changed the title JDK Add corretto-8 to test matrix Apr 30, 2025
@fandreuz fandreuz changed the title Add corretto-8 to test matrix [DRAFT] Add corretto-8 to test matrix Apr 30, 2025

out = p.profile("-d 3 -e cpu -o collapsed --safe-mode 31");
Assert.isGreater(out.ratio("unknown_Java"), 0.1);
Assert.isGreater(out.ratio("unknown_Java"), 0.05);
Copy link
Contributor Author

@fandreuz fandreuz Apr 30, 2025

Choose a reason for hiding this comment

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

Does 0.1 have any special meaning? The smallest value I've seen so far is 0.08, but this feels like it should be a simple > 0 unless we have a specific value in mind

Copy link
Member

Choose a reason for hiding this comment

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

Can you show profile when the test fails?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

test/recovery/Numbers.main;test/recovery/Numbers.loop;test/recovery/Numbers.avg 4
test/recovery/Numbers.main;test/recovery/Numbers.loop;test/recovery/Numbers.avg 1
test/recovery/Numbers.main;test/recovery/Numbers.loop;test/recovery/Numbers.avg;java/lang/Integer.doubleValue 5
test/recovery/Numbers.main;test/recovery/Numbers.loop;test/recovery/Numbers.avg;java/lang/Float.doubleValue 1
test/recovery/Numbers.main;test/recovery/Numbers.loop;test/recovery/Numbers.avg 53
[unknown_Java] 27
test/recovery/Numbers.main;test/recovery/Numbers.loop;test/recovery/Numbers.avg;java/lang/Integer.doubleValue 6
test/recovery/Numbers.main;test/recovery/Numbers.loop;test/recovery/Numbers.avg;java/lang/Long.doubleValue 23
test/recovery/Numbers.main;test/recovery/Numbers.loop;test/recovery/Numbers.avg 54
test/recovery/Numbers.main;test/recovery/Numbers.loop 47
test/recovery/Numbers.main;test/recovery/Numbers.loop;test/recovery/Numbers.avg 52
test/recovery/Numbers.main;test/recovery/Numbers.loop;test/recovery/Numbers.avg;java/lang/Long.doubleValue 15
test/recovery/Numbers.main;test/recovery/Numbers.loop 7
test/recovery/Numbers.main;test/recovery/Numbers.loop;test/recovery/Numbers.avg 4

@fandreuz fandreuz changed the title [DRAFT] Add corretto-8 to test matrix Add corretto-8 to test matrix Apr 30, 2025
@fandreuz
Copy link
Contributor Author

fandreuz commented May 7, 2025

@apangin do you have any other input on the changes in this PR?

@fandreuz fandreuz marked this pull request as draft May 19, 2025 14:36
@fandreuz fandreuz marked this pull request as ready for review May 19, 2025 16:08
@Test(mainClass = JfrMultiModeProfiling.class, agentArgs = "start,all,alloc=100,file=%f.jfr", os = Os.LINUX)
@Test(mainClass = JfrMultiModeProfiling.class, agentArgs = "start,all,file=%f.jfr", os = Os.MACOS, arch = Arch.ARM64)
@Test(mainClass = JfrMultiModeProfiling.class, agentArgs = "start,all,lock=10ms,file=%f.jfr", os = Os.MACOS, arch = Arch.ARM64)
@Test(mainClass = JfrMultiModeProfiling.class, agentArgs = "start,all,file=%f.jfr", os = Os.LINUX, jvmVer = {11, Integer.MAX_VALUE})
Copy link
Member

Choose a reason for hiding this comment

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

Why 11+? Is it because of live profiling not supported on JDK 8?
I think --all should still work on JDK 8, although without live object profiling.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

@fandreuz fandreuz May 20, 2025

Choose a reason for hiding this comment

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

@fandreuz fandreuz marked this pull request as draft May 20, 2025 08:44
@fandreuz fandreuz marked this pull request as ready for review May 20, 2025 09:18
@fandreuz
Copy link
Contributor Author

All comments addressed

src/profiler.cpp Outdated

if (_event_mask & EM_ALLOC) {
if (args._all && VM::hotspot_version() < 11) {
Log::debug("'live' option was quietly removed, only supported on OpenJDK 11+");
Copy link
Member

Choose a reason for hiding this comment

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

This is not accurate: _live is also supported with OpenJ9.
Why not checking _all in AllocTracer::check?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comment on lines 201 to 204
private static boolean checkJdkVersionEarlierThan11() {
String javaVersion = System.getProperty("java.version");
return javaVersion.startsWith("1.") || Integer.parseInt(javaVersion.split("\\.")[0]) < 11;
}
Copy link
Member

Choose a reason for hiding this comment

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

This returns the version of the host JDK (test runner), which may differ from the JDK version used by the test itself.
You may find the version from the JFR recording.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if (args._live) {
// This engine is only going to be selected in Profiler::selectAllocEngine
// when can_generate_sampled_object_alloc_events is not available, i.e.
// JDK<11.
Copy link
Member

Choose a reason for hiding this comment

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

Just came across this yesterday: https://lkml.org/lkml/2020/5/29/1038
I'm fully with Linus on this issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

From one extreme to another :)
There are no strict requirements how long a line should be. Just keep it in a shape that looks fine and reads fine.

        // This engine is only going to be selected in Profiler::selectAllocEngine
        // when can_generate_sampled_object_alloc_events is not available, i.e. JDK<11.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@apangin apangin merged commit 3bbab49 into async-profiler:master May 20, 2025
18 checks passed
roy-soumadipta pushed a commit to roy-soumadipta/async-profiler that referenced this pull request Jun 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JDK8 isn't being covered by GHA

3 participants