LLDB mainline
|
#include <IntelPTMultiCoreTrace.h>
Public Member Functions | |
void | ForEachCore (std::function< void(lldb::cpu_id_t cpu_id, IntelPTSingleBufferTrace &core_trace)> callback) |
Execute the provided callback on each core that is being traced. | |
void | ForEachCore (std::function< void(lldb::cpu_id_t cpu_id, IntelPTSingleBufferTrace &intelpt_trace, ContextSwitchTrace &context_switch_trace)> callback) |
Execute the provided callback on each core that is being traced. | |
void | ProcessDidStop () override |
void | ProcessWillResume () override |
TraceIntelPTGetStateResponse | GetState () override |
Construct a minimal jLLDBTraceGetState response for this process trace. | |
bool | TracesThread (lldb::tid_t tid) const override |
llvm::Error | TraceStart (lldb::tid_t tid) override |
Start tracing the thread given by its tid . | |
llvm::Error | TraceStop (lldb::tid_t tid) override |
Stop tracing the thread given by its tid . | |
llvm::Expected< std::optional< std::vector< uint8_t > > > | TryGetBinaryData (const TraceGetBinaryDataRequest &request) override |
Public Member Functions inherited from lldb_private::process_linux::IntelPTProcessTrace | |
virtual | ~IntelPTProcessTrace ()=default |
virtual void | ProcessDidStop () |
virtual void | ProcessWillResume () |
virtual TraceIntelPTGetStateResponse | GetState ()=0 |
Construct a minimal jLLDBTraceGetState response for this process trace. | |
virtual bool | TracesThread (lldb::tid_t tid) const =0 |
virtual llvm::Error | TraceStart (lldb::tid_t tid)=0 |
Start tracing the thread given by its tid . | |
virtual llvm::Error | TraceStop (lldb::tid_t tid)=0 |
Stop tracing the thread given by its tid . | |
virtual llvm::Expected< std::optional< std::vector< uint8_t > > > | TryGetBinaryData (const TraceGetBinaryDataRequest &request)=0 |
Static Public Member Functions | |
static llvm::Expected< std::unique_ptr< IntelPTMultiCoreTrace > > | StartOnAllCores (const TraceIntelPTStartRequest &request, NativeProcessProtocol &process, std::optional< int > cgroup_fd=std::nullopt) |
Start tracing all CPU cores. | |
Private Types | |
using | ContextSwitchTrace = PerfEvent |
Private Member Functions | |
IntelPTMultiCoreTrace (llvm::DenseMap< lldb::cpu_id_t, std::pair< IntelPTSingleBufferTrace, ContextSwitchTrace > > &&traces_per_core, NativeProcessProtocol &process, bool using_cgroup_filtering) | |
This assumes that all underlying perf_events for each core are part of the same perf event group. | |
Private Attributes | |
llvm::DenseMap< lldb::cpu_id_t, std::pair< IntelPTSingleBufferTrace, ContextSwitchTrace > > | m_traces_per_core |
NativeProcessProtocol & | m_process |
The target process. | |
bool | m_using_cgroup_filtering |
Definition at line 24 of file IntelPTMultiCoreTrace.h.
Definition at line 25 of file IntelPTMultiCoreTrace.h.
|
inlineprivate |
This assumes that all underlying perf_events for each core are part of the same perf event group.
Definition at line 93 of file IntelPTMultiCoreTrace.h.
void lldb_private::process_linux::IntelPTMultiCoreTrace::ForEachCore | ( | std::function< void(lldb::cpu_id_t cpu_id, IntelPTSingleBufferTrace &core_trace)> | callback | ) |
Execute the provided callback on each core that is being traced.
[in] | callback.cpu_id | The core id that is being traced. |
[in] | callback.core_trace | The single-buffer trace instance for the given core. |
Referenced by GetState(), ProcessDidStop(), and ProcessWillResume().
void lldb_private::process_linux::IntelPTMultiCoreTrace::ForEachCore | ( | std::function< void(lldb::cpu_id_t cpu_id, IntelPTSingleBufferTrace &intelpt_trace, ContextSwitchTrace &context_switch_trace)> | callback | ) |
Execute the provided callback on each core that is being traced.
[in] | callback.cpu_id | The core id that is being traced. |
[in] | callback.intelpt_trace | The single-buffer intel pt trace instance for the given core. |
[in] | callback.context_switch_trace | The perf event collecting context switches for the given core. |
|
overridevirtual |
Construct a minimal jLLDBTraceGetState response for this process trace.
Implements lldb_private::process_linux::IntelPTProcessTrace.
Definition at line 108 of file IntelPTMultiCoreTrace.cpp.
References lldb_private::TraceGetStateResponse::cpus, ForEachCore(), lldb_private::process_linux::PerfEvent::GetEffectiveDataBufferSize(), lldb_private::process_linux::IntelPTSingleBufferTrace::GetIptTraceSize(), lldb_private::IntelPTDataKinds::kIptTrace, lldb_private::IntelPTDataKinds::kPerfContextSwitchTrace, m_process, m_using_cgroup_filtering, lldb_private::NativeProcessProtocol::Threads(), lldb_private::TraceGetStateResponse::traced_threads, and lldb_private::TraceIntelPTGetStateResponse::using_cgroup_filtering.
|
overridevirtual |
Reimplemented from lldb_private::process_linux::IntelPTProcessTrace.
Definition at line 90 of file IntelPTMultiCoreTrace.cpp.
References ForEachCore(), and lldb_private::process_linux::IntelPTSingleBufferTrace::Pause().
|
overridevirtual |
Reimplemented from lldb_private::process_linux::IntelPTProcessTrace.
Definition at line 99 of file IntelPTMultiCoreTrace.cpp.
References ForEachCore(), and lldb_private::process_linux::IntelPTSingleBufferTrace::Resume().
|
static |
Start tracing all CPU cores.
[in] | request | Intel PT configuration parameters. |
[in] | process | The process being debugged. |
[in] | cgroup_fd | A file descriptor in /sys/fs associated with the cgroup of the process to trace. If not std::nullopt, then the trace sesion will use cgroup filtering. |
Definition at line 37 of file IntelPTMultiCoreTrace.cpp.
References lldb_private::process_linux::CreateContextSwitchTracePerfEvent(), lldb_private::process_linux::GetAvailableLogicalCoreIDs(), IncludePerfEventParanoidMessageInError(), IsTotalBufferLimitReached(), and lldb_private::process_linux::IntelPTSingleBufferTrace::Start().
Referenced by lldb_private::process_linux::IntelPTCollector::TraceStart().
|
overridevirtual |
Start tracing the thread given by its tid
.
Implements lldb_private::process_linux::IntelPTProcessTrace.
Definition at line 134 of file IntelPTMultiCoreTrace.cpp.
References TracesThread().
|
overridevirtual |
Implements lldb_private::process_linux::IntelPTProcessTrace.
Definition at line 129 of file IntelPTMultiCoreTrace.cpp.
References lldb_private::NativeProcessProtocol::GetThreadByID(), and m_process.
Referenced by TraceStart().
|
overridevirtual |
Stop tracing the thread given by its tid
.
Implements lldb_private::process_linux::IntelPTProcessTrace.
Definition at line 143 of file IntelPTMultiCoreTrace.cpp.
|
overridevirtual |
Implements lldb_private::process_linux::IntelPTProcessTrace.
Definition at line 150 of file IntelPTMultiCoreTrace.cpp.
References lldb_private::TraceGetBinaryDataRequest::cpu_id, lldb_private::TraceGetBinaryDataRequest::kind, lldb_private::IntelPTDataKinds::kIptTrace, lldb_private::IntelPTDataKinds::kPerfContextSwitchTrace, and m_traces_per_core.
|
private |
The target process.
Definition at line 106 of file IntelPTMultiCoreTrace.h.
Referenced by GetState(), and TracesThread().
|
private |
Definition at line 103 of file IntelPTMultiCoreTrace.h.
Referenced by TryGetBinaryData().
|
private |
Definition at line 107 of file IntelPTMultiCoreTrace.h.
Referenced by GetState().