[Lldb-commits] [lldb] 5a92632 - [trace][intelpt] Support system-wide tracing [8] - Improve the single buffer perf_event configuration

Walter Erquinigo via lldb-commits lldb-commits at lists.llvm.org
Wed Jun 15 12:08:08 PDT 2022


Author: Walter Erquinigo
Date: 2022-06-15T12:07:59-07:00
New Revision: 5a92632dc477fcd42d912b2c781cc406e6d073f6

URL: https://github.com/llvm/llvm-project/commit/5a92632dc477fcd42d912b2c781cc406e6d073f6
DIFF: https://github.com/llvm/llvm-project/commit/5a92632dc477fcd42d912b2c781cc406e6d073f6.diff

LOG: [trace][intelpt] Support system-wide tracing [8] - Improve the single buffer perf_event configuration

We were setting some events to be written in the data buffer of the
perf_event, but we don't need that.

Besides that, we don't need the data buffer to be larger than 1, so we
can reduce its size.

Differential Revision: https://reviews.llvm.org/D125850

Added: 
    

Modified: 
    lldb/source/Plugins/Process/Linux/IntelPTSingleBufferTrace.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/Process/Linux/IntelPTSingleBufferTrace.cpp b/lldb/source/Plugins/Process/Linux/IntelPTSingleBufferTrace.cpp
index 047ce471149f..a587b5826af2 100644
--- a/lldb/source/Plugins/Process/Linux/IntelPTSingleBufferTrace.cpp
+++ b/lldb/source/Plugins/Process/Linux/IntelPTSingleBufferTrace.cpp
@@ -183,11 +183,8 @@ CreateIntelPTPerfEventConfiguration(bool enable_tsc,
   memset(&attr, 0, sizeof(attr));
   attr.size = sizeof(attr);
   attr.exclude_kernel = 1;
-  attr.sample_type = PERF_SAMPLE_TIME;
-  attr.sample_id_all = 1;
   attr.exclude_hv = 1;
   attr.exclude_idle = 1;
-  attr.mmap = 1;
 
   if (Expected<uint64_t> config_value =
           GeneratePerfEventConfigValue(enable_tsc, psb_period))
@@ -297,7 +294,7 @@ Expected<IntelPTSingleBufferTraceUP> IntelPTSingleBufferTrace::Start(
         request.trace_buffer_size);
   }
   uint64_t page_size = getpagesize();
-  uint64_t buffer_numpages = static_cast<uint64_t>(llvm::PowerOf2Floor(
+  uint64_t aux_buffer_numpages = static_cast<uint64_t>(llvm::PowerOf2Floor(
       (request.trace_buffer_size + page_size - 1) / page_size));
 
   Expected<perf_event_attr> attr = CreateIntelPTPerfEventConfiguration(
@@ -312,8 +309,8 @@ Expected<IntelPTSingleBufferTraceUP> IntelPTSingleBufferTrace::Start(
            request.trace_buffer_size);
 
   if (Expected<PerfEvent> perf_event = PerfEvent::Init(*attr, tid, core_id)) {
-    if (Error mmap_err = perf_event->MmapMetadataAndBuffers(buffer_numpages,
-                                                            buffer_numpages)) {
+    if (Error mmap_err = perf_event->MmapMetadataAndBuffers(
+            /*num_data_pages=*/0, aux_buffer_numpages)) {
       return std::move(mmap_err);
     }
     IntelPTSingleBufferTraceUP trace_up(


        


More information about the lldb-commits mailing list