LLDB  mainline
Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
lldb_private::process_linux::IntelPTMultiCoreTrace Class Reference

#include <IntelPTMultiCoreTrace.h>

Inheritance diagram for lldb_private::process_linux::IntelPTMultiCoreTrace:
Inheritance graph
[legend]
Collaboration diagram for lldb_private::process_linux::IntelPTMultiCoreTrace:
Collaboration graph
[legend]

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. More...
 
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. More...
 
void ProcessDidStop () override
 
void ProcessWillResume () override
 
TraceIntelPTGetStateResponse GetState () override
 Construct a minimal jLLDBTraceGetState response for this process trace. More...
 
bool TracesThread (lldb::tid_t tid) const override
 
llvm::Error TraceStart (lldb::tid_t tid) override
 Start tracing the thread given by its tid. More...
 
llvm::Error TraceStop (lldb::tid_t tid) override
 Stop tracing the thread given by its tid. More...
 
llvm::Expected< llvm::Optional< std::vector< uint8_t > > > TryGetBinaryData (const TraceGetBinaryDataRequest &request) override
 
- Public Member Functions inherited from lldb_private::process_linux::IntelPTProcessTrace
virtual ~IntelPTProcessTrace ()=default
 

Static Public Member Functions

static llvm::Expected< std::unique_ptr< IntelPTMultiCoreTrace > > StartOnAllCores (const TraceIntelPTStartRequest &request, NativeProcessProtocol &process, llvm::Optional< int > cgroup_fd=llvm::None)
 Start tracing all CPU cores. More...
 

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. More...
 

Private Attributes

llvm::DenseMap< lldb::cpu_id_t, std::pair< IntelPTSingleBufferTrace, ContextSwitchTrace > > m_traces_per_core
 
NativeProcessProtocolm_process
 The target process. More...
 
bool m_using_cgroup_filtering
 

Detailed Description

Definition at line 26 of file IntelPTMultiCoreTrace.h.

Member Typedef Documentation

◆ ContextSwitchTrace

Definition at line 27 of file IntelPTMultiCoreTrace.h.

Constructor & Destructor Documentation

◆ IntelPTMultiCoreTrace()

lldb_private::process_linux::IntelPTMultiCoreTrace::IntelPTMultiCoreTrace ( llvm::DenseMap< lldb::cpu_id_t, std::pair< IntelPTSingleBufferTrace, ContextSwitchTrace >> &&  traces_per_core,
NativeProcessProtocol process,
bool  using_cgroup_filtering 
)
inlineprivate

This assumes that all underlying perf_events for each core are part of the same perf event group.

Definition at line 95 of file IntelPTMultiCoreTrace.h.

Member Function Documentation

◆ ForEachCore() [1/2]

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.

Parameters
[in]callback.cpu_idThe core id that is being traced.
[in]callback.core_traceThe single-buffer trace instance for the given core.

◆ ForEachCore() [2/2]

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.

Parameters
[in]callback.cpu_idThe core id that is being traced.
[in]callback.intelpt_traceThe single-buffer intel pt trace instance for the given core.
[in]callback.context_switch_traceThe perf event collecting context switches for the given core.

◆ GetState()

TraceIntelPTGetStateResponse IntelPTMultiCoreTrace::GetState ( )
overridevirtual

◆ ProcessDidStop()

void IntelPTMultiCoreTrace::ProcessDidStop ( )
overridevirtual

◆ ProcessWillResume()

void IntelPTMultiCoreTrace::ProcessWillResume ( )
overridevirtual

◆ StartOnAllCores()

Expected< std::unique_ptr< IntelPTMultiCoreTrace > > IntelPTMultiCoreTrace::StartOnAllCores ( const TraceIntelPTStartRequest request,
NativeProcessProtocol process,
llvm::Optional< int >  cgroup_fd = llvm::None 
)
static

Start tracing all CPU cores.

Parameters
[in]requestIntel PT configuration parameters.
[in]processThe process being debugged.
[in]cgroup_fdA file descriptor in /sys/fs associated with the cgroup of the process to trace. If not llvm::None, then the trace sesion will use cgroup filtering.
Returns
An IntelPTMultiCoreTrace instance if tracing was successful, or an llvm::Error otherwise.

Definition at line 37 of file IntelPTMultiCoreTrace.cpp.

References lldb_private::process_linux::CreateContextSwitchTracePerfEvent(), lldb_private::process_linux::GetAvailableLogicalCoreIDs(), IncludePerfEventParanoidMessageInError(), and IsTotalBufferLimitReached().

Referenced by lldb_private::process_linux::IntelPTCollector::TraceStart().

◆ TraceStart()

llvm::Error IntelPTMultiCoreTrace::TraceStart ( lldb::tid_t  tid)
overridevirtual

Start tracing the thread given by its tid.

Returns
An error if the operation failed.

Implements lldb_private::process_linux::IntelPTProcessTrace.

Definition at line 135 of file IntelPTMultiCoreTrace.cpp.

◆ TracesThread()

bool IntelPTMultiCoreTrace::TracesThread ( lldb::tid_t  tid) const
overridevirtual

◆ TraceStop()

Error IntelPTMultiCoreTrace::TraceStop ( lldb::tid_t  tid)
overridevirtual

Stop tracing the thread given by its tid.

Returns
An error if the given thread is not being traced or tracing couldn't be stopped.

Implements lldb_private::process_linux::IntelPTProcessTrace.

Definition at line 144 of file IntelPTMultiCoreTrace.cpp.

◆ TryGetBinaryData()

Expected< Optional< std::vector< uint8_t > > > IntelPTMultiCoreTrace::TryGetBinaryData ( const TraceGetBinaryDataRequest request)
overridevirtual
Returns
None if this instance doesn't support the requested data, an llvm::Error if this isntance supports it but fails at fetching it, and Error::success() otherwise.

Implements lldb_private::process_linux::IntelPTProcessTrace.

Definition at line 151 of file IntelPTMultiCoreTrace.cpp.

References lldb_private::TraceGetBinaryDataRequest::cpu_id, and lldb_private::TraceGetBinaryDataRequest::kind.

Member Data Documentation

◆ m_process

NativeProcessProtocol& lldb_private::process_linux::IntelPTMultiCoreTrace::m_process
private

The target process.

Definition at line 108 of file IntelPTMultiCoreTrace.h.

◆ m_traces_per_core

llvm::DenseMap<lldb::cpu_id_t, std::pair<IntelPTSingleBufferTrace, ContextSwitchTrace> > lldb_private::process_linux::IntelPTMultiCoreTrace::m_traces_per_core
private

Definition at line 105 of file IntelPTMultiCoreTrace.h.

◆ m_using_cgroup_filtering

bool lldb_private::process_linux::IntelPTMultiCoreTrace::m_using_cgroup_filtering
private

Definition at line 109 of file IntelPTMultiCoreTrace.h.


The documentation for this class was generated from the following files: