Index: base/debug/trace_event_impl.h |
diff --git a/base/debug/trace_event_impl.h b/base/debug/trace_event_impl.h |
index 129b51d9a6938f1c92b7dd40b6178bdcf2e83b28..df5e2d1274a3eb2f7a8446a35a7907f333778413 100644 |
--- a/base/debug/trace_event_impl.h |
+++ b/base/debug/trace_event_impl.h |
@@ -283,6 +283,9 @@ class BASE_EXPORT TraceResultBuffer { |
class BASE_EXPORT CategoryFilter { |
public: |
+ typedef std::pair<std::string, std::string> DelayValue; |
+ typedef std::vector<DelayValue> DelayValueList; |
+ |
// The default category filter, used when none is provided. |
// Allows all categories through, except if they end in the suffix 'Debug' or |
// 'Test'. |
@@ -298,6 +301,15 @@ class BASE_EXPORT CategoryFilter { |
// Example: CategoryFilter("-excluded_category1,-excluded_category2"); |
// Example: CategoryFilter("-*,webkit"); would disable everything but webkit. |
// Example: CategoryFilter("-webkit"); would enable everything but webkit. |
+ // |
+ // Category filters can also be used to configure synthetic delays. |
+ // |
+ // Example: CategoryFilter("gpu.SwapBuffers=16"); would make swap buffers |
+ // always take at least 16 ms. |
+ // Example: CategoryFilter("gpu.SwapBuffers=16;oneshot"); would make swap |
+ // buffers take at least 16 ms the first time it is called. |
+ // Example: CategoryFilter("gpu.SwapBuffers=16;alternating"); would make swap |
+ // buffers take at least 16 ms every other time it is called. |
explicit CategoryFilter(const std::string& filter_string); |
CategoryFilter(const CategoryFilter& cf); |
@@ -317,6 +329,9 @@ class BASE_EXPORT CategoryFilter { |
// disabled by this category filter. |
bool IsCategoryGroupEnabled(const char* category_group) const; |
+ // Return a list of the synthetic delays specified in this category filter. |
+ const DelayValueList& GetSyntheticDelayValues() const; |
+ |
// Merges nested_filter with the current CategoryFilter |
void Merge(const CategoryFilter& nested_filter); |
@@ -340,6 +355,7 @@ class BASE_EXPORT CategoryFilter { |
void WriteString(const StringList& values, |
std::string* out, |
bool included) const; |
+ void WriteString(const DelayValueList& delays, std::string* out) const; |
bool HasIncludedPatterns() const; |
bool DoesCategoryGroupContainCategory(const char* category_group, |
@@ -348,6 +364,7 @@ class BASE_EXPORT CategoryFilter { |
StringList included_; |
StringList disabled_; |
StringList excluded_; |
+ DelayValueList delays_; |
}; |
class TraceSamplingThread; |
@@ -599,6 +616,10 @@ class BASE_EXPORT TraceLog { |
void UpdateCategoryGroupEnabledFlags(); |
void UpdateCategoryGroupEnabledFlag(int category_index); |
+ // Configure synthetic delays based on the values set in the current |
+ // category filter. |
+ void UpdateSyntheticDelaysFromCategoryFilter(); |
+ |
class ThreadLocalEventBuffer; |
class OptionalAutoLock; |