diff options
author | Yabin Cui <yabinc@google.com> | 2024-04-16 15:55:46 -0700 |
---|---|---|
committer | Yabin Cui <yabinc@google.com> | 2024-04-16 15:55:46 -0700 |
commit | 7d8db10758230140905163e451ac4af348cd1883 (patch) | |
tree | 26379839ff58f99bbcfa5f8e101ac02fd35bcfb4 | |
parent | b68f0f9e32e90a19831160ae3a6699dd972c47bd (diff) | |
download | extras-7d8db10758230140905163e451ac4af348cd1883.tar.gz |
simpleperf: skip checking tracepoint events in the list cmd
When running in emulator, accessing some tracepoint events
may cause warnings in the kernel.
Bug: 328598190
Test: run simpleperf_unit_test
Change-Id: Ia80fac978530fd9ecca2175c515d40c25257ee87
-rw-r--r-- | simpleperf/cmd_list.cpp | 4 | ||||
-rw-r--r-- | simpleperf/event_type.h | 1 |
2 files changed, 3 insertions, 2 deletions
diff --git a/simpleperf/cmd_list.cpp b/simpleperf/cmd_list.cpp index 963259d1..926b7f7e 100644 --- a/simpleperf/cmd_list.cpp +++ b/simpleperf/cmd_list.cpp @@ -246,8 +246,8 @@ static void PrintRawEventTypes(const std::string& type_desc) { } static bool IsEventTypeSupported(const EventType& event_type) { - // Because PMU events are provided by kernel, we assume it's supported. - if (event_type.IsPmuEvent()) { + // PMU and tracepoint events are provided by kernel. So we assume they're supported. + if (event_type.IsPmuEvent() || event_type.IsTracepointEvent()) { return true; } perf_event_attr attr = CreateDefaultPerfEventAttr(event_type); diff --git a/simpleperf/event_type.h b/simpleperf/event_type.h index 14863caa..d85f71d1 100644 --- a/simpleperf/event_type.h +++ b/simpleperf/event_type.h @@ -55,6 +55,7 @@ struct EventType { bool IsHardwareEvent() const { return type == PERF_TYPE_HARDWARE || type == PERF_TYPE_HW_CACHE || type == PERF_TYPE_RAW; } + bool IsTracepointEvent() const { return type == PERF_TYPE_TRACEPOINT; } std::vector<int> GetPmuCpumask(); |