Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Unified Diff: src/log.cc

Issue 2753543006: [profiler] Web UI: add summary of opts/deopts. (Closed)
Patch Set: Address reviewer comments Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/log.h ('k') | src/profiler/profiler-listener.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/log.cc
diff --git a/src/log.cc b/src/log.cc
index 46872a150c48259ca932d7c6e06f1e70a89cc483..d32ce1aa8ea1e8bd78d7b61c5a5a126506119b3e 100644
--- a/src/log.cc
+++ b/src/log.cc
@@ -843,12 +843,41 @@ void Logger::SharedLibraryEvent(const std::string& library_path,
msg.WriteToLogFile();
}
-
-void Logger::CodeDeoptEvent(Code* code, Address pc, int fp_to_sp_delta) {
- if (!log_->IsEnabled() || !FLAG_log_internal_timer_events) return;
+void Logger::CodeDeoptEvent(Code* code, DeoptKind kind, Address pc,
+ int fp_to_sp_delta) {
+ if (!log_->IsEnabled()) return;
+ Deoptimizer::DeoptInfo info = Deoptimizer::GetDeoptInfo(code, pc);
Log::MessageBuilder msg(log_);
int since_epoch = static_cast<int>(timer_.Elapsed().InMicroseconds());
- msg.Append("code-deopt,%d,%d", since_epoch, code->CodeSize());
+ msg.Append("code-deopt,%d,%d,", since_epoch, code->CodeSize());
+ msg.AppendAddress(code->address());
+
+ // Deoptimization position.
+ std::ostringstream deopt_location;
+ int inlining_id = -1;
+ int script_offset = -1;
+ if (info.position.IsKnown()) {
+ info.position.Print(deopt_location, code);
+ inlining_id = info.position.InliningId();
+ script_offset = info.position.ScriptOffset();
+ } else {
+ deopt_location << "<unknown>";
+ }
+ msg.Append(",%d,%d,", inlining_id, script_offset);
+ switch (kind) {
+ case kLazy:
+ msg.Append("\"lazy\",");
+ break;
+ case kSoft:
+ msg.Append("\"soft\",");
+ break;
+ case kEager:
+ msg.Append("\"eager\",");
+ break;
+ }
+ msg.AppendDoubleQuotedString(deopt_location.str().c_str());
+ msg.Append(",");
+ msg.AppendDoubleQuotedString(DeoptimizeReasonToString(info.deopt_reason));
msg.WriteToLogFile();
}
@@ -972,6 +1001,10 @@ void Logger::CallbackEventInternal(const char* prefix, Name* name,
msg.Append("%s,%s,-2,",
kLogEventsNames[CodeEventListener::CODE_CREATION_EVENT],
kLogEventsNames[CodeEventListener::CALLBACK_TAG]);
+ int timestamp = timer_.IsStarted()
+ ? static_cast<int>(timer_.Elapsed().InMicroseconds())
+ : -1;
+ msg.Append("%d,", timestamp);
msg.AppendAddress(entry_point);
if (name->IsString()) {
std::unique_ptr<char[]> str =
@@ -1007,23 +1040,31 @@ void Logger::SetterCallbackEvent(Name* name, Address entry_point) {
CallbackEventInternal("set ", name, entry_point);
}
-static void AppendCodeCreateHeader(Log::MessageBuilder* msg,
- CodeEventListener::LogEventsAndTags tag,
- AbstractCode* code) {
+namespace {
+
+void AppendCodeCreateHeader(Log::MessageBuilder* msg,
+ CodeEventListener::LogEventsAndTags tag,
+ AbstractCode* code, base::ElapsedTimer* timer) {
DCHECK(msg);
msg->Append("%s,%s,%d,",
kLogEventsNames[CodeEventListener::CODE_CREATION_EVENT],
kLogEventsNames[tag], code->kind());
+ int timestamp = timer->IsStarted()
+ ? static_cast<int>(timer->Elapsed().InMicroseconds())
+ : -1;
+ msg->Append("%d,", timestamp);
msg->AppendAddress(code->address());
msg->Append(",%d,", code->ExecutableSize());
}
+} // namespace
+
void Logger::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag,
AbstractCode* code, const char* comment) {
if (!is_logging_code_events()) return;
if (!FLAG_log_code || !log_->IsEnabled()) return;
Log::MessageBuilder msg(log_);
- AppendCodeCreateHeader(&msg, tag, code);
+ AppendCodeCreateHeader(&msg, tag, code, &timer_);
msg.AppendDoubleQuotedString(comment);
msg.WriteToLogFile();
}
@@ -1033,7 +1074,7 @@ void Logger::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag,
if (!is_logging_code_events()) return;
if (!FLAG_log_code || !log_->IsEnabled()) return;
Log::MessageBuilder msg(log_);
- AppendCodeCreateHeader(&msg, tag, code);
+ AppendCodeCreateHeader(&msg, tag, code, &timer_);
if (name->IsString()) {
msg.Append('"');
msg.AppendDetailed(String::cast(name), false);
@@ -1055,7 +1096,7 @@ void Logger::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag,
}
Log::MessageBuilder msg(log_);
- AppendCodeCreateHeader(&msg, tag, code);
+ AppendCodeCreateHeader(&msg, tag, code, &timer_);
if (name->IsString()) {
std::unique_ptr<char[]> str =
String::cast(name)->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
@@ -1079,7 +1120,7 @@ void Logger::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag,
if (!is_logging_code_events()) return;
if (!FLAG_log_code || !log_->IsEnabled()) return;
Log::MessageBuilder msg(log_);
- AppendCodeCreateHeader(&msg, tag, code);
+ AppendCodeCreateHeader(&msg, tag, code, &timer_);
std::unique_ptr<char[]> name =
shared->DebugName()->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
msg.Append("\"%s ", name.get());
@@ -1101,7 +1142,7 @@ void Logger::CodeCreateEvent(CodeEventListener::LogEventsAndTags tag,
if (!is_logging_code_events()) return;
if (!FLAG_log_code || !log_->IsEnabled()) return;
Log::MessageBuilder msg(log_);
- AppendCodeCreateHeader(&msg, tag, code);
+ AppendCodeCreateHeader(&msg, tag, code, &timer_);
msg.Append("\"args_count: %d\"", args_count);
msg.WriteToLogFile();
}
@@ -1130,7 +1171,7 @@ void Logger::RegExpCodeCreateEvent(AbstractCode* code, String* source) {
if (!is_logging_code_events()) return;
if (!FLAG_log_code || !log_->IsEnabled()) return;
Log::MessageBuilder msg(log_);
- AppendCodeCreateHeader(&msg, CodeEventListener::REG_EXP_TAG, code);
+ AppendCodeCreateHeader(&msg, CodeEventListener::REG_EXP_TAG, code, &timer_);
msg.Append('"');
msg.AppendDetailed(source, false);
msg.Append('"');
« no previous file with comments | « src/log.h ('k') | src/profiler/profiler-listener.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698