RFR: 8317453: NMT: Performance benchmarks are needed to measure speed and memory
Gerard Ziemski
gziemski at openjdk.org
Tue Jan 14 20:53:33 UTC 2025
Here is another, hopefully, closer to the final iteration of NMT benchmarking mechanism.
To use, you first need to record the pattern of operations, ex:
`./build/macosx-aarch64-server-release/xcode/build/jdk/bin/java -XX:+UnlockDiagnosticVMOptions -XX:NMTRecordMemoryAllocations=0x7FFFFFFF -jar build/macosx-aarch64-server-release/images/jdk/demo/jfc/J2Ddemo/J2Ddemo.jar`
This will run the target app, and log all the allocations in chronological order. This will produce a few files:
- hs_nmt_pid22770_allocs_record.log (is the chronological record of the the desired operations)
- hs_nmt_pid22770_info_record.log (is the record of default NMT memory overhead and the NMT state)
- hs_nmt_pid22770_threads_record.log (is the record of thread names that can be retrieved later when processing)
Now you can use those recording to actually benchmark your proposed changes, ex:
`./build/macosx-aarch64-server-release/xcode/build/jdk/bin/java -XX:+UnlockDiagnosticVMOptions -XX:NMTBenchmarkRecordedPID=22770 -XX:NMTBenchmarkRecordedLoops=10`
Which will produce yet another file:
- hs_nmt_pid23527_benchmark.log
that contains the details of the session, which can be further processed and analyzed by a tool, such as the one in jdk/src/utils/nmt, however, if you are looking just for one performance number look for `time:2744190[ns] [samples:115263]` in the output.
The total time for this particular run is 2,744,190 nanosecond or ~2.7 seconds, which you can use to compare `before` and `after` your change.
-------------
Commit messages:
- white spaces
- white spaces
- white spaces
- white spaces
- win and linux APIs
- more consistent output when benchmarking
- remove exec flag
- NMT benchmark
Changes: https://git.openjdk.org/jdk/pull/23115/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=23115&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8317453
Stats: 3522 lines in 30 files changed: 3518 ins; 0 del; 4 mod
Patch: https://git.openjdk.org/jdk/pull/23115.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/23115/head:pull/23115
PR: https://git.openjdk.org/jdk/pull/23115
More information about the hotspot-dev
mailing list