Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8323795: jcmd Compiler.codecache should print total size of code cache #17445

Closed
wants to merge 5 commits into from

Conversation

y1yang0
Copy link
Member

@y1yang0 y1yang0 commented Jan 16, 2024

CodeHeap 'non-profiled nmethods': size=118592Kb used=29Kb max_used=29Kb free=118562Kb
 bounds [0x00007fbe84622000, 0x00007fbe84892000, 0x00007fbe8b9f2000]
CodeHeap 'profiled nmethods': size=118588Kb used=80Kb max_used=80Kb free=118507Kb
 bounds [0x00007fbe7c9f2000, 0x00007fbe7cc62000, 0x00007fbe83dc1000]
CodeHeap 'non-nmethods': size=8580Kb used=1258Kb max_used=1834Kb free=7321Kb
 bounds [0x00007fbe83dc1000, 0x00007fbe84031000, 0x00007fbe84622000]
 total_blobs=474 nmethods=87 adapters=293
 compilation: enabled
              stopped_count=0, restarted_count=0
 full_count=0

It's better to accumulates total size of used/free/size, for example

-SegmentedCodeCache
CodeCache: size=245760Kb used=1366Kb max_used=1943Kb free=244393Kb
 bounds [0x00007fdcc89f2000, 0x00007fdcc8c62000, 0x00007fdcd79f2000]
 total_blobs=474, nmethods=87, adapters=293
 stopped_count=0, restarted_count=0, full_count=0 
 compilation=enabled
+SegmentedCodeCache
CodeHeap 'non-profiled nmethods': size=118592Kb used=29Kb max_used=29Kb free=118562Kb
 bounds [0x00007f89c8622000, 0x00007f89c8892000, 0x00007f89cf9f2000]
CodeHeap 'profiled nmethods': size=118588Kb used=80Kb max_used=80Kb free=118507Kb
 bounds [0x00007f89c09f2000, 0x00007f89c0c62000, 0x00007f89c7dc1000]
CodeHeap 'non-nmethods': size=8580Kb used=1258Kb max_used=1834Kb free=7321Kb
 bounds [0x00007f89c7dc1000, 0x00007f89c8031000, 0x00007f89c8622000]
CodeCache: size=245760Kb, used=1367Kb, max_used=1943Kb, free=244390Kb
 total_blobs=474, nmethods=87, adapters=293
 stopped_count=0, restarted_count=0, full_count=0 
 compilation=enabled

Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed (2 reviews required, with at least 1 Reviewer, 1 Author)

