diff options
| author | 2024-03-18 15:50:28 +0000 | |
|---|---|---|
| committer | 2024-03-18 15:50:28 +0000 | |
| commit | 64077b5a68cd160faeded6ba80e077d90b217a15 (patch) | |
| tree | afe5617fe2560df905f5ad7397686a1b815e029f /libs | |
| parent | 703c1c04d8ec04619604239458bd8b2c3517742d (diff) | |
| parent | cd6024fb88e4fef7843110f91108ae89789114e7 (diff) | |
Merge "Fix check for whether a trace tag is enabled" into main
Diffstat (limited to 'libs')
| -rw-r--r-- | libs/tracing_perfetto/include/tracing_perfetto.h | 2 | ||||
| -rw-r--r-- | libs/tracing_perfetto/tracing_perfetto.cpp | 11 |
2 files changed, 7 insertions, 6 deletions
diff --git a/libs/tracing_perfetto/include/tracing_perfetto.h b/libs/tracing_perfetto/include/tracing_perfetto.h index 4e3c83fca3..2c1c2a49e7 100644 --- a/libs/tracing_perfetto/include/tracing_perfetto.h +++ b/libs/tracing_perfetto/include/tracing_perfetto.h @@ -46,7 +46,7 @@ Result traceInstantForTrack(uint64_t category, const char* trackName, Result traceCounter(uint64_t category, const char* name, int64_t value); -uint64_t getEnabledCategories(); +bool isTagEnabled(uint64_t category); } // namespace tracing_perfetto diff --git a/libs/tracing_perfetto/tracing_perfetto.cpp b/libs/tracing_perfetto/tracing_perfetto.cpp index 19d1eb639e..6f716eea9a 100644 --- a/libs/tracing_perfetto/tracing_perfetto.cpp +++ b/libs/tracing_perfetto/tracing_perfetto.cpp @@ -130,12 +130,13 @@ Result traceCounter(uint64_t category, const char* name, int64_t value) { } } -uint64_t getEnabledCategories() { - if (internal::isPerfettoRegistered()) { - // TODO(b/303199244): Return only enabled categories and not all registered ones - return internal::getDefaultCategories(); +bool isTagEnabled(uint64_t category) { + struct PerfettoTeCategory* perfettoTeCategory = + internal::toPerfettoCategory(category); + if (perfettoTeCategory != nullptr) { + return true; } else { - return atrace_get_enabled_tags(); + return (atrace_get_enabled_tags() & category) != 0; } } |