[Lldb-commits] [PATCH] D127456: [trace][intelpt] Support system-wide tracing [17] - Some improvements

Jakob Johnson via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Jun 15 10:44:24 PDT 2022


jj10306 accepted this revision.
jj10306 added inline comments.
This revision is now accepted and ready to land.


================
Comment at: lldb/source/Plugins/Process/Linux/Perf.cpp:188
+
+  bool was_enabled = m_enabled;
   if (Error err = DisableWithIoctl())
----------------
wallace wrote:
> jj10306 wrote:
> > why this intermediate `was_enabled`  variable?
> it stores the original state of the perf event, so that after pausing it and reading, the perf event is returned to that state. We need to pause the perf event before reading so that the CPU flushed out its internal buffer. We also want to prevent the cpu from writing to the buffer while we read, which would give us wrong data
ahhh I see, I forgot that the Disable and Enable methods were potentially modifying m_enabled internally - thanks!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127456/new/

https://reviews.llvm.org/D127456



More information about the lldb-commits mailing list