Issue

  • JDK-8323795: jcmd Compiler.codecache should print total size of code cache (Enhancement - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/17445/head:pull/17445
$ git checkout pull/17445

Update a local copy of the PR:
$ git checkout pull/17445
$ git pull https://git.openjdk.org/jdk.git pull/17445/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 17445

View PR using the GUI difftool:
$ git pr show -t 17445

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/17445.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jan 16, 2024

👋 Welcome back yyang! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Pull request is ready for review label Jan 16, 2024
@openjdk
Copy link

openjdk bot commented Jan 16, 2024

@y1yang0 The following label will be automatically applied to this pull request:

  • hotspot-compiler

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the hotspot-compiler hotspot-compiler-dev@openjdk.org label Jan 16, 2024
@mlbridge
Copy link

mlbridge bot commented Jan 16, 2024

Webrevs

@vnkozlov
Copy link
Contributor

Can you do next layout of output?:

CodeHeap 'non-nmethods': size=8580Kb used=1258Kb max_used=1834Kb free=7321Kb
 bounds [0x00007fbe83dc1000, 0x00007fbe84031000, 0x00007fbe84622000]
Total CodeHeap: size=245760Kb, used=1367Kb, max used=1943Kb, free=244390Kb
 total_blobs=474 nmethods=87 adapters=293, full_count=0
Compilation: enabled,  stopped_count=0, restarted_count=0

st->print_cr(" compilation=%s", CompileBroker::should_compile_new_jobs() ?
"enabled" : Arguments::mode() == Arguments::_int ?
"disabled (interpreter mode)" :
"disabled (not enough contiguous free space left)");
Copy link
Member

Choose a reason for hiding this comment

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

Why did you change the order of the compilation= and the stopped_count= output?

@TobiHartmann
Copy link
Member

The title is confusing. Should it be something like "jcmd Compiler.codecache should print total size of code cache"?

@y1yang0
Copy link
Member Author

y1yang0 commented Jan 18, 2024

@TobiHartmann @vnkozlov

In the first commit, the ouput is confusing(CodeCache and Total CodeHeap) if SegmentedCodeCache is turned off, i.e.

CodeCache: size=118592Kb used=29Kb max_used=29Kb free=118562Kb
 bounds [0x00007fbe84622000, 0x00007fbe84892000, 0x00007fbe8b9f2000]
Total CodeHeap: size=118592Kb used=29Kb max_used=29Kb free=118562Kb
 total_blobs=474 nmethods=87 adapters=293
 compilation: enabled
              stopped_count=0, restarted_count=0
 full_count=0

So I made new change to

-SegmentedCodeCache
CodeCache: size=245760Kb used=1366Kb max_used=1943Kb free=244393Kb
 bounds [0x00007fdcc89f2000, 0x00007fdcc8c62000, 0x00007fdcd79f2000]
 total_blobs=474, nmethods=87, adapters=293
 stopped_count=0, restarted_count=0, full_count=0 
 compilation=enabled

+SegmentedCodeCache
CodeHeap 'non-profiled nmethods': size=118592Kb used=29Kb max_used=29Kb free=118562Kb
 bounds [0x00007f89c8622000, 0x00007f89c8892000, 0x00007f89cf9f2000]
CodeHeap 'profiled nmethods': size=118588Kb used=80Kb max_used=80Kb free=118507Kb
 bounds [0x00007f89c09f2000, 0x00007f89c0c62000, 0x00007f89c7dc1000]
CodeHeap 'non-nmethods': size=8580Kb used=1258Kb max_used=1834Kb free=7321Kb
 bounds [0x00007f89c7dc1000, 0x00007f89c8031000, 0x00007f89c8622000]
CodeCache: size=245760Kb, used=1367Kb, max_used=1943Kb, free=244390Kb
 total_blobs=474, nmethods=87, adapters=293
 stopped_count=0, restarted_count=0, full_count=0 
 compilation=enabled

@y1yang0 y1yang0 changed the title 8323795: jcmd Compiler.codecache counts total sizes of used/free 8323795: jcmd Compiler.codecache should print total size of code cache Jan 18, 2024
@vnkozlov
Copy link
Contributor

stopped_count and restarted_count are related to compilation. That is why I suggested to print them on the same line:

Compilation: enabled, stopped_count=0, restarted_count=0

full_count can be put on the line with numbers for methods and others.

I am fine with last refactoring you did for different SegmentedCodeCache flag values.

@TobiHartmann
Copy link
Member

I agree with Vladimir, I'd prefer something like this:

CodeHeap 'non-nmethods': size=8580Kb used=1258Kb max_used=1834Kb free=7321Kb
 bounds [0x00007f89c7dc1000, 0x00007f89c8031000, 0x00007f89c8622000]
CodeCache: size=245760Kb, used=1367Kb, max_used=1943Kb, free=244390Kb
 total_blobs=474, nmethods=87, adapters=293, full_count=0

Compilation: enabled, stopped_count=0, restarted_count=0

@y1yang0
Copy link
Member Author

y1yang0 commented Jan 22, 2024

Now it looks like

104640:
CodeHeap 'non-profiled nmethods': size=118592Kb used=29Kb max_used=29Kb free=118562Kb
 bounds [0x00007f09f8622000, 0x00007f09f8892000, 0x00007f09ff9f2000]
CodeHeap 'profiled nmethods': size=118588Kb used=80Kb max_used=80Kb free=118507Kb
 bounds [0x00007f09f09f2000, 0x00007f09f0c62000, 0x00007f09f7dc1000]
CodeHeap 'non-nmethods': size=8580Kb used=1257Kb max_used=1833Kb free=7323Kb
 bounds [0x00007f09f7dc1000, 0x00007f09f8031000, 0x00007f09f8622000]
CodeCache: size=245760Kb, used=1366Kb, max_used=1942Kb, free=244392Kb
 total_blobs=474, nmethods=87, adapters=293, full_count=0
Compilation: enabled, stopped_count=0, restarted_count=0

110115:
CodeCache: size=245760Kb used=1366Kb max_used=1935Kb free=244393Kb
 bounds [0x00007ff4d89f2000, 0x00007ff4d8c62000, 0x00007ff4e79f2000]
 total_blobs=474, nmethods=87, adapters=293, full_count=0
Compilation: enabled, stopped_count=0, restarted_count=0

Copy link
Member

@TobiHartmann TobiHartmann left a comment

Choose a reason for hiding this comment

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

Thanks, that looks good to me. I'll run testing and report back once it passed.

"disabled (interpreter mode)" :
"disabled (not enough contiguous free space left)",
CompileBroker::get_total_compiler_stopped_count(),
CompileBroker::get_total_compiler_restarted_count());
Copy link
Member

