RFR: 8314029: Add file name parameter to Compiler.perfmap [v5]
Chris Plummer
cjplummer at openjdk.org
Fri Dec 1 21:34:39 UTC 2023
On Tue, 28 Nov 2023 23:25:27 GMT, Yi-Fan Tsai <duke at openjdk.org> wrote:
>> `jcmd Compiler.perfmap` uses the hard-coded file name for a perf map: `/tmp/perf-%d.map`. This change adds an optional argument for specifying a file name.
>>
>> `jcmd PID help Compiler.perfmap` shows the following usage.
>>
>>
>> Compiler.perfmap
>> Write map file for Linux perf tool.
>>
>> Impact: Low
>>
>> Syntax : Compiler.perfmap [<filename>]
>>
>> Arguments:
>> filename : [optional] Name of the map file (STRING, no default value)
>>
>>
>> The man page of jcmd will be updated in a separate PR.
>
> Yi-Fan Tsai has updated the pull request incrementally with one additional commit since the last revision:
>
> Apply man changes
src/hotspot/share/code/codeCache.cpp line 1809:
> 1807: }
> 1808:
> 1809: void CodeCache::write_perf_map(const char* filename) {
Why not have a `filename == nullptr` indicate that the default should be used. Then you don't need CodeCache::DefaultPerfMapFile. You can just have a private `CodeCache::defaultPerfmapFileName()` method.
src/hotspot/share/code/codeCache.hpp line 232:
> 230: const char* name() const { return _name; }
> 231: };)
> 232:
Multi-line sections like this should really use `#ifdef LINUX`.
src/hotspot/share/runtime/java.cpp line 507:
> 505: if (DumpPerfMapAtExit) {
> 506: CodeCache::DefaultPerfMapFile file;
> 507: CodeCache::write_perf_map(file.name());
It's a bit inconsistent to support a user provided filename for the dcmd but not when using `DumpPerfMapAtExit`. Perhaps add `PerfMapFilename`. I'm not insisting, but something to consider. Would be good for the compiler team to comment on this.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15871#discussion_r1412585004
PR Review Comment: https://git.openjdk.org/jdk/pull/15871#discussion_r1412579044
PR Review Comment: https://git.openjdk.org/jdk/pull/15871#discussion_r1412582441
More information about the hotspot-dev
mailing list