On Tue, 14 Jan 2025 19:12:45 GMT, Gerard Ziemski <gziem...@openjdk.org> wrote:

> 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.

@gerard-ziemski  we should not have a bunch of Java files for this in the 
hotspot source tree. Benchmarks should be in the test tree somewhere. Can this 
not be integrated into existing benchmark frameworks i.e. JMH?

-------------

PR Comment: https://git.openjdk.org/jdk/pull/23115#issuecomment-2597036137

Reply via email to