< prev index next >

src/hotspot/share/compiler/compilationLog.cpp

Print this page

27 #include "compiler/compileTask.hpp"
28 #include "logging/log.hpp"
29 #include "memory/resourceArea.hpp"
30 #include "runtime/thread.hpp"
31 #include "utilities/ostream.hpp"
32 
33 CompilationLog* CompilationLog::_log;
34 
35 CompilationLog::CompilationLog() : StringEventLog("Compilation events", "jit") {
36 }
37 
38 void CompilationLog::log_compile(JavaThread* thread, CompileTask* task) {
39   StringLogMessage lm;
40   stringStream sstr(lm.buffer(), lm.size());
41   // msg.time_stamp().update_to(tty->time_stamp().ticks());
42   task->print(&sstr, nullptr, true, false);
43   log(thread, "%s", (const char*)lm);
44 }
45 
46 void CompilationLog::log_nmethod(JavaThread* thread, nmethod* nm) {
47   log(thread, "nmethod %d%s " INTPTR_FORMAT " code [" INTPTR_FORMAT ", " INTPTR_FORMAT "]",
48       nm->compile_id(), nm->is_osr_method() ? "%" : "",
49       p2i(nm), p2i(nm->code_begin()), p2i(nm->code_end()));
50 }
51 
52 void CompilationLog::log_failure(JavaThread* thread, CompileTask* task, const char* reason, const char* retry_message) {
53   StringLogMessage lm;
54   if (task == nullptr) {
55     lm.print("Id not known, task was 0;  COMPILE SKIPPED: %s", reason);
56   } else {
57     lm.print("%4d   COMPILE SKIPPED: %s", task->compile_id(), reason);
58   }
59   if (retry_message != nullptr) {
60     lm.append(" (%s)", retry_message);
61   }
62   lm.print("\n");
63   log(thread, "%s", (const char*)lm);
64 }
65 
66 void CompilationLog::log_metaspace_failure(const char* reason) {
67   // Note: This method can be called from non-Java/compiler threads to
68   // log the global metaspace failure that might affect profiling.

27 #include "compiler/compileTask.hpp"
28 #include "logging/log.hpp"
29 #include "memory/resourceArea.hpp"
30 #include "runtime/thread.hpp"
31 #include "utilities/ostream.hpp"
32 
33 CompilationLog* CompilationLog::_log;
34 
35 CompilationLog::CompilationLog() : StringEventLog("Compilation events", "jit") {
36 }
37 
38 void CompilationLog::log_compile(JavaThread* thread, CompileTask* task) {
39   StringLogMessage lm;
40   stringStream sstr(lm.buffer(), lm.size());
41   // msg.time_stamp().update_to(tty->time_stamp().ticks());
42   task->print(&sstr, nullptr, true, false);
43   log(thread, "%s", (const char*)lm);
44 }
45 
46 void CompilationLog::log_nmethod(JavaThread* thread, nmethod* nm) {
47   log(thread, "nmethod %d %s " INTPTR_FORMAT " code [" INTPTR_FORMAT ", " INTPTR_FORMAT "]",
48       nm->compile_id(), nm->compile_kind(),
49       p2i(nm), p2i(nm->code_begin()), p2i(nm->code_end()));
50 }
51 
52 void CompilationLog::log_failure(JavaThread* thread, CompileTask* task, const char* reason, const char* retry_message) {
53   StringLogMessage lm;
54   if (task == nullptr) {
55     lm.print("Id not known, task was 0;  COMPILE SKIPPED: %s", reason);
56   } else {
57     lm.print("%4d   COMPILE SKIPPED: %s", task->compile_id(), reason);
58   }
59   if (retry_message != nullptr) {
60     lm.append(" (%s)", retry_message);
61   }
62   lm.print("\n");
63   log(thread, "%s", (const char*)lm);
64 }
65 
66 void CompilationLog::log_metaspace_failure(const char* reason) {
67   // Note: This method can be called from non-Java/compiler threads to
68   // log the global metaspace failure that might affect profiling.
< prev index next >