From 1e0968684065b39dfe3ea8b7fac05e37b712ef61 Mon Sep 17 00:00:00 2001 From: Brian Osman Date: Wed, 26 Jul 2017 15:50:37 -0400 Subject: Add --traceMatch argument to filter tracing categories Bug: skia: Change-Id: I1449f0f4d7d9ab6225d98c601eafa7461a2a7dde Reviewed-on: https://skia-review.googlesource.com/27120 Commit-Queue: Brian Osman Commit-Queue: Mike Klein Reviewed-by: Mike Klein --- tools/trace/SkEventTracingPriv.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/trace/SkEventTracingPriv.cpp b/tools/trace/SkEventTracingPriv.cpp index 7a9ca2ee80..a7b3a827e6 100644 --- a/tools/trace/SkEventTracingPriv.cpp +++ b/tools/trace/SkEventTracingPriv.cpp @@ -22,6 +22,10 @@ DEFINE_string(trace, "", " trace events to specified file as JSON, for viewing\n" " with chrome://tracing"); +DEFINE_string(traceMatch, "", + "Filter which categories are traced.\n" + "Uses same format as --match\n"); + void initializeEventTracingForTools(const char* traceFlag) { if (!traceFlag) { if (FLAGS_trace.isEmpty()) { @@ -65,8 +69,9 @@ uint8_t* SkEventTracingCategories::getCategoryGroupEnabled(const char* name) { return reinterpret_cast(&fCategories[0]); } - fCategories[fNumCategories].fEnabled = - SkEventTracer::kEnabledForRecording_CategoryGroupEnabledFlags; + fCategories[fNumCategories].fEnabled = SkCommandLineFlags::ShouldSkip(FLAGS_traceMatch, name) + ? 0 : SkEventTracer::kEnabledForRecording_CategoryGroupEnabledFlags; + fCategories[fNumCategories].fName = name; return reinterpret_cast(&fCategories[fNumCategories++]); } -- cgit v1.2.3