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

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to