Add --traceMatch argument to filter tracing categories

Bug: skia:
Change-Id: I1449f0f4d7d9ab6225d98c601eafa7461a2a7dde
Reviewed-on: https://skia-review.googlesource.com/27120
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
This commit is contained in:
Brian Osman 2017-07-26 15:50:37 -04:00 committed by Skia Commit-Bot
parent f695b63841
commit 1e09686840

View File

@ -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<uint8_t*>(&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<uint8_t*>(&fCategories[fNumCategories++]);
}