OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/log.h" | 5 #include "src/log.h" |
6 | 6 |
7 #include <cstdarg> | 7 #include <cstdarg> |
8 #include <memory> | 8 #include <memory> |
9 #include <sstream> | 9 #include <sstream> |
10 | 10 |
(...skipping 1231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1242 | 1242 |
1243 | 1243 |
1244 void Logger::HeapSampleItemEvent(const char* type, int number, int bytes) { | 1244 void Logger::HeapSampleItemEvent(const char* type, int number, int bytes) { |
1245 if (!log_->IsEnabled() || !FLAG_log_gc) return; | 1245 if (!log_->IsEnabled() || !FLAG_log_gc) return; |
1246 Log::MessageBuilder msg(log_); | 1246 Log::MessageBuilder msg(log_); |
1247 msg.Append("heap-sample-item,%s,%d,%d", type, number, bytes); | 1247 msg.Append("heap-sample-item,%s,%d,%d", type, number, bytes); |
1248 msg.WriteToLogFile(); | 1248 msg.WriteToLogFile(); |
1249 } | 1249 } |
1250 | 1250 |
1251 | 1251 |
1252 void Logger::DebugTag(const char* call_site_tag) { | |
1253 if (!log_->IsEnabled() || !FLAG_log) return; | |
1254 Log::MessageBuilder msg(log_); | |
1255 msg.Append("debug-tag,%s", call_site_tag); | |
1256 msg.WriteToLogFile(); | |
1257 } | |
1258 | |
1259 | |
1260 void Logger::DebugEvent(const char* event_type, Vector<uint16_t> parameter) { | |
1261 if (!log_->IsEnabled() || !FLAG_log) return; | |
1262 StringBuilder s(parameter.length() + 1); | |
1263 for (int i = 0; i < parameter.length(); ++i) { | |
1264 s.AddCharacter(static_cast<char>(parameter[i])); | |
1265 } | |
1266 char* parameter_string = s.Finalize(); | |
1267 Log::MessageBuilder msg(log_); | |
1268 msg.Append("debug-queue-event,%s,%15.3f,%s", event_type, | |
1269 base::OS::TimeCurrentMillis(), parameter_string); | |
1270 DeleteArray(parameter_string); | |
1271 msg.WriteToLogFile(); | |
1272 } | |
1273 | |
1274 void Logger::RuntimeCallTimerEvent() { | 1252 void Logger::RuntimeCallTimerEvent() { |
1275 RuntimeCallStats* stats = isolate_->counters()->runtime_call_stats(); | 1253 RuntimeCallStats* stats = isolate_->counters()->runtime_call_stats(); |
1276 RuntimeCallTimer* timer = stats->current_timer(); | 1254 RuntimeCallTimer* timer = stats->current_timer(); |
1277 if (timer == nullptr) return; | 1255 if (timer == nullptr) return; |
1278 RuntimeCallCounter* counter = timer->counter(); | 1256 RuntimeCallCounter* counter = timer->counter(); |
1279 if (counter == nullptr) return; | 1257 if (counter == nullptr) return; |
1280 Log::MessageBuilder msg(log_); | 1258 Log::MessageBuilder msg(log_); |
1281 msg.Append("active-runtime-timer,"); | 1259 msg.Append("active-runtime-timer,"); |
1282 msg.AppendDoubleQuotedString(counter->name()); | 1260 msg.AppendDoubleQuotedString(counter->name()); |
1283 msg.WriteToLogFile(); | 1261 msg.WriteToLogFile(); |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1797 | 1775 |
1798 if (profiler_listener_.get() != nullptr) { | 1776 if (profiler_listener_.get() != nullptr) { |
1799 removeCodeEventListener(profiler_listener_.get()); | 1777 removeCodeEventListener(profiler_listener_.get()); |
1800 } | 1778 } |
1801 | 1779 |
1802 return log_->Close(); | 1780 return log_->Close(); |
1803 } | 1781 } |
1804 | 1782 |
1805 } // namespace internal | 1783 } // namespace internal |
1806 } // namespace v8 | 1784 } // namespace v8 |
OLD | NEW |