[llvm] [llvm-exegesis] Error Out If Perf Counter is Not Fully Enabled (PR #132892)

Min-Yih Hsu via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 31 09:36:17 PDT 2025


================
@@ -132,15 +135,21 @@ void ConfiguredEvent::initRealEvent(const pid_t ProcessID, const int GroupFD) {
 
 Expected<SmallVector<int64_t>>
 ConfiguredEvent::readOrError(StringRef /*unused*/) const {
-  int64_t Count = 0;
-  ssize_t ReadSize = ::read(FileDescriptor, &Count, sizeof(Count));
+  int64_t EventInfo[3] = {0, 0, 0};
+  ssize_t ReadSize = ::read(FileDescriptor, &EventInfo, sizeof(EventInfo));
 
-  if (ReadSize != sizeof(Count))
+  if (ReadSize != sizeof(EventInfo))
     return make_error<StringError>("Failed to read event counter",
                                    errc::io_error);
 
+  int64_t EventTimeEnabled = EventInfo[1];
+  int64_t EventTimeRunning = EventInfo[2];
+  if (EventTimeEnabled != EventTimeRunning) {
----------------
mshockwave wrote:

remove curly braces

https://github.com/llvm/llvm-project/pull/132892


More information about the llvm-commits mailing list