mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8023134: Rename VM LogFile to hotspot_pid{pid}.log (was hotspot.log)
Reviewed-by: twisti, kvn, sla
This commit is contained in:
parent
f2a19eaddb
commit
13d322d70f
5 changed files with 49 additions and 14 deletions
|
@ -4,9 +4,9 @@ It's main purpose is to recreate output similar to
|
|||
requires a 1.5 JDK to build and simply typing make should build it.
|
||||
|
||||
It produces a jar file, logc.jar, that can be run on the
|
||||
hotspot.log from LogCompilation output like this:
|
||||
HotSpot log (by default, hotspot_pid{pid}.log) from LogCompilation output like this:
|
||||
|
||||
java -jar logc.jar hotspot.log
|
||||
java -jar logc.jar hotspot_pid1234.log
|
||||
|
||||
This will produce something like the normal PrintCompilation output.
|
||||
Adding the -i option with also report inlining like PrintInlining.
|
||||
|
|
|
@ -3337,6 +3337,33 @@ static char* get_shared_archive_path() {
|
|||
return shared_archive_path;
|
||||
}
|
||||
|
||||
#ifndef PRODUCT
|
||||
// Determine whether LogVMOutput should be implicitly turned on.
|
||||
static bool use_vm_log() {
|
||||
if (LogCompilation || !FLAG_IS_DEFAULT(LogFile) ||
|
||||
PrintCompilation || PrintInlining || PrintDependencies || PrintNativeNMethods ||
|
||||
PrintDebugInfo || PrintRelocations || PrintNMethods || PrintExceptionHandlers ||
|
||||
PrintAssembly || TraceDeoptimization || TraceDependencies ||
|
||||
(VerifyDependencies && FLAG_IS_CMDLINE(VerifyDependencies))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef COMPILER1
|
||||
if (PrintC1Statistics) {
|
||||
return true;
|
||||
}
|
||||
#endif // COMPILER1
|
||||
|
||||
#ifdef COMPILER2
|
||||
if (PrintOptoAssembly || PrintOptoStatistics) {
|
||||
return true;
|
||||
}
|
||||
#endif // COMPILER2
|
||||
|
||||
return false;
|
||||
}
|
||||
#endif // PRODUCT
|
||||
|
||||
// Parse entry point called from JNI_CreateJavaVM
|
||||
|
||||
jint Arguments::parse(const JavaVMInitArgs* args) {
|
||||
|
@ -3630,7 +3657,13 @@ jint Arguments::parse(const JavaVMInitArgs* args) {
|
|||
NmethodSweepFraction = 1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!LogVMOutput && FLAG_IS_DEFAULT(LogVMOutput)) {
|
||||
if (use_vm_log()) {
|
||||
LogVMOutput = true;
|
||||
}
|
||||
}
|
||||
#endif // PRODUCT
|
||||
|
||||
if (PrintCommandLineFlags) {
|
||||
CommandLineFlags::printSetFlags(tty);
|
||||
|
|
|
@ -1751,7 +1751,7 @@ int Deoptimization::trap_state_set_recompiled(int trap_state, bool z) {
|
|||
else return trap_state & ~DS_RECOMPILE_BIT;
|
||||
}
|
||||
//---------------------------format_trap_state---------------------------------
|
||||
// This is used for debugging and diagnostics, including hotspot.log output.
|
||||
// This is used for debugging and diagnostics, including LogFile output.
|
||||
const char* Deoptimization::format_trap_state(char* buf, size_t buflen,
|
||||
int trap_state) {
|
||||
DeoptReason reason = trap_state_reason(trap_state);
|
||||
|
@ -1828,7 +1828,7 @@ const char* Deoptimization::trap_action_name(int action) {
|
|||
return buf;
|
||||
}
|
||||
|
||||
// This is used for debugging and diagnostics, including hotspot.log output.
|
||||
// This is used for debugging and diagnostics, including LogFile output.
|
||||
const char* Deoptimization::format_trap_request(char* buf, size_t buflen,
|
||||
int trap_request) {
|
||||
jint unloaded_class_index = trap_request_index(trap_request);
|
||||
|
|
|
@ -880,7 +880,7 @@ class CommandLineFlags {
|
|||
"stay alive at the expense of JVM performance") \
|
||||
\
|
||||
diagnostic(bool, LogCompilation, false, \
|
||||
"Log compilation activity in detail to hotspot.log or LogFile") \
|
||||
"Log compilation activity in detail to LogFile") \
|
||||
\
|
||||
product(bool, PrintCompilation, false, \
|
||||
"Print compilations") \
|
||||
|
@ -2498,16 +2498,17 @@ class CommandLineFlags {
|
|||
"Print all VM flags with default values and descriptions and exit")\
|
||||
\
|
||||
diagnostic(bool, SerializeVMOutput, true, \
|
||||
"Use a mutex to serialize output to tty and hotspot.log") \
|
||||
"Use a mutex to serialize output to tty and LogFile") \
|
||||
\
|
||||
diagnostic(bool, DisplayVMOutput, true, \
|
||||
"Display all VM output on the tty, independently of LogVMOutput") \
|
||||
\
|
||||
diagnostic(bool, LogVMOutput, trueInDebug, \
|
||||
"Save VM output to hotspot.log, or to LogFile") \
|
||||
diagnostic(bool, LogVMOutput, false, \
|
||||
"Save VM output to LogFile") \
|
||||
\
|
||||
diagnostic(ccstr, LogFile, NULL, \
|
||||
"If LogVMOutput is on, save VM output to this file [hotspot.log]") \
|
||||
"If LogVMOutput or LogCompilation is on, save VM output to " \
|
||||
"this file [default: ./hotspot_pid%p.log] (%p replaced with pid)") \
|
||||
\
|
||||
product(ccstr, ErrorFile, NULL, \
|
||||
"If an error occurs, save the error data to this file " \
|
||||
|
|
|
@ -592,7 +592,7 @@ static const char* make_log_name(const char* log_name, const char* force_directo
|
|||
|
||||
void defaultStream::init_log() {
|
||||
// %%% Need a MutexLocker?
|
||||
const char* log_name = LogFile != NULL ? LogFile : "hotspot.log";
|
||||
const char* log_name = LogFile != NULL ? LogFile : "hotspot_pid%p.log";
|
||||
const char* try_name = make_log_name(log_name, NULL);
|
||||
fileStream* file = new(ResourceObj::C_HEAP, mtInternal) fileStream(try_name);
|
||||
if (!file->is_open()) {
|
||||
|
@ -603,14 +603,15 @@ void defaultStream::init_log() {
|
|||
// Note: This feature is for maintainer use only. No need for L10N.
|
||||
jio_print(warnbuf);
|
||||
FREE_C_HEAP_ARRAY(char, try_name, mtInternal);
|
||||
try_name = make_log_name("hs_pid%p.log", os::get_temp_directory());
|
||||
try_name = make_log_name(log_name, os::get_temp_directory());
|
||||
jio_snprintf(warnbuf, sizeof(warnbuf),
|
||||
"Warning: Forcing option -XX:LogFile=%s\n", try_name);
|
||||
jio_print(warnbuf);
|
||||
delete file;
|
||||
file = new(ResourceObj::C_HEAP, mtInternal) fileStream(try_name);
|
||||
FREE_C_HEAP_ARRAY(char, try_name, mtInternal);
|
||||
}
|
||||
FREE_C_HEAP_ARRAY(char, try_name, mtInternal);
|
||||
|
||||
if (file->is_open()) {
|
||||
_log_file = file;
|
||||
xmlStream* xs = new(ResourceObj::C_HEAP, mtInternal) xmlStream(file);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue