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

Manages a list of thread traces. More...

#include <IntelPTThreadTraceCollection.h>

Public Member Functions

 IntelPTThreadTraceCollection ()
 
void Clear ()
 Dispose of all traces.
 
bool TracesThread (lldb::tid_t tid) const
 
size_t GetTotalBufferSize () const
 
void ForEachThread (std::function< void(lldb::tid_t tid, IntelPTSingleBufferTrace &thread_trace)> callback)
 Execute the provided callback on each thread that is being traced.
 
llvm::Expected< IntelPTSingleBufferTrace & > GetTracedThread (lldb::tid_t tid)
 
llvm::Error TraceStart (lldb::tid_t tid, const TraceIntelPTStartRequest &request)
 Start tracing the thread given by its tid.
 
llvm::Error TraceStop (lldb::tid_t tid)
 Stop tracing the thread given by its tid.
 
size_t GetTracedThreadsCount () const
 
llvm::Expected< std::optional< std::vector< uint8_t > > > TryGetBinaryData (const TraceGetBinaryDataRequest &request)
 

Private Attributes

llvm::DenseMap< lldb::tid_t, IntelPTSingleBufferTracem_thread_traces
 
size_t m_total_buffer_size = 0
 Total actual thread buffer size in bytes.
 

Detailed Description

Manages a list of thread traces.

Definition at line 19 of file IntelPTThreadTraceCollection.h.

Constructor & Destructor Documentation

◆ IntelPTThreadTraceCollection()

lldb_private::process_linux::IntelPTThreadTraceCollection::IntelPTThreadTraceCollection ( )
inline

Definition at line 21 of file IntelPTThreadTraceCollection.h.

Member Function Documentation

◆ Clear()

void IntelPTThreadTraceCollection::Clear ( )

Dispose of all traces.

Definition at line 67 of file IntelPTThreadTraceCollection.cpp.

References m_thread_traces, and m_total_buffer_size.

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

◆ ForEachThread()

void IntelPTThreadTraceCollection::ForEachThread ( std::function< void(lldb::tid_t tid, IntelPTSingleBufferTrace &thread_trace)>  callback)

Execute the provided callback on each thread that is being traced.

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

Definition at line 51 of file IntelPTThreadTraceCollection.cpp.

References m_thread_traces.

Referenced by lldb_private::process_linux::IntelPTCollector::GetState(), and lldb_private::process_linux::IntelPTPerThreadProcessTrace::GetState().

◆ GetTotalBufferSize()

size_t IntelPTThreadTraceCollection::GetTotalBufferSize ( ) const
Returns
The total sum of the intel pt trace buffer sizes used by this collection.

Definition at line 47 of file IntelPTThreadTraceCollection.cpp.

References m_total_buffer_size.

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

◆ GetTracedThread()

Expected< IntelPTSingleBufferTrace & > IntelPTThreadTraceCollection::GetTracedThread ( lldb::tid_t  tid)

Definition at line 59 of file IntelPTThreadTraceCollection.cpp.

References m_thread_traces.

Referenced by TryGetBinaryData().

◆ GetTracedThreadsCount()

size_t IntelPTThreadTraceCollection::GetTracedThreadsCount ( ) const

◆ TraceStart()

Error IntelPTThreadTraceCollection::TraceStart ( lldb::tid_t  tid,
const TraceIntelPTStartRequest request 
)

◆ TracesThread()

bool IntelPTThreadTraceCollection::TracesThread ( lldb::tid_t  tid) const

◆ TraceStop()

Error IntelPTThreadTraceCollection::TraceStop ( lldb::tid_t  tid)

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.

Definition at line 21 of file IntelPTThreadTraceCollection.cpp.

References m_thread_traces, and m_total_buffer_size.

Referenced by lldb_private::process_linux::IntelPTCollector::OnThreadDestroyed(), lldb_private::process_linux::IntelPTCollector::TraceStop(), and lldb_private::process_linux::IntelPTPerThreadProcessTrace::TraceStop().

◆ TryGetBinaryData()

llvm::Expected< std::optional< std::vector< uint8_t > > > IntelPTThreadTraceCollection::TryGetBinaryData ( const TraceGetBinaryDataRequest request)

Returns
std::nullopt 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.

Definition at line 77 of file IntelPTThreadTraceCollection.cpp.

References GetTracedThread(), lldb_private::TraceGetBinaryDataRequest::kind, lldb_private::IntelPTDataKinds::kIptTrace, lldb_private::TraceGetBinaryDataRequest::tid, and TracesThread().

Referenced by lldb_private::process_linux::IntelPTCollector::GetBinaryData(), and lldb_private::process_linux::IntelPTPerThreadProcessTrace::TryGetBinaryData().

Member Data Documentation

◆ m_thread_traces

llvm::DenseMap<lldb::tid_t, IntelPTSingleBufferTrace> lldb_private::process_linux::IntelPTThreadTraceCollection::m_thread_traces
private

◆ m_total_buffer_size

size_t lldb_private::process_linux::IntelPTThreadTraceCollection::m_total_buffer_size = 0
private

Total actual thread buffer size in bytes.

Definition at line 71 of file IntelPTThreadTraceCollection.h.

Referenced by Clear(), GetTotalBufferSize(), TraceStart(), and TraceStop().


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