Choose a reason for hiding this comment

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

The indentation should be fixed.

@openjdk
Copy link

openjdk bot commented Jan 29, 2024

@y1yang0 This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8323795: jcmd Compiler.codecache should print total size of code cache

Reviewed-by: thartmann, kvn

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 404 new commits pushed to the master branch:

  • 099b744: 8326117: ProblemList serviceability/jvmti/vthread/SuspendWithInterruptLock/SuspendWithInterruptLock.java#default in Xcomp mode
  • 39627bc: 6510914: JScrollBar.getMinimumSize() breaks the contract of JComponent.setMinimumSize()
  • 7004c27: 8303972: (zipfs) Make test/jdk/jdk/nio/zipfs/TestLocOffsetFromZip64EF.java independent of the zip command line
  • c2d9fa2: 8326000: Remove obsolete comments for class sun.security.ssl.SunJSSE
  • f50df10: 8299023: TestPLABResize.java and TestPLABPromotion.java are failing intermittently
  • cf13086: 8317697: refactor-encapsulate x86 VM_Version::CpuidInfo
  • 3b76372: 8325687: SimpleJavaFileObject specification would benefit from implSpec
  • b5df2f4: 8323170: j2dbench is using outdated javac source/target to be able to build by itself
  • 267780b: 8324680: Replace NULL with nullptr in JVMTI generated code
  • f3073db: 8321408: Add Certainly roots R1 and E1
  • ... and 394 more: https://git.openjdk.org/jdk/compare/8abaf119659e46684d196bf76784c11587039f60...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jan 29, 2024
Copy link
Member

@TobiHartmann TobiHartmann left a comment

Choose a reason for hiding this comment

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

/test/hotspot/jtreg/vmTestbase/vm/compiler/CodeCacheInfo/Test.java fails

 stdout: [CodeHeap 'non-profiled nmethods': size=120032Kb used=3Kb max_used=3Kb free=120028Kb
 bounds [0x0000000113a84000, 0x0000000113cf4000, 0x000000011afbc000]
CodeHeap 'profiled nmethods': size=120016Kb used=14Kb max_used=14Kb free=120001Kb
 bounds [0x000000010bfbc000, 0x000000010c22c000, 0x00000001134f0000]
CodeHeap 'non-nmethods': size=5712Kb used=1752Kb max_used=1752Kb free=3959Kb
 bounds [0x00000001134f0000, 0x0000000113760000, 0x0000000113a84000]
CodeCache: size=245760Kb, used=1769Kb, max_used=1769Kb, free=243988Kb
 total_blobs=748, nmethods=15, adapters=651, full_count=0
Compilation: enabled, stopped_count=0, restarted_count=0
];
 stderr: [java version "23-internal" 2024-09-17
Java(TM) SE Runtime Environment (fastdebug build 23-internal-2024-01-29-1002351.tobias.hartmann.jdk2)
Java HotSpot(TM) 64-Bit Server VM (fastdebug build 23-internal-2024-01-29-1002351.tobias.hartmann.jdk2, mixed mode, sharing)
]
 exitValue = 0

