Fri, 13 Sep 2013 04:16:54 -0700
8023134: Rename VM LogFile to hotspot_pid{pid}.log (was hotspot.log)
Reviewed-by: twisti, kvn, sla
1.1 --- a/src/share/tools/LogCompilation/README Thu Sep 12 18:13:28 2013 -0700 1.2 +++ b/src/share/tools/LogCompilation/README Fri Sep 13 04:16:54 2013 -0700 1.3 @@ -4,14 +4,14 @@ 1.4 requires a 1.5 JDK to build and simply typing make should build it. 1.5 1.6 It produces a jar file, logc.jar, that can be run on the 1.7 -hotspot.log from LogCompilation output like this: 1.8 +HotSpot log (by default, hotspot_pid{pid}.log) from LogCompilation output like this: 1.9 1.10 - java -jar logc.jar hotspot.log 1.11 + java -jar logc.jar hotspot_pid1234.log 1.12 1.13 This will produce something like the normal PrintCompilation output. 1.14 Adding the -i option with also report inlining like PrintInlining. 1.15 1.16 -More information about the LogCompilation output can be found at 1.17 +More information about the LogCompilation output can be found at 1.18 1.19 https://wikis.oracle.com/display/HotSpotInternals/LogCompilation+overview 1.20 https://wikis.oracle.com/display/HotSpotInternals/PrintCompilation
2.1 --- a/src/share/vm/runtime/arguments.cpp Thu Sep 12 18:13:28 2013 -0700 2.2 +++ b/src/share/vm/runtime/arguments.cpp Fri Sep 13 04:16:54 2013 -0700 2.3 @@ -3337,6 +3337,33 @@ 2.4 return shared_archive_path; 2.5 } 2.6 2.7 +#ifndef PRODUCT 2.8 +// Determine whether LogVMOutput should be implicitly turned on. 2.9 +static bool use_vm_log() { 2.10 + if (LogCompilation || !FLAG_IS_DEFAULT(LogFile) || 2.11 + PrintCompilation || PrintInlining || PrintDependencies || PrintNativeNMethods || 2.12 + PrintDebugInfo || PrintRelocations || PrintNMethods || PrintExceptionHandlers || 2.13 + PrintAssembly || TraceDeoptimization || TraceDependencies || 2.14 + (VerifyDependencies && FLAG_IS_CMDLINE(VerifyDependencies))) { 2.15 + return true; 2.16 + } 2.17 + 2.18 +#ifdef COMPILER1 2.19 + if (PrintC1Statistics) { 2.20 + return true; 2.21 + } 2.22 +#endif // COMPILER1 2.23 + 2.24 +#ifdef COMPILER2 2.25 + if (PrintOptoAssembly || PrintOptoStatistics) { 2.26 + return true; 2.27 + } 2.28 +#endif // COMPILER2 2.29 + 2.30 + return false; 2.31 +} 2.32 +#endif // PRODUCT 2.33 + 2.34 // Parse entry point called from JNI_CreateJavaVM 2.35 2.36 jint Arguments::parse(const JavaVMInitArgs* args) { 2.37 @@ -3630,7 +3657,13 @@ 2.38 NmethodSweepFraction = 1; 2.39 } 2.40 } 2.41 -#endif 2.42 + 2.43 + if (!LogVMOutput && FLAG_IS_DEFAULT(LogVMOutput)) { 2.44 + if (use_vm_log()) { 2.45 + LogVMOutput = true; 2.46 + } 2.47 + } 2.48 +#endif // PRODUCT 2.49 2.50 if (PrintCommandLineFlags) { 2.51 CommandLineFlags::printSetFlags(tty);
3.1 --- a/src/share/vm/runtime/deoptimization.cpp Thu Sep 12 18:13:28 2013 -0700 3.2 +++ b/src/share/vm/runtime/deoptimization.cpp Fri Sep 13 04:16:54 2013 -0700 3.3 @@ -1751,7 +1751,7 @@ 3.4 else return trap_state & ~DS_RECOMPILE_BIT; 3.5 } 3.6 //---------------------------format_trap_state--------------------------------- 3.7 -// This is used for debugging and diagnostics, including hotspot.log output. 3.8 +// This is used for debugging and diagnostics, including LogFile output. 3.9 const char* Deoptimization::format_trap_state(char* buf, size_t buflen, 3.10 int trap_state) { 3.11 DeoptReason reason = trap_state_reason(trap_state); 3.12 @@ -1828,7 +1828,7 @@ 3.13 return buf; 3.14 } 3.15 3.16 -// This is used for debugging and diagnostics, including hotspot.log output. 3.17 +// This is used for debugging and diagnostics, including LogFile output. 3.18 const char* Deoptimization::format_trap_request(char* buf, size_t buflen, 3.19 int trap_request) { 3.20 jint unloaded_class_index = trap_request_index(trap_request);
4.1 --- a/src/share/vm/runtime/globals.hpp Thu Sep 12 18:13:28 2013 -0700 4.2 +++ b/src/share/vm/runtime/globals.hpp Fri Sep 13 04:16:54 2013 -0700 4.3 @@ -880,7 +880,7 @@ 4.4 "stay alive at the expense of JVM performance") \ 4.5 \ 4.6 diagnostic(bool, LogCompilation, false, \ 4.7 - "Log compilation activity in detail to hotspot.log or LogFile") \ 4.8 + "Log compilation activity in detail to LogFile") \ 4.9 \ 4.10 product(bool, PrintCompilation, false, \ 4.11 "Print compilations") \ 4.12 @@ -2498,16 +2498,17 @@ 4.13 "Print all VM flags with default values and descriptions and exit")\ 4.14 \ 4.15 diagnostic(bool, SerializeVMOutput, true, \ 4.16 - "Use a mutex to serialize output to tty and hotspot.log") \ 4.17 + "Use a mutex to serialize output to tty and LogFile") \ 4.18 \ 4.19 diagnostic(bool, DisplayVMOutput, true, \ 4.20 "Display all VM output on the tty, independently of LogVMOutput") \ 4.21 \ 4.22 - diagnostic(bool, LogVMOutput, trueInDebug, \ 4.23 - "Save VM output to hotspot.log, or to LogFile") \ 4.24 + diagnostic(bool, LogVMOutput, false, \ 4.25 + "Save VM output to LogFile") \ 4.26 \ 4.27 diagnostic(ccstr, LogFile, NULL, \ 4.28 - "If LogVMOutput is on, save VM output to this file [hotspot.log]") \ 4.29 + "If LogVMOutput or LogCompilation is on, save VM output to " \ 4.30 + "this file [default: ./hotspot_pid%p.log] (%p replaced with pid)") \ 4.31 \ 4.32 product(ccstr, ErrorFile, NULL, \ 4.33 "If an error occurs, save the error data to this file " \
5.1 --- a/src/share/vm/utilities/ostream.cpp Thu Sep 12 18:13:28 2013 -0700 5.2 +++ b/src/share/vm/utilities/ostream.cpp Fri Sep 13 04:16:54 2013 -0700 5.3 @@ -592,7 +592,7 @@ 5.4 5.5 void defaultStream::init_log() { 5.6 // %%% Need a MutexLocker? 5.7 - const char* log_name = LogFile != NULL ? LogFile : "hotspot.log"; 5.8 + const char* log_name = LogFile != NULL ? LogFile : "hotspot_pid%p.log"; 5.9 const char* try_name = make_log_name(log_name, NULL); 5.10 fileStream* file = new(ResourceObj::C_HEAP, mtInternal) fileStream(try_name); 5.11 if (!file->is_open()) { 5.12 @@ -603,14 +603,15 @@ 5.13 // Note: This feature is for maintainer use only. No need for L10N. 5.14 jio_print(warnbuf); 5.15 FREE_C_HEAP_ARRAY(char, try_name, mtInternal); 5.16 - try_name = make_log_name("hs_pid%p.log", os::get_temp_directory()); 5.17 + try_name = make_log_name(log_name, os::get_temp_directory()); 5.18 jio_snprintf(warnbuf, sizeof(warnbuf), 5.19 "Warning: Forcing option -XX:LogFile=%s\n", try_name); 5.20 jio_print(warnbuf); 5.21 delete file; 5.22 file = new(ResourceObj::C_HEAP, mtInternal) fileStream(try_name); 5.23 - FREE_C_HEAP_ARRAY(char, try_name, mtInternal); 5.24 } 5.25 + FREE_C_HEAP_ARRAY(char, try_name, mtInternal); 5.26 + 5.27 if (file->is_open()) { 5.28 _log_file = file; 5.29 xmlStream* xs = new(ResourceObj::C_HEAP, mtInternal) xmlStream(file);