| 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/trace_event/trace_event_impl.h" | 5 #include "base/trace_event/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 23 matching lines...) Expand all Loading... |
| 34 #include "base/trace_event/trace_event.h" | 34 #include "base/trace_event/trace_event.h" |
| 35 #include "base/trace_event/trace_event_synthetic_delay.h" | 35 #include "base/trace_event/trace_event_synthetic_delay.h" |
| 36 | 36 |
| 37 #if defined(OS_WIN) | 37 #if defined(OS_WIN) |
| 38 #include "base/trace_event/trace_event_win.h" | 38 #include "base/trace_event/trace_event_win.h" |
| 39 #endif | 39 #endif |
| 40 | 40 |
| 41 class DeleteTraceLogForTesting { | 41 class DeleteTraceLogForTesting { |
| 42 public: | 42 public: |
| 43 static void Delete() { | 43 static void Delete() { |
| 44 Singleton<base::trace_event::TraceLog, | 44 Singleton<base::debug::TraceLog, |
| 45 LeakySingletonTraits<base::trace_event::TraceLog>>::OnExit(0); | 45 LeakySingletonTraits<base::debug::TraceLog> >::OnExit(0); |
| 46 } | 46 } |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 // The thread buckets for the sampling profiler. | 49 // The thread buckets for the sampling profiler. |
| 50 BASE_EXPORT TRACE_EVENT_API_ATOMIC_WORD g_trace_state[3]; | 50 BASE_EXPORT TRACE_EVENT_API_ATOMIC_WORD g_trace_state[3]; |
| 51 | 51 |
| 52 namespace base { | 52 namespace base { |
| 53 namespace trace_event { | 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. | 61 // String options that can be used to initialize TraceOptions. |
| 62 const char kRecordUntilFull[] = "record-until-full"; | 62 const char kRecordUntilFull[] = "record-until-full"; |
| 63 const char kRecordContinuously[] = "record-continuously"; | 63 const char kRecordContinuously[] = "record-continuously"; |
| (...skipping 2489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2553 included_.clear(); | 2553 included_.clear(); |
| 2554 disabled_.clear(); | 2554 disabled_.clear(); |
| 2555 excluded_.clear(); | 2555 excluded_.clear(); |
| 2556 } | 2556 } |
| 2557 | 2557 |
| 2558 const CategoryFilter::StringList& | 2558 const CategoryFilter::StringList& |
| 2559 CategoryFilter::GetSyntheticDelayValues() const { | 2559 CategoryFilter::GetSyntheticDelayValues() const { |
| 2560 return delays_; | 2560 return delays_; |
| 2561 } | 2561 } |
| 2562 | 2562 |
| 2563 } // namespace trace_event | 2563 } // namespace debug |
| 2564 } // namespace base | 2564 } // namespace base |
| 2565 | 2565 |
| 2566 namespace trace_event_internal { | 2566 namespace trace_event_internal { |
| 2567 | 2567 |
| 2568 ScopedTraceBinaryEfficient::ScopedTraceBinaryEfficient( | 2568 ScopedTraceBinaryEfficient::ScopedTraceBinaryEfficient( |
| 2569 const char* category_group, const char* name) { | 2569 const char* category_group, const char* name) { |
| 2570 // The single atom works because for now the category_group can only be "gpu". | 2570 // The single atom works because for now the category_group can only be "gpu". |
| 2571 DCHECK(strcmp(category_group, "gpu") == 0); | 2571 DCHECK(strcmp(category_group, "gpu") == 0); |
| 2572 static TRACE_EVENT_API_ATOMIC_WORD atomic = 0; | 2572 static TRACE_EVENT_API_ATOMIC_WORD atomic = 0; |
| 2573 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO_CUSTOM_VARIABLES( | 2573 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO_CUSTOM_VARIABLES( |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2585 } | 2585 } |
| 2586 | 2586 |
| 2587 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { | 2587 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { |
| 2588 if (*category_group_enabled_) { | 2588 if (*category_group_enabled_) { |
| 2589 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, | 2589 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, |
| 2590 name_, event_handle_); | 2590 name_, event_handle_); |
| 2591 } | 2591 } |
| 2592 } | 2592 } |
| 2593 | 2593 |
| 2594 } // namespace trace_event_internal | 2594 } // namespace trace_event_internal |
| OLD | NEW |