LLDB mainline
|
This class wraps a single perf event collecting intel pt data in a single buffer. More...
#include <IntelPTSingleBufferTrace.h>
Public Member Functions | |
llvm::Expected< std::vector< uint8_t > > | GetBinaryData (const TraceGetBinaryDataRequest &request) const |
llvm::Expected< std::vector< uint8_t > > | GetIptTrace () |
Read the intel pt trace buffer managed by this trace instance. | |
size_t | GetIptTraceSize () const |
llvm::Error | Resume () |
Resume the collection of this trace. | |
llvm::Error | Pause () |
Pause the collection of this trace. | |
const PerfEvent & | GetPerfEvent () const |
Static Public Member Functions | |
static llvm::Expected< IntelPTSingleBufferTrace > | Start (const TraceIntelPTStartRequest &request, std::optional< lldb::tid_t > tid, std::optional< lldb::cpu_id_t > cpu_id=std::nullopt, bool disabled=false, std::optional< int > cgroup_fd=std::nullopt) |
Start tracing using a single Intel PT trace buffer. | |
Private Member Functions | |
IntelPTSingleBufferTrace (PerfEvent &&perf_event) | |
Construct new IntelPTSingleBufferThreadTrace. | |
Private Attributes | |
PerfEvent | m_perf_event |
perf event configured for IntelPT. | |
This class wraps a single perf event collecting intel pt data in a single buffer.
Definition at line 25 of file IntelPTSingleBufferTrace.h.
|
inlineprivate |
Construct new IntelPTSingleBufferThreadTrace.
Users are supposed to create instances of this class via the Start() method and not invoke this one directly.
[in] | perf_event | perf event configured for IntelPT. |
[in] | collection_state | The initial collection state for the provided perf_event. |
Definition at line 105 of file IntelPTSingleBufferTrace.h.
llvm::Expected< std::vector< uint8_t > > lldb_private::process_linux::IntelPTSingleBufferTrace::GetBinaryData | ( | const TraceGetBinaryDataRequest & | request | ) | const |
Expected< std::vector< uint8_t > > IntelPTSingleBufferTrace::GetIptTrace | ( | ) |
Read the intel pt trace buffer managed by this trace instance.
To ensure that the data is up-to-date and is not corrupted by read-write race conditions, the underlying perf_event is paused during read, and later it's returned to its initial state.
Definition at line 213 of file IntelPTSingleBufferTrace.cpp.
References lldb_private::process_linux::PerfEvent::GetReadOnlyAuxBuffer(), and m_perf_event.
size_t IntelPTSingleBufferTrace::GetIptTraceSize | ( | ) | const |
Definition at line 201 of file IntelPTSingleBufferTrace.cpp.
References lldb_private::process_linux::PerfEvent::GetAuxBuffer(), and m_perf_event.
Referenced by lldb_private::process_linux::IntelPTCollector::GetState(), lldb_private::process_linux::IntelPTMultiCoreTrace::GetState(), and lldb_private::process_linux::IntelPTPerThreadProcessTrace::GetState().
const PerfEvent & IntelPTSingleBufferTrace::GetPerfEvent | ( | ) | const |
Definition at line 287 of file IntelPTSingleBufferTrace.cpp.
References m_perf_event.
Error IntelPTSingleBufferTrace::Pause | ( | ) |
Pause the collection of this trace.
Definition at line 205 of file IntelPTSingleBufferTrace.cpp.
References lldb_private::process_linux::PerfEvent::DisableWithIoctl(), and m_perf_event.
Referenced by lldb_private::process_linux::IntelPTMultiCoreTrace::ProcessDidStop().
Error IntelPTSingleBufferTrace::Resume | ( | ) |
Resume the collection of this trace.
Definition at line 209 of file IntelPTSingleBufferTrace.cpp.
References lldb_private::process_linux::PerfEvent::EnableWithIoctl(), and m_perf_event.
Referenced by lldb_private::process_linux::IntelPTMultiCoreTrace::ProcessWillResume().
|
static |
Start tracing using a single Intel PT trace buffer.
[in] | request | Intel PT configuration parameters. |
[in] | tid | The tid of the thread to be traced. If None, then this traces all threads of all processes. |
[in] | cpu_id | The CPU core id where to trace. If None, then this traces all CPUs. |
[in] | disabled | If true, then no data is collected until Resume is invoked. Similarly, if false, data is collected right away until Pause is invoked. |
[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 232 of file IntelPTSingleBufferTrace.cpp.
References lldb_private::TraceIntelPTStartRequest::enable_tsc, lldb_private::GetLog(), lldb_private::process_linux::PerfEvent::Init(), lldb_private::TraceIntelPTStartRequest::ipt_trace_size, LLDB_LOG, lldb_private::TraceIntelPTStartRequest::psb_period, and lldb_private::Trace.
Referenced by lldb_private::process_linux::IntelPTMultiCoreTrace::StartOnAllCores(), and lldb_private::process_linux::IntelPTThreadTraceCollection::TraceStart().
|
private |
perf event configured for IntelPT.
Definition at line 109 of file IntelPTSingleBufferTrace.h.
Referenced by GetIptTrace(), GetIptTraceSize(), GetPerfEvent(), Pause(), and Resume().