The dcmd "Compiler.perfmap" does not properly log information or errors in the dcmd output stream. They instead appear in stdout or stderr of the process the dcmd is running on. For example, if the file is not writable you will see the following:
j$ cmd 24089 Compiler.perfmap /x
24089:
Command executed successfully
Yet, it could not write to /x so the file is empty. If you look at the console for 24089 you see:
Java HotSpot(TM) 64-Bit Server VM warning: Cannot open file /x due to Permission denied
[1129077.636s][warning][codecache] Failed to create /x for perf map
This comes from the following code:
fileStream fs(filename, "w");
if (!fs.is_open()) {
log_warning(codecache)("Failed to create %s for perf map", filename);
return;
}
fileStream() produced the first warning to stderr, and the log_warning() output is going to stdout. Meanwhile the jcmd output shows no indication of the failure. One or both of these messages should have gone to the output stream of the dcmd.
PerfMapDCmd::execute calls CodeCache::write_perf_map(const char* filename), so write_perf_map is unaware of the outputStream* being used for the DiagnosticCommand, which is collecting output for the client. It might be necessary to make write_perf_map aware of which output stream errors and warning message should be going to.