java.lang.RuntimeException: '^(CodeHeap '[^']+': size=\\d+Kb used=\\d+Kb max_used=\\d+Kb free=\\d+Kb\\n bounds \\[0x[0-9a-f]+, 0x[0-9a-f]+, 0x[0-9a-f]+\\]\\n)+ total_blobs=\\d+ nmethods=\\d+ adapters=\\d+\\n compilation: enabled\\n' missing from stdout
	at jdk.test.lib.process.OutputAnalyzer.stdoutShouldMatch(OutputAnalyzer.java:389)
	at vm.compiler.CodeCacheInfo.Test.main(Test.java:78)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at com.sun.javatest.regtest.agent.MainWrapper$MainTask.run(MainWrapper.java:138)
	at java.base/java.lang.Thread.run(Thread.java:1575)

@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Jan 29, 2024
Copy link
Contributor

@vnkozlov vnkozlov left a comment

Choose a reason for hiding this comment

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

The output looks fine to me now. I approve but it needs new round of testing.

@vnkozlov
Copy link
Contributor

/reviewers 2

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jan 30, 2024
@openjdk
Copy link

openjdk bot commented Jan 30, 2024

@vnkozlov
The total number of required reviews for this PR (including the jcheck configuration and the last /reviewers command) is now set to 2 (with at least 1 Reviewer, 1 Author).

@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Jan 30, 2024
@TobiHartmann
Copy link
Member

I re-submitted testing and will report back once it passed.

@TobiHartmann
Copy link
Member

We have an internal test that relies on the jcmd output and fails with these changes. I'll try to figure out how to fix that test.

Copy link
Member

@TobiHartmann TobiHartmann left a comment

Choose a reason for hiding this comment

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

Looks good. I have the fix for the internal test ready.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Feb 8, 2024
@TobiHartmann
Copy link
Member

Please do an integrate delegate (https://wiki.openjdk.org/display/SKARA/Pull+Request+Commands#PullRequestCommands-/integrate), so that I can push both changes at the same time. Thanks!

@y1yang0
Copy link
Member Author

y1yang0 commented Feb 19, 2024

Thanks for reviews @vnkozlov @TobiHartmann

/integrate delegate

@openjdk openjdk bot added the delegated label Feb 19, 2024
@openjdk
Copy link

openjdk bot commented Feb 19, 2024

@y1yang0 Integration of this pull request has been delegated and may be completed by any project committer using the /integrate pull request command.

@TobiHartmann
Copy link
Member

/integrate

@openjdk
Copy link

openjdk bot commented Feb 19, 2024

Going to push as commit 3742bc6.
Since your change was applied there have been 404 commits pushed to the master branch:

  • 099b744: 8326117: ProblemList serviceability/jvmti/vthread/SuspendWithInterruptLock/SuspendWithInterruptLock.java#default in Xcomp mode
  • 39627bc: 6510914: JScrollBar.getMinimumSize() breaks the contract of JComponent.setMinimumSize()
  • 7004c27: 8303972: (zipfs) Make test/jdk/jdk/nio/zipfs/TestLocOffsetFromZip64EF.java independent of the zip command line
  • c2d9fa2: 8326000: Remove obsolete comments for class sun.security.ssl.SunJSSE
  • f50df10: 8299023: TestPLABResize.java and TestPLABPromotion.java are failing intermittently
  • cf13086: 8317697: refactor-encapsulate x86 VM_Version::CpuidInfo
  • 3b76372: 8325687: SimpleJavaFileObject specification would benefit from implSpec
  • b5df2f4: 8323170: j2dbench is using outdated javac source/target to be able to build by itself
  • 267780b: 8324680: Replace NULL with nullptr in JVMTI generated code
  • f3073db: 8321408: Add Certainly roots R1 and E1
  • ... and 394 more: https://git.openjdk.org/jdk/compare/8abaf119659e46684d196bf76784c11587039f60...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Feb 19, 2024
@openjdk openjdk bot closed this Feb 19, 2024
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review delegated labels Feb 19, 2024
@openjdk
Copy link

openjdk bot commented Feb 19, 2024

@TobiHartmann Pushed as commit 3742bc6.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-compiler hotspot-compiler-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

3 participants