| OLD | NEW | 
|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium 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 "base/debug/trace_event_impl.h" | 5 #include "base/debug/trace_event_impl.h" | 
| 6 | 6 | 
| 7 #include <algorithm> | 7 #include <algorithm> | 
| 8 | 8 | 
| 9 #include "base/base_switches.h" | 9 #include "base/base_switches.h" | 
| 10 #include "base/bind.h" | 10 #include "base/bind.h" | 
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 51 | 51 | 
| 52 namespace base { | 52 namespace base { | 
| 53 namespace debug { | 53 namespace debug { | 
| 54 | 54 | 
| 55 namespace { | 55 namespace { | 
| 56 | 56 | 
| 57 // The overhead of TraceEvent above this threshold will be reported in the | 57 // The overhead of TraceEvent above this threshold will be reported in the | 
| 58 // trace. | 58 // trace. | 
| 59 const int kOverheadReportThresholdInMicroseconds = 50; | 59 const int kOverheadReportThresholdInMicroseconds = 50; | 
| 60 | 60 | 
|  | 61 // String options that can be used to initialize TraceOptions. | 
|  | 62 const char kRecordUntilFull[] = "record-until-full"; | 
|  | 63 const char kRecordContinuously[] = "record-continuously"; | 
|  | 64 const char kTraceToConsole[] = "trace-to-console"; | 
|  | 65 const char kEnableSampling[] = "enable-sampling"; | 
|  | 66 const char kEnableSystrace[] = "enable-systrace"; | 
|  | 67 | 
| 61 // Controls the number of trace events we will buffer in-memory | 68 // Controls the number of trace events we will buffer in-memory | 
| 62 // before throwing them away. | 69 // before throwing them away. | 
| 63 const size_t kTraceBufferChunkSize = TraceBufferChunk::kTraceBufferChunkSize; | 70 const size_t kTraceBufferChunkSize = TraceBufferChunk::kTraceBufferChunkSize; | 
| 64 const size_t kTraceEventVectorBufferChunks = 256000 / kTraceBufferChunkSize; | 71 const size_t kTraceEventVectorBufferChunks = 256000 / kTraceBufferChunkSize; | 
| 65 const size_t kTraceEventRingBufferChunks = kTraceEventVectorBufferChunks / 4; | 72 const size_t kTraceEventRingBufferChunks = kTraceEventVectorBufferChunks / 4; | 
| 66 const size_t kTraceEventBatchChunks = 1000 / kTraceBufferChunkSize; | 73 const size_t kTraceEventBatchChunks = 1000 / kTraceBufferChunkSize; | 
| 67 // Can store results for 30 seconds with 1 ms sampling interval. | 74 // Can store results for 30 seconds with 1 ms sampling interval. | 
| 68 const size_t kMonitorTraceEventBufferChunks = 30000 / kTraceBufferChunkSize; | 75 const size_t kMonitorTraceEventBufferChunks = 30000 / kTraceBufferChunkSize; | 
| 69 // ECHO_TO_CONSOLE needs a small buffer to hold the unfinished COMPLETE events. | 76 // ECHO_TO_CONSOLE needs a small buffer to hold the unfinished COMPLETE events. | 
| 70 const size_t kEchoToConsoleTraceEventBufferChunks = 256; | 77 const size_t kEchoToConsoleTraceEventBufferChunks = 256; | 
| (...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 963     : bucket(bucket), | 970     : bucket(bucket), | 
| 964       bucket_name(name), | 971       bucket_name(name), | 
| 965       callback(callback) { | 972       callback(callback) { | 
| 966 } | 973 } | 
| 967 | 974 | 
| 968 TraceBucketData::~TraceBucketData() { | 975 TraceBucketData::~TraceBucketData() { | 
| 969 } | 976 } | 
| 970 | 977 | 
| 971 //////////////////////////////////////////////////////////////////////////////// | 978 //////////////////////////////////////////////////////////////////////////////// | 
| 972 // | 979 // | 
|  | 980 // TraceOptions | 
|  | 981 // | 
|  | 982 //////////////////////////////////////////////////////////////////////////////// | 
|  | 983 | 
|  | 984 TraceOptions::TraceOptions(const std::string& options_string) | 
|  | 985     : record_mode(RECORD_UNTIL_FULL), | 
|  | 986       enable_sampling(false), | 
|  | 987       enable_systrace(false) { | 
|  | 988   std::vector<std::string> split; | 
|  | 989   std::vector<std::string>::iterator iter; | 
|  | 990 | 
|  | 991   base::SplitString(options_string, ',', &split); | 
|  | 992   for (iter = split.begin(); iter != split.end(); ++iter) { | 
|  | 993     if (*iter == kRecordUntilFull) { | 
|  | 994       record_mode = RECORD_UNTIL_FULL; | 
|  | 995     } else if (*iter == kRecordContinuously) { | 
|  | 996       record_mode = RECORD_CONTINUOUSLY; | 
|  | 997     } else if (*iter == kTraceToConsole) { | 
|  | 998       record_mode = ECHO_TO_CONSOLE; | 
|  | 999     } else if (*iter == kEnableSampling) { | 
|  | 1000       enable_sampling = true; | 
|  | 1001     } else if (*iter == kEnableSystrace) { | 
|  | 1002       enable_systrace = true; | 
|  | 1003     } else { | 
|  | 1004       NOTREACHED(); | 
|  | 1005     } | 
|  | 1006   } | 
|  | 1007 } | 
|  | 1008 | 
|  | 1009 std::string TraceOptions::ToString() const { | 
|  | 1010   std::string ret; | 
|  | 1011   switch (record_mode) { | 
|  | 1012     case RECORD_UNTIL_FULL: | 
|  | 1013       ret = kRecordUntilFull; | 
|  | 1014       break; | 
|  | 1015     case RECORD_CONTINUOUSLY: | 
|  | 1016       ret = kRecordContinuously; | 
|  | 1017       break; | 
|  | 1018     case ECHO_TO_CONSOLE: | 
|  | 1019       ret = kTraceToConsole; | 
|  | 1020       break; | 
|  | 1021     default: | 
|  | 1022       NOTREACHED(); | 
|  | 1023   } | 
|  | 1024   if (enable_sampling) | 
|  | 1025     ret = ret + "," + kEnableSampling; | 
|  | 1026   if (enable_systrace) | 
|  | 1027     ret = ret + "," + kEnableSystrace; | 
|  | 1028   return ret; | 
|  | 1029 } | 
|  | 1030 | 
|  | 1031 //////////////////////////////////////////////////////////////////////////////// | 
|  | 1032 // | 
| 973 // TraceLog | 1033 // TraceLog | 
| 974 // | 1034 // | 
| 975 //////////////////////////////////////////////////////////////////////////////// | 1035 //////////////////////////////////////////////////////////////////////////////// | 
| 976 | 1036 | 
| 977 class TraceLog::ThreadLocalEventBuffer | 1037 class TraceLog::ThreadLocalEventBuffer | 
| 978     : public MessageLoop::DestructionObserver { | 1038     : public MessageLoop::DestructionObserver { | 
| 979  public: | 1039  public: | 
| 980   ThreadLocalEventBuffer(TraceLog* trace_log); | 1040   ThreadLocalEventBuffer(TraceLog* trace_log); | 
| 981   virtual ~ThreadLocalEventBuffer(); | 1041   virtual ~ThreadLocalEventBuffer(); | 
| 982 | 1042 | 
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1130 | 1190 | 
| 1131 TraceLog::TraceLog() | 1191 TraceLog::TraceLog() | 
| 1132     : mode_(DISABLED), | 1192     : mode_(DISABLED), | 
| 1133       num_traces_recorded_(0), | 1193       num_traces_recorded_(0), | 
| 1134       event_callback_(0), | 1194       event_callback_(0), | 
| 1135       dispatching_to_observer_list_(false), | 1195       dispatching_to_observer_list_(false), | 
| 1136       process_sort_index_(0), | 1196       process_sort_index_(0), | 
| 1137       process_id_hash_(0), | 1197       process_id_hash_(0), | 
| 1138       process_id_(0), | 1198       process_id_(0), | 
| 1139       watch_category_(0), | 1199       watch_category_(0), | 
| 1140       trace_options_(RECORD_UNTIL_FULL), | 1200       trace_options_(kInternalRecordUntilFull), | 
| 1141       sampling_thread_handle_(0), | 1201       sampling_thread_handle_(0), | 
| 1142       category_filter_(CategoryFilter::kDefaultCategoryFilterString), | 1202       category_filter_(CategoryFilter::kDefaultCategoryFilterString), | 
| 1143       event_callback_category_filter_( | 1203       event_callback_category_filter_( | 
| 1144           CategoryFilter::kDefaultCategoryFilterString), | 1204           CategoryFilter::kDefaultCategoryFilterString), | 
| 1145       thread_shared_chunk_index_(0), | 1205       thread_shared_chunk_index_(0), | 
| 1146       generation_(0) { | 1206       generation_(0) { | 
| 1147   // Trace is enabled or disabled on one thread while other threads are | 1207   // Trace is enabled or disabled on one thread while other threads are | 
| 1148   // accessing the enabled flag. We don't care whether edge-case events are | 1208   // accessing the enabled flag. We don't care whether edge-case events are | 
| 1149   // traced or not, so we allow races on the enabled flag to keep the trace | 1209   // traced or not, so we allow races on the enabled flag to keep the trace | 
| 1150   // macros fast. | 1210   // macros fast. | 
| (...skipping 17 matching lines...) Expand all  Loading... | 
| 1168         switches::kTraceToConsole); | 1228         switches::kTraceToConsole); | 
| 1169     if (filter.empty()) { | 1229     if (filter.empty()) { | 
| 1170       filter = kEchoToConsoleCategoryFilter; | 1230       filter = kEchoToConsoleCategoryFilter; | 
| 1171     } else { | 1231     } else { | 
| 1172       filter.append(","); | 1232       filter.append(","); | 
| 1173       filter.append(kEchoToConsoleCategoryFilter); | 1233       filter.append(kEchoToConsoleCategoryFilter); | 
| 1174     } | 1234     } | 
| 1175 | 1235 | 
| 1176     LOG(ERROR) << "Start " << switches::kTraceToConsole | 1236     LOG(ERROR) << "Start " << switches::kTraceToConsole | 
| 1177                << " with CategoryFilter '" << filter << "'."; | 1237                << " with CategoryFilter '" << filter << "'."; | 
| 1178     SetEnabled(CategoryFilter(filter), RECORDING_MODE, ECHO_TO_CONSOLE); | 1238     SetEnabled(CategoryFilter(filter), | 
|  | 1239                RECORDING_MODE, | 
|  | 1240                TraceOptions(ECHO_TO_CONSOLE)); | 
| 1179   } | 1241   } | 
| 1180 #endif | 1242 #endif | 
| 1181 | 1243 | 
| 1182   logged_events_.reset(CreateTraceBuffer()); | 1244   logged_events_.reset(CreateTraceBuffer()); | 
| 1183 } | 1245 } | 
| 1184 | 1246 | 
| 1185 TraceLog::~TraceLog() { | 1247 TraceLog::~TraceLog() { | 
| 1186 } | 1248 } | 
| 1187 | 1249 | 
| 1188 const unsigned char* TraceLog::GetCategoryGroupEnabled( | 1250 const unsigned char* TraceLog::GetCategoryGroupEnabled( | 
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1318   AutoLock lock(lock_); | 1380   AutoLock lock(lock_); | 
| 1319   category_groups->push_back( | 1381   category_groups->push_back( | 
| 1320       g_category_groups[g_category_trace_event_overhead]); | 1382       g_category_groups[g_category_trace_event_overhead]); | 
| 1321   size_t category_index = base::subtle::NoBarrier_Load(&g_category_index); | 1383   size_t category_index = base::subtle::NoBarrier_Load(&g_category_index); | 
| 1322   for (size_t i = g_num_builtin_categories; i < category_index; i++) | 1384   for (size_t i = g_num_builtin_categories; i < category_index; i++) | 
| 1323     category_groups->push_back(g_category_groups[i]); | 1385     category_groups->push_back(g_category_groups[i]); | 
| 1324 } | 1386 } | 
| 1325 | 1387 | 
| 1326 void TraceLog::SetEnabled(const CategoryFilter& category_filter, | 1388 void TraceLog::SetEnabled(const CategoryFilter& category_filter, | 
| 1327                           Mode mode, | 1389                           Mode mode, | 
| 1328                           Options options) { | 1390                           const TraceOptions& options) { | 
| 1329   std::vector<EnabledStateObserver*> observer_list; | 1391   std::vector<EnabledStateObserver*> observer_list; | 
| 1330   { | 1392   { | 
| 1331     AutoLock lock(lock_); | 1393     AutoLock lock(lock_); | 
| 1332 | 1394 | 
| 1333     // Can't enable tracing when Flush() is in progress. | 1395     // Can't enable tracing when Flush() is in progress. | 
| 1334     DCHECK(!flush_message_loop_proxy_.get()); | 1396     DCHECK(!flush_message_loop_proxy_.get()); | 
| 1335 | 1397 | 
| 1336     Options old_options = trace_options(); | 1398     InternalTraceOptions new_options = | 
|  | 1399         GetInternalOptionsFromTraceOptions(options); | 
|  | 1400 | 
|  | 1401    InternalTraceOptions old_options = trace_options(); | 
| 1337 | 1402 | 
| 1338     if (IsEnabled()) { | 1403     if (IsEnabled()) { | 
| 1339       if (options != old_options) { | 1404       if (new_options != old_options) { | 
| 1340         DLOG(ERROR) << "Attempting to re-enable tracing with a different " | 1405         DLOG(ERROR) << "Attempting to re-enable tracing with a different " | 
| 1341                     << "set of options."; | 1406                     << "set of options."; | 
| 1342       } | 1407       } | 
| 1343 | 1408 | 
| 1344       if (mode != mode_) { | 1409       if (mode != mode_) { | 
| 1345         DLOG(ERROR) << "Attempting to re-enable tracing with a different mode."; | 1410         DLOG(ERROR) << "Attempting to re-enable tracing with a different mode."; | 
| 1346       } | 1411       } | 
| 1347 | 1412 | 
| 1348       category_filter_.Merge(category_filter); | 1413       category_filter_.Merge(category_filter); | 
| 1349       UpdateCategoryGroupEnabledFlags(); | 1414       UpdateCategoryGroupEnabledFlags(); | 
| 1350       return; | 1415       return; | 
| 1351     } | 1416     } | 
| 1352 | 1417 | 
| 1353     if (dispatching_to_observer_list_) { | 1418     if (dispatching_to_observer_list_) { | 
| 1354       DLOG(ERROR) << | 1419       DLOG(ERROR) << | 
| 1355           "Cannot manipulate TraceLog::Enabled state from an observer."; | 1420           "Cannot manipulate TraceLog::Enabled state from an observer."; | 
| 1356       return; | 1421       return; | 
| 1357     } | 1422     } | 
| 1358 | 1423 | 
| 1359     mode_ = mode; | 1424     mode_ = mode; | 
| 1360 | 1425 | 
| 1361     if (options != old_options) { | 1426     if (new_options != old_options) { | 
| 1362       subtle::NoBarrier_Store(&trace_options_, options); | 1427       subtle::NoBarrier_Store(&trace_options_, new_options); | 
| 1363       UseNextTraceBuffer(); | 1428       UseNextTraceBuffer(); | 
| 1364     } | 1429     } | 
| 1365 | 1430 | 
| 1366     num_traces_recorded_++; | 1431     num_traces_recorded_++; | 
| 1367 | 1432 | 
| 1368     category_filter_ = CategoryFilter(category_filter); | 1433     category_filter_ = CategoryFilter(category_filter); | 
| 1369     UpdateCategoryGroupEnabledFlags(); | 1434     UpdateCategoryGroupEnabledFlags(); | 
| 1370     UpdateSyntheticDelaysFromCategoryFilter(); | 1435     UpdateSyntheticDelaysFromCategoryFilter(); | 
| 1371 | 1436 | 
| 1372     if (options & ENABLE_SAMPLING) { | 1437     if (new_options & kInternalEnableSampling) { | 
| 1373       sampling_thread_.reset(new TraceSamplingThread); | 1438       sampling_thread_.reset(new TraceSamplingThread); | 
| 1374       sampling_thread_->RegisterSampleBucket( | 1439       sampling_thread_->RegisterSampleBucket( | 
| 1375           &g_trace_state[0], | 1440           &g_trace_state[0], | 
| 1376           "bucket0", | 1441           "bucket0", | 
| 1377           Bind(&TraceSamplingThread::DefaultSamplingCallback)); | 1442           Bind(&TraceSamplingThread::DefaultSamplingCallback)); | 
| 1378       sampling_thread_->RegisterSampleBucket( | 1443       sampling_thread_->RegisterSampleBucket( | 
| 1379           &g_trace_state[1], | 1444           &g_trace_state[1], | 
| 1380           "bucket1", | 1445           "bucket1", | 
| 1381           Bind(&TraceSamplingThread::DefaultSamplingCallback)); | 1446           Bind(&TraceSamplingThread::DefaultSamplingCallback)); | 
| 1382       sampling_thread_->RegisterSampleBucket( | 1447       sampling_thread_->RegisterSampleBucket( | 
| (...skipping 12 matching lines...) Expand all  Loading... | 
| 1395   // Notify observers outside the lock in case they trigger trace events. | 1460   // Notify observers outside the lock in case they trigger trace events. | 
| 1396   for (size_t i = 0; i < observer_list.size(); ++i) | 1461   for (size_t i = 0; i < observer_list.size(); ++i) | 
| 1397     observer_list[i]->OnTraceLogEnabled(); | 1462     observer_list[i]->OnTraceLogEnabled(); | 
| 1398 | 1463 | 
| 1399   { | 1464   { | 
| 1400     AutoLock lock(lock_); | 1465     AutoLock lock(lock_); | 
| 1401     dispatching_to_observer_list_ = false; | 1466     dispatching_to_observer_list_ = false; | 
| 1402   } | 1467   } | 
| 1403 } | 1468 } | 
| 1404 | 1469 | 
|  | 1470 TraceLog::InternalTraceOptions TraceLog::GetInternalOptionsFromTraceOptions( | 
|  | 1471     const TraceOptions& options) { | 
|  | 1472   InternalTraceOptions ret = | 
|  | 1473       options.enable_sampling ? kInternalEnableSampling : kInternalNone; | 
|  | 1474   switch (options.record_mode) { | 
|  | 1475     case RECORD_UNTIL_FULL: | 
|  | 1476       return ret | kInternalRecordUntilFull; | 
|  | 1477     case RECORD_CONTINUOUSLY: | 
|  | 1478       return ret | kInternalRecordContinuously; | 
|  | 1479     case ECHO_TO_CONSOLE: | 
|  | 1480       return ret | kInternalEchoToConsole; | 
|  | 1481   } | 
|  | 1482   NOTREACHED(); | 
|  | 1483   return kInternalNone; | 
|  | 1484 } | 
|  | 1485 | 
| 1405 CategoryFilter TraceLog::GetCurrentCategoryFilter() { | 1486 CategoryFilter TraceLog::GetCurrentCategoryFilter() { | 
| 1406   AutoLock lock(lock_); | 1487   AutoLock lock(lock_); | 
| 1407   return category_filter_; | 1488   return category_filter_; | 
| 1408 } | 1489 } | 
| 1409 | 1490 | 
|  | 1491 TraceOptions TraceLog::GetCurrentTraceOptions() const { | 
|  | 1492   TraceOptions ret; | 
|  | 1493   InternalTraceOptions option = trace_options(); | 
|  | 1494   ret.enable_sampling = (option & kInternalEnableSampling) != 0; | 
|  | 1495   if (option & kInternalRecordUntilFull) | 
|  | 1496     ret.record_mode = RECORD_UNTIL_FULL; | 
|  | 1497   else if (option & kInternalRecordContinuously) | 
|  | 1498     ret.record_mode = RECORD_CONTINUOUSLY; | 
|  | 1499   else if (option & kInternalEchoToConsole) | 
|  | 1500     ret.record_mode = ECHO_TO_CONSOLE; | 
|  | 1501   else | 
|  | 1502     NOTREACHED(); | 
|  | 1503   return ret; | 
|  | 1504 } | 
|  | 1505 | 
| 1410 void TraceLog::SetDisabled() { | 1506 void TraceLog::SetDisabled() { | 
| 1411   AutoLock lock(lock_); | 1507   AutoLock lock(lock_); | 
| 1412   SetDisabledWhileLocked(); | 1508   SetDisabledWhileLocked(); | 
| 1413 } | 1509 } | 
| 1414 | 1510 | 
| 1415 void TraceLog::SetDisabledWhileLocked() { | 1511 void TraceLog::SetDisabledWhileLocked() { | 
| 1416   lock_.AssertAcquired(); | 1512   lock_.AssertAcquired(); | 
| 1417 | 1513 | 
| 1418   if (!IsEnabled()) | 1514   if (!IsEnabled()) | 
| 1419     return; | 1515     return; | 
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1489   return static_cast<float>(static_cast<double>(logged_events_->Size()) / | 1585   return static_cast<float>(static_cast<double>(logged_events_->Size()) / | 
| 1490                             logged_events_->Capacity()); | 1586                             logged_events_->Capacity()); | 
| 1491 } | 1587 } | 
| 1492 | 1588 | 
| 1493 bool TraceLog::BufferIsFull() const { | 1589 bool TraceLog::BufferIsFull() const { | 
| 1494   AutoLock lock(lock_); | 1590   AutoLock lock(lock_); | 
| 1495   return logged_events_->IsFull(); | 1591   return logged_events_->IsFull(); | 
| 1496 } | 1592 } | 
| 1497 | 1593 | 
| 1498 TraceBuffer* TraceLog::CreateTraceBuffer() { | 1594 TraceBuffer* TraceLog::CreateTraceBuffer() { | 
| 1499   Options options = trace_options(); | 1595   InternalTraceOptions options = trace_options(); | 
| 1500   if (options & RECORD_CONTINUOUSLY) | 1596   if (options & kInternalRecordContinuously) | 
| 1501     return new TraceBufferRingBuffer(kTraceEventRingBufferChunks); | 1597     return new TraceBufferRingBuffer(kTraceEventRingBufferChunks); | 
| 1502   else if ((options & ENABLE_SAMPLING) && mode_ == MONITORING_MODE) | 1598   else if ((options & kInternalEnableSampling) && mode_ == MONITORING_MODE) | 
| 1503     return new TraceBufferRingBuffer(kMonitorTraceEventBufferChunks); | 1599     return new TraceBufferRingBuffer(kMonitorTraceEventBufferChunks); | 
| 1504   else if (options & ECHO_TO_CONSOLE) | 1600   else if (options & kInternalEchoToConsole) | 
| 1505     return new TraceBufferRingBuffer(kEchoToConsoleTraceEventBufferChunks); | 1601     return new TraceBufferRingBuffer(kEchoToConsoleTraceEventBufferChunks); | 
| 1506   return CreateTraceBufferVectorOfSize(kTraceEventVectorBufferChunks); | 1602   return CreateTraceBufferVectorOfSize(kTraceEventVectorBufferChunks); | 
| 1507 } | 1603 } | 
| 1508 | 1604 | 
| 1509 TraceBuffer* TraceLog::CreateTraceBufferVectorOfSize(size_t max_chunks) { | 1605 TraceBuffer* TraceLog::CreateTraceBufferVectorOfSize(size_t max_chunks) { | 
| 1510   return new TraceBufferVector(max_chunks); | 1606   return new TraceBufferVector(max_chunks); | 
| 1511 } | 1607 } | 
| 1512 | 1608 | 
| 1513 TraceEvent* TraceLog::AddEventToThreadSharedChunkWhileLocked( | 1609 TraceEvent* TraceLog::AddEventToThreadSharedChunkWhileLocked( | 
| 1514     TraceEventHandle* handle, bool check_buffer_is_full) { | 1610     TraceEventHandle* handle, bool check_buffer_is_full) { | 
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1867       trace_event->Initialize(thread_id, now, thread_now, phase, | 1963       trace_event->Initialize(thread_id, now, thread_now, phase, | 
| 1868                               category_group_enabled, name, id, | 1964                               category_group_enabled, name, id, | 
| 1869                               num_args, arg_names, arg_types, arg_values, | 1965                               num_args, arg_names, arg_types, arg_values, | 
| 1870                               convertable_values, flags); | 1966                               convertable_values, flags); | 
| 1871 | 1967 | 
| 1872 #if defined(OS_ANDROID) | 1968 #if defined(OS_ANDROID) | 
| 1873       trace_event->SendToATrace(); | 1969       trace_event->SendToATrace(); | 
| 1874 #endif | 1970 #endif | 
| 1875     } | 1971     } | 
| 1876 | 1972 | 
| 1877     if (trace_options() & ECHO_TO_CONSOLE) { | 1973     if (trace_options() & kInternalEchoToConsole) { | 
| 1878       console_message = EventToConsoleMessage( | 1974       console_message = EventToConsoleMessage( | 
| 1879           phase == TRACE_EVENT_PHASE_COMPLETE ? TRACE_EVENT_PHASE_BEGIN : phase, | 1975           phase == TRACE_EVENT_PHASE_COMPLETE ? TRACE_EVENT_PHASE_BEGIN : phase, | 
| 1880           timestamp, trace_event); | 1976           timestamp, trace_event); | 
| 1881     } | 1977     } | 
| 1882   } | 1978   } | 
| 1883 | 1979 | 
| 1884   if (console_message.size()) | 1980   if (console_message.size()) | 
| 1885     LOG(ERROR) << console_message; | 1981     LOG(ERROR) << console_message; | 
| 1886 | 1982 | 
| 1887   if (reinterpret_cast<const unsigned char*>(subtle::NoBarrier_Load( | 1983   if (reinterpret_cast<const unsigned char*>(subtle::NoBarrier_Load( | 
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2010 | 2106 | 
| 2011     TraceEvent* trace_event = GetEventByHandleInternal(handle, &lock); | 2107     TraceEvent* trace_event = GetEventByHandleInternal(handle, &lock); | 
| 2012     if (trace_event) { | 2108     if (trace_event) { | 
| 2013       DCHECK(trace_event->phase() == TRACE_EVENT_PHASE_COMPLETE); | 2109       DCHECK(trace_event->phase() == TRACE_EVENT_PHASE_COMPLETE); | 
| 2014       trace_event->UpdateDuration(now, thread_now); | 2110       trace_event->UpdateDuration(now, thread_now); | 
| 2015 #if defined(OS_ANDROID) | 2111 #if defined(OS_ANDROID) | 
| 2016       trace_event->SendToATrace(); | 2112       trace_event->SendToATrace(); | 
| 2017 #endif | 2113 #endif | 
| 2018     } | 2114     } | 
| 2019 | 2115 | 
| 2020     if (trace_options() & ECHO_TO_CONSOLE) { | 2116     if (trace_options() & kInternalEchoToConsole) { | 
| 2021       console_message = EventToConsoleMessage(TRACE_EVENT_PHASE_END, | 2117       console_message = EventToConsoleMessage(TRACE_EVENT_PHASE_END, | 
| 2022                                               now, trace_event); | 2118                                               now, trace_event); | 
| 2023     } | 2119     } | 
| 2024   } | 2120   } | 
| 2025 | 2121 | 
| 2026   if (console_message.size()) | 2122   if (console_message.size()) | 
| 2027     LOG(ERROR) << console_message; | 2123     LOG(ERROR) << console_message; | 
| 2028 | 2124 | 
| 2029   if (*category_group_enabled & ENABLED_FOR_EVENT_CALLBACK) { | 2125   if (*category_group_enabled & ENABLED_FOR_EVENT_CALLBACK) { | 
| 2030     EventCallback event_callback = reinterpret_cast<EventCallback>( | 2126     EventCallback event_callback = reinterpret_cast<EventCallback>( | 
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2255   return false; | 2351   return false; | 
| 2256 } | 2352 } | 
| 2257 | 2353 | 
| 2258 CategoryFilter::CategoryFilter(const std::string& filter_string) { | 2354 CategoryFilter::CategoryFilter(const std::string& filter_string) { | 
| 2259   if (!filter_string.empty()) | 2355   if (!filter_string.empty()) | 
| 2260     Initialize(filter_string); | 2356     Initialize(filter_string); | 
| 2261   else | 2357   else | 
| 2262     Initialize(CategoryFilter::kDefaultCategoryFilterString); | 2358     Initialize(CategoryFilter::kDefaultCategoryFilterString); | 
| 2263 } | 2359 } | 
| 2264 | 2360 | 
|  | 2361 CategoryFilter::CategoryFilter() { | 
|  | 2362     Initialize(CategoryFilter::kDefaultCategoryFilterString); | 
|  | 2363 } | 
|  | 2364 | 
| 2265 CategoryFilter::CategoryFilter(const CategoryFilter& cf) | 2365 CategoryFilter::CategoryFilter(const CategoryFilter& cf) | 
| 2266     : included_(cf.included_), | 2366     : included_(cf.included_), | 
| 2267       disabled_(cf.disabled_), | 2367       disabled_(cf.disabled_), | 
| 2268       excluded_(cf.excluded_), | 2368       excluded_(cf.excluded_), | 
| 2269       delays_(cf.delays_) { | 2369       delays_(cf.delays_) { | 
| 2270 } | 2370 } | 
| 2271 | 2371 | 
| 2272 CategoryFilter::~CategoryFilter() { | 2372 CategoryFilter::~CategoryFilter() { | 
| 2273 } | 2373 } | 
| 2274 | 2374 | 
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2447 } | 2547 } | 
| 2448 | 2548 | 
| 2449 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { | 2549 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { | 
| 2450   if (*category_group_enabled_) { | 2550   if (*category_group_enabled_) { | 
| 2451     TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, | 2551     TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, | 
| 2452                                                 name_, event_handle_); | 2552                                                 name_, event_handle_); | 
| 2453   } | 2553   } | 
| 2454 } | 2554 } | 
| 2455 | 2555 | 
| 2456 }  // namespace trace_event_internal | 2556 }  // namespace trace_event_internal | 
| OLD | NEW | 
|---|