LLDB mainline
|
#include <TraceIntelPT.h>
Classes | |
class | PluginProperties |
Properties to be used with the settings command. More... | |
struct | Storage |
We package all the data that can change upon process stops to make sure this contract is very visible. More... | |
Public Types | |
enum class | TraceMode { UserMode , KernelMode } |
Public Types inherited from lldb_private::Trace | |
using | OnBinaryDataReadCallback = std::function< llvm::Error(llvm::ArrayRef< uint8_t > data)> |
using | OnCpusBinaryDataReadCallback = std::function< llvm::Error(const llvm::DenseMap< lldb::cpu_id_t, llvm::ArrayRef< uint8_t > > &cpu_to_data)> |
Public Member Functions | |
void | Dump (Stream *s) const override |
Dump the trace data that this plug-in has access to. | |
llvm::Expected< FileSpec > | SaveToDisk (FileSpec directory, bool compact) override |
Save the trace to the specified directory, which will be created if needed. | |
~TraceIntelPT () override=default | |
lldb::CommandObjectSP | GetProcessTraceStartCommand (CommandInterpreter &interpreter) override |
Get the command handle for the "process trace start" command. | |
lldb::CommandObjectSP | GetThreadTraceStartCommand (CommandInterpreter &interpreter) override |
Get the command handle for the "thread trace start" command. | |
llvm::StringRef | GetSchema () override |
llvm::Expected< lldb::TraceCursorSP > | CreateNewCursor (Thread &thread) override |
Get a TraceCursor for the given thread's trace. | |
void | DumpTraceInfo (Thread &thread, Stream &s, bool verbose, bool json) override |
Dump general info about a given thread's trace. | |
llvm::Expected< std::optional< uint64_t > > | GetRawTraceSize (Thread &thread) |
llvm::Error | DoRefreshLiveProcessState (TraceGetStateResponse state, llvm::StringRef json_response) override |
Method to be overriden by the plug-in to refresh its own state. | |
bool | IsTraced (lldb::tid_t tid) override |
Check if a thread is currently traced by this object. | |
const char * | GetStartConfigurationHelp () override |
llvm::Error | Start (uint64_t ipt_trace_size, uint64_t total_buffer_size_limit, bool enable_tsc, std::optional< uint64_t > psb_period, bool m_per_cpu_tracing, bool disable_cgroup_filtering) |
Start tracing a live process. | |
llvm::Error | Start (StructuredData::ObjectSP configuration=StructuredData::ObjectSP()) override |
Start tracing a live process. | |
llvm::Error | Start (llvm::ArrayRef< lldb::tid_t > tids, uint64_t ipt_trace_size, bool enable_tsc, std::optional< uint64_t > psb_period) |
Start tracing live threads. | |
llvm::Error | Start (llvm::ArrayRef< lldb::tid_t > tids, StructuredData::ObjectSP configuration=StructuredData::ObjectSP()) override |
Start tracing a live process. | |
llvm::Error | OnThreadBufferRead (lldb::tid_t tid, OnBinaryDataReadCallback callback) |
See Trace::OnThreadBinaryDataRead(). | |
llvm::Expected< pt_cpu > | GetCPUInfo () |
Get or fetch the cpu information from, for example, /proc/cpuinfo. | |
std::optional< LinuxPerfZeroTscConversion > | GetPerfZeroTscConversion () |
Get or fetch the values used to convert to and from TSCs and nanos. | |
TaskTimer & | GetTimer () |
ScopedTaskTimer & | GetThreadTimer (lldb::tid_t tid) |
ScopedTaskTimer & | GetGlobalTimer () |
TraceIntelPTSP | GetSharedPtr () |
TraceMode | GetTraceMode () |
Public Member Functions inherited from lldb_private::Trace | |
virtual void | Dump (Stream *s) const =0 |
Dump the trace data that this plug-in has access to. | |
virtual llvm::Expected< FileSpec > | SaveToDisk (FileSpec directory, bool compact)=0 |
Save the trace to the specified directory, which will be created if needed. | |
virtual lldb::CommandObjectSP | GetProcessTraceStartCommand (CommandInterpreter &interpreter)=0 |
Get the command handle for the "process trace start" command. | |
virtual lldb::CommandObjectSP | GetThreadTraceStartCommand (CommandInterpreter &interpreter)=0 |
Get the command handle for the "thread trace start" command. | |
virtual llvm::StringRef | GetSchema ()=0 |
virtual llvm::Expected< lldb::TraceCursorSP > | CreateNewCursor (Thread &thread)=0 |
Get a TraceCursor for the given thread's trace. | |
virtual void | DumpTraceInfo (Thread &thread, Stream &s, bool verbose, bool json)=0 |
Dump general info about a given thread's trace. | |
virtual bool | IsTraced (lldb::tid_t tid)=0 |
Check if a thread is currently traced by this object. | |
virtual const char * | GetStartConfigurationHelp ()=0 |
virtual llvm::Error | Start (StructuredData::ObjectSP configuration=StructuredData::ObjectSP())=0 |
Start tracing a live process. | |
virtual llvm::Error | Start (llvm::ArrayRef< lldb::tid_t > tids, StructuredData::ObjectSP configuration=StructuredData::ObjectSP())=0 |
Start tracing live threads. | |
llvm::Error | Stop (llvm::ArrayRef< lldb::tid_t > tids) |
Stop tracing live threads. | |
llvm::Error | Stop () |
Stop tracing all current and future threads of a live process. | |
uint32_t | GetStopID () |
llvm::Error | OnThreadBinaryDataRead (lldb::tid_t tid, llvm::StringRef kind, OnBinaryDataReadCallback callback) |
Fetch binary data associated with a thread, either live or postmortem, and pass it to the given callback. | |
llvm::Error | OnCpuBinaryDataRead (lldb::cpu_id_t cpu_id, llvm::StringRef kind, OnBinaryDataReadCallback callback) |
Fetch binary data associated with a cpu, either live or postmortem, and pass it to the given callback. | |
llvm::Error | OnAllCpusBinaryDataRead (llvm::StringRef kind, OnCpusBinaryDataReadCallback callback) |
Similar to OnCpuBinaryDataRead but this is able to fetch the same data from all cpus at once. | |
std::vector< Process * > | GetAllProcesses () |
llvm::ArrayRef< lldb::cpu_id_t > | GetTracedCpus () |
Public Member Functions inherited from lldb_private::PluginInterface | |
PluginInterface ()=default | |
virtual | ~PluginInterface ()=default |
virtual llvm::StringRef | GetPluginName ()=0 |
PluginInterface (const PluginInterface &)=delete | |
PluginInterface & | operator= (const PluginInterface &)=delete |
Static Public Member Functions | |
static PluginProperties & | GetGlobalProperties () |
Return the global properties for this trace plug-in. | |
Static Public Member Functions inherited from lldb_private::Trace | |
static llvm::Expected< lldb::TraceSP > | FindPluginForPostMortemProcess (Debugger &debugger, const llvm::json::Value &bundle_description, llvm::StringRef session_file_dir) |
Find a trace plug-in using JSON data. | |
static llvm::Expected< lldb::TraceSP > | FindPluginForLiveProcess (llvm::StringRef plugin_name, Process &process) |
Find a trace plug-in to trace a live process. | |
static llvm::Expected< llvm::StringRef > | FindPluginSchema (llvm::StringRef plugin_name) |
Get the schema of a Trace plug-in given its name. | |
static llvm::Expected< lldb::TraceSP > | LoadPostMortemTraceFromFile (Debugger &debugger, const FileSpec &trace_description_file) |
Load a trace from a trace description file and create Targets, Processes and Threads based on the contents of such file. | |
static llvm::Error | OnDataFileRead (FileSpec file, OnBinaryDataReadCallback callback) |
Helper method for reading a data file and passing its data to the given callback. | |
Private Member Functions | |
llvm::Expected< pt_cpu > | GetCPUInfoForLiveProcess () |
TraceIntelPT (Process &live_process) | |
Constructor for live processes. | |
llvm::Expected< DecodedThreadSP > | Decode (Thread &thread) |
Decode the trace of the given thread that, i.e. | |
llvm::Expected< std::optional< uint64_t > > | FindBeginningOfTimeNanos () |
void | DumpTraceInfoAsJson (Thread &thread, Stream &s, bool verbose) |
Storage & | GetUpdatedStorage () |
Get the storage after refreshing the data in the case of a live process. | |
Private Attributes | |
struct lldb_private::trace_intel_pt::TraceIntelPT::Storage | m_storage |
std::optional< pt_cpu > | m_cpu_info |
It is provided by either a trace bundle or a live process' "cpuInfo" binary data. | |
TraceMode | trace_mode |
The tracing mode of post mortem trace. | |
Friends | |
class | TraceIntelPTBundleLoader |
static void | Initialize () |
static void | Terminate () |
static llvm::Expected< lldb::TraceSP > | CreateInstanceForTraceBundle (const llvm::json::Value &trace_bundle_description, llvm::StringRef bundle_dir, Debugger &debugger) |
Create an instance of this class from a trace bundle. | |
static llvm::Expected< lldb::TraceSP > | CreateInstanceForLiveProcess (Process &process) |
static llvm::StringRef | GetPluginNameStatic () |
static void | DebuggerInitialize (Debugger &debugger) |
llvm::StringRef | GetPluginName () override |
PluginInterface protocol. | |
TraceIntelPT (JSONTraceBundleDescription &bundle_description, llvm::ArrayRef< lldb::ProcessSP > traced_processes, TraceMode trace_mode) | |
This constructor is used by CreateInstanceForPostmortemTrace to get the instance ready before using shared pointers, which is a limitation of C++. | |
static TraceIntelPTSP | CreateInstanceForPostmortemTrace (JSONTraceBundleDescription &bundle_description, llvm::ArrayRef< lldb::ProcessSP > traced_processes, llvm::ArrayRef< lldb::ThreadPostMortemTraceSP > traced_threads, TraceMode trace_mode) |
Postmortem trace constructor. | |
Additional Inherited Members | |
Protected Member Functions inherited from lldb_private::Trace | |
Process * | GetLiveProcess () |
Get the currently traced live process. | |
llvm::ArrayRef< Process * > | GetPostMortemProcesses () |
Get the currently traced postmortem processes. | |
llvm::Expected< std::vector< uint8_t > > | GetLiveTraceBinaryData (const TraceGetBinaryDataRequest &request, uint64_t expected_size) |
Dispatcher for live trace data requests with some additional error checking. | |
llvm::Error | OnLiveThreadBinaryDataRead (lldb::tid_t tid, llvm::StringRef kind, OnBinaryDataReadCallback callback) |
Implementation of OnThreadBinaryDataRead() for live threads. | |
llvm::Error | OnLiveCpuBinaryDataRead (lldb::cpu_id_t cpu, llvm::StringRef kind, OnBinaryDataReadCallback callback) |
Implementation of OnLiveBinaryDataRead() for live cpus. | |
llvm::Error | OnPostMortemThreadBinaryDataRead (lldb::tid_t tid, llvm::StringRef kind, OnBinaryDataReadCallback callback) |
Implementation of OnThreadBinaryDataRead() for post mortem threads. | |
llvm::Error | OnPostMortemCpuBinaryDataRead (lldb::cpu_id_t cpu_id, llvm::StringRef kind, OnBinaryDataReadCallback callback) |
Implementation of OnCpuBinaryDataRead() for post mortem cpus. | |
llvm::Expected< FileSpec > | GetPostMortemThreadDataFile (lldb::tid_t tid, llvm::StringRef kind) |
Get the file path containing data of a postmortem thread given a data identifier. | |
llvm::Expected< FileSpec > | GetPostMortemCpuDataFile (lldb::cpu_id_t cpu_id, llvm::StringRef kind) |
Get the file path containing data of a postmortem cpu given a data identifier. | |
void | SetPostMortemThreadDataFile (lldb::tid_t tid, llvm::StringRef kind, FileSpec file_spec) |
Associate a given thread with a data file using a data identifier. | |
void | SetPostMortemCpuDataFile (lldb::cpu_id_t cpu_id, llvm::StringRef kind, FileSpec file_spec) |
Associate a given cpu with a data file using a data identifier. | |
llvm::Expected< std::vector< uint8_t > > | GetLiveThreadBinaryData (lldb::tid_t tid, llvm::StringRef kind) |
Get binary data of a live thread given a data identifier. | |
llvm::Expected< std::vector< uint8_t > > | GetLiveCpuBinaryData (lldb::cpu_id_t cpu_id, llvm::StringRef kind) |
Get binary data of a live cpu given a data identifier. | |
llvm::Expected< std::vector< uint8_t > > | GetLiveProcessBinaryData (llvm::StringRef kind) |
Get binary data of the current process given a data identifier. | |
std::optional< uint64_t > | GetLiveThreadBinaryDataSize (lldb::tid_t tid, llvm::StringRef kind) |
Get the size of the data returned by GetLiveThreadBinaryData. | |
std::optional< uint64_t > | GetLiveCpuBinaryDataSize (lldb::cpu_id_t cpu_id, llvm::StringRef kind) |
Get the size of the data returned by GetLiveCpuBinaryData. | |
std::optional< uint64_t > | GetLiveProcessBinaryDataSize (llvm::StringRef kind) |
Get the size of the data returned by GetLiveProcessBinaryData. | |
Trace (llvm::ArrayRef< lldb::ProcessSP > postmortem_processes, std::optional< std::vector< lldb::cpu_id_t > > postmortem_cpus) | |
Constructor for post mortem processes. | |
Trace (Process &live_process) | |
Constructor for a live process. | |
llvm::Error | Start (const llvm::json::Value &request) |
Start tracing a live process or its threads. | |
llvm::Expected< std::string > | GetLiveProcessState () |
Get the current tracing state of a live process and its threads. | |
virtual llvm::Error | DoRefreshLiveProcessState (TraceGetStateResponse state, llvm::StringRef json_response)=0 |
Method to be overriden by the plug-in to refresh its own state. | |
std::vector< Process * > | GetTracedProcesses () |
Return the list of processes traced by this instance. | |
const char * | RefreshLiveProcessState () |
Method to be invoked by the plug-in to refresh the live process state. | |
Definition at line 24 of file TraceIntelPT.h.
|
strong |
Enumerator | |
---|---|
UserMode | |
KernelMode |
Definition at line 194 of file TraceIntelPT.h.
|
overridedefault |
|
private |
This constructor is used by CreateInstanceForPostmortemTrace to get the instance ready before using shared pointers, which is a limitation of C++.
|
inlineprivate |
Constructor for live processes.
Definition at line 235 of file TraceIntelPT.h.
Definition at line 117 of file TraceIntelPT.cpp.
References lldb_private::Process::GetTarget(), and lldb_private::Target::SetTrace().
Referenced by Initialize().
|
staticprivate |
Postmortem trace constructor.
[in] | bundle_description | The definition file for the postmortem bundle. |
[in] | traced_processes | The processes traced in the postmortem session. |
[in] | trace_threads | The threads traced in the postmortem session. They must belong to the processes mentioned above. |
[in] | trace_mode | The tracing mode of the postmortem session. |
Definition at line 129 of file TraceIntelPT.cpp.
References lldb_private::trace_intel_pt::JSONCpu::context_switch_trace, lldb_private::trace_intel_pt::JSONTraceBundleDescription::cpus, lldb_private::trace_intel_pt::JSONCpu::id, lldb_private::trace_intel_pt::JSONCpu::ipt_trace, KernelMode, lldb_private::IntelPTDataKinds::kIptTrace, lldb_private::IntelPTDataKinds::kPerfContextSwitchTrace, trace_mode, lldb_private::trace_intel_pt::JSONTraceBundleDescription::tsc_perf_zero_conversion, and UserMode.
Referenced by lldb_private::trace_intel_pt::TraceIntelPTBundleLoader::CreateTraceIntelPTInstance().
|
static |
Create an instance of this class from a trace bundle.
[in] | trace_bundle_description | The description of the trace bundle. See Trace::FindPlugin. |
[in] | bundle_dir | The path to the directory that contains the trace bundle. |
[in] | debugger | The debugger instance where new Targets will be created as part of the JSON data parsing. |
Definition at line 110 of file TraceIntelPT.cpp.
References TraceIntelPTBundleLoader.
Referenced by Initialize(), and Terminate().
|
overridevirtual |
Get a TraceCursor for the given thread's trace.
Implements lldb_private::Trace.
Definition at line 229 of file TraceIntelPT.cpp.
References Decode(), FindBeginningOfTimeNanos(), m_storage, and lldb_private::trace_intel_pt::TraceIntelPT::Storage::tsc_conversion.
|
static |
Definition at line 85 of file TraceIntelPT.cpp.
References lldb_private::PluginManager::CreateSettingForTracePlugin(), GetGlobalProperties(), lldb_private::PluginManager::GetSettingForProcessPlugin(), and lldb_private::trace_intel_pt::TraceIntelPT::PluginProperties::GetSettingName().
Referenced by Initialize().
|
private |
Decode the trace of the given thread that, i.e.
recontruct the traced instructions.
[in] | thread | If thread is a ThreadTrace, then its internal trace file will be decoded. Live threads are not currently supported. |
Definition at line 178 of file TraceIntelPT.cpp.
References error(), lldb_private::UserID::GetID(), GetUpdatedStorage(), lldb_private::trace_intel_pt::TraceIntelPT::Storage::multicpu_decoder, lldb_private::Trace::RefreshLiveProcessState(), and lldb_private::trace_intel_pt::TraceIntelPT::Storage::thread_decoders.
Referenced by CreateNewCursor(), DumpTraceInfo(), and DumpTraceInfoAsJson().
|
overridevirtual |
Method to be overriden by the plug-in to refresh its own state.
This is invoked by RefreshLiveProcessState when a new state is found.
[in] | state | The jLLDBTraceGetState response. |
[in] | json_response | The original JSON response as a string. It might be useful to redecode it if it contains custom data for a specific trace plug-in. |
Implements lldb_private::Trace.
Definition at line 556 of file TraceIntelPT.cpp.
References lldb_private::ThreadList::FindThreadByID(), lldb_private::Trace::GetLiveProcess(), lldb_private::GetLog(), GetSharedPtr(), lldb_private::Process::GetThreadList(), lldb_private::TraceCpuState::id, LLDB_LOG, m_storage, lldb_private::trace_intel_pt::TraceIntelPT::Storage::multicpu_decoder, lldb_private::Target, lldb_private::trace_intel_pt::TraceIntelPT::Storage::thread_decoders, lldb_private::TraceThreadState::tid, lldb_private::TraceGetStateResponse::traced_threads, and lldb_private::trace_intel_pt::TraceIntelPT::Storage::tsc_conversion.
|
overridevirtual |
Dump the trace data that this plug-in has access to.
This function will dump all of the trace data for all threads in a user readable format. Options for dumping can be added as this API is iterated on.
[in] | s | A stream object to dump the information to. |
Implements lldb_private::Trace.
Definition at line 103 of file TraceIntelPT.cpp.
|
overridevirtual |
Dump general info about a given thread's trace.
Each Trace plug-in decides which data to show.
[in] | thread | The thread that owns the trace in question. |
[in] | s | The stream object where the info will be printed printed. |
[in] | verbose | If true, print detailed info If false, print compact info |
Instruction stats
Implements lldb_private::Trace.
Definition at line 242 of file TraceIntelPT.cpp.
References Decode(), DumpTraceInfoAsJson(), lldb_private::TraceCursor::EventKindToString(), lldb_private::trace_intel_pt::DecodedThread::EventsStats::events_counts, lldb_private::trace_intel_pt::DecodedThread::ErrorStats::fatal_errors, lldb_private::trace_intel_pt::ScopedTaskTimer::ForEachTimedTask(), lldb_private::Stream::Format(), GetGlobalTimer(), lldb_private::UserID::GetID(), lldb_private::Thread::GetIndexID(), GetPluginName(), GetRawTraceSize(), GetThreadTimer(), lldb_private::trace_intel_pt::DecodedThread::ErrorStats::GetTotalCount(), GetUpdatedStorage(), IsTraced(), lldb_private::trace_intel_pt::DecodedThread::ErrorStats::libipt_errors, lldb_private::trace_intel_pt::TraceIntelPT::Storage::multicpu_decoder, lldb_private::trace_intel_pt::DecodedThread::ErrorStats::other_errors, lldb_private::toString(), and lldb_private::trace_intel_pt::DecodedThread::EventsStats::total_count.
Definition at line 353 of file TraceIntelPT.cpp.
References lldb_private::Stream::AsRawOstream(), Decode(), lldb_private::trace_intel_pt::DecodedThread::EventsStats::events_counts, lldb_private::trace_intel_pt::DecodedThread::ErrorStats::fatal_errors, lldb_private::trace_intel_pt::ScopedTaskTimer::ForEachTimedTask(), lldb_private::trace_intel_pt::TaskTimer::ForGlobal(), lldb_private::trace_intel_pt::TaskTimer::ForThread(), lldb_private::UserID::GetID(), GetRawTraceSize(), GetTimer(), lldb_private::trace_intel_pt::DecodedThread::ErrorStats::GetTotalCount(), GetUpdatedStorage(), IsTraced(), lldb_private::trace_intel_pt::DecodedThread::ErrorStats::libipt_errors, lldb_private::trace_intel_pt::TraceIntelPT::Storage::multicpu_decoder, lldb_private::trace_intel_pt::DecodedThread::ErrorStats::other_errors, lldb_private::toString(), and lldb_private::trace_intel_pt::DecodedThread::EventsStats::total_count.
Referenced by DumpTraceInfo().
|
private |
Definition at line 192 of file TraceIntelPT.cpp.
References lldb_private::trace_intel_pt::TraceIntelPT::Storage::beginning_of_time_nanos, lldb_private::trace_intel_pt::TraceIntelPT::Storage::beginning_of_time_nanos_calculated, GetUpdatedStorage(), lldb_private::trace_intel_pt::TraceIntelPT::Storage::multicpu_decoder, lldb_private::trace_intel_pt::TraceIntelPT::Storage::thread_decoders, and lldb_private::trace_intel_pt::TraceIntelPT::Storage::tsc_conversion.
Referenced by CreateNewCursor().
Expected< pt_cpu > TraceIntelPT::GetCPUInfo | ( | ) |
Get or fetch the cpu information from, for example, /proc/cpuinfo.
Definition at line 536 of file TraceIntelPT.cpp.
References GetCPUInfoForLiveProcess(), and m_cpu_info.
Referenced by CreateBasicLibiptConfig(), and lldb_private::trace_intel_pt::TraceIntelPTBundleSaver::SaveToDisk().
|
private |
Definition at line 483 of file TraceIntelPT.cpp.
References lldb_private::Trace::GetLiveProcessBinaryData(), and lldb_private::IntelPTDataKinds::kProcFsCpuInfo.
Referenced by GetCPUInfo().
|
static |
Return the global properties for this trace plug-in.
Definition at line 73 of file TraceIntelPT.cpp.
Referenced by DebuggerInitialize(), and PSBBlockAnomalyDetector::PSBBlockAnomalyDetector().
ScopedTaskTimer & TraceIntelPT::GetGlobalTimer | ( | ) |
Definition at line 742 of file TraceIntelPT.cpp.
References lldb_private::trace_intel_pt::TaskTimer::ForGlobal(), and GetTimer().
Referenced by DumpTraceInfo().
std::optional< LinuxPerfZeroTscConversion > TraceIntelPT::GetPerfZeroTscConversion | ( | ) |
Get or fetch the values used to convert to and from TSCs and nanos.
Definition at line 547 of file TraceIntelPT.cpp.
References GetUpdatedStorage(), and lldb_private::trace_intel_pt::TraceIntelPT::Storage::tsc_conversion.
Referenced by lldb_private::trace_intel_pt::ThreadDecoder::DoDecode(), and lldb_private::trace_intel_pt::TraceIntelPTBundleSaver::SaveToDisk().
|
inlineoverridevirtual |
PluginInterface protocol.
Implements lldb_private::PluginInterface.
Definition at line 52 of file TraceIntelPT.h.
References GetPluginNameStatic().
Referenced by DumpTraceInfo(), and Start().
|
inlinestatic |
Definition at line 79 of file TraceIntelPT.h.
Referenced by GetPluginName(), lldb_private::trace_intel_pt::TraceIntelPT::PluginProperties::GetSettingName(), and Initialize().
|
overridevirtual |
Get the command handle for the "process trace start" command.
Implements lldb_private::Trace.
Definition at line 32 of file TraceIntelPT.cpp.
llvm::Expected< std::optional< uint64_t > > TraceIntelPT::GetRawTraceSize | ( | Thread & | thread | ) |
Definition at line 465 of file TraceIntelPT.cpp.
References lldb_private::UserID::GetID(), lldb_private::Trace::GetLiveProcess(), lldb_private::Trace::GetLiveThreadBinaryDataSize(), GetUpdatedStorage(), lldb_private::IntelPTDataKinds::kIptTrace, and OnThreadBufferRead().
Referenced by DumpTraceInfo(), and DumpTraceInfoAsJson().
|
overridevirtual |
Implements lldb_private::Trace.
Definition at line 99 of file TraceIntelPT.cpp.
References lldb_private::trace_intel_pt::TraceIntelPTBundleLoader::GetSchema().
TraceIntelPTSP TraceIntelPT::GetSharedPtr | ( | ) |
Definition at line 123 of file TraceIntelPT.cpp.
Referenced by DoRefreshLiveProcessState().
|
overridevirtual |
Implements lldb_private::Trace.
Definition at line 608 of file TraceIntelPT.cpp.
References lldb_private::trace_intel_pt::kDefaultDisableCgroupFiltering, lldb_private::trace_intel_pt::kDefaultEnableTscValue, lldb_private::trace_intel_pt::kDefaultIptTraceSize, lldb_private::trace_intel_pt::kDefaultPerCpuTracing, lldb_private::trace_intel_pt::kDefaultProcessBufferSizeLimit, and lldb_private::trace_intel_pt::kDefaultPsbPeriod.
ScopedTaskTimer & TraceIntelPT::GetThreadTimer | ( | lldb::tid_t | tid | ) |
Definition at line 738 of file TraceIntelPT.cpp.
References lldb_private::trace_intel_pt::TaskTimer::ForThread(), and GetTimer().
Referenced by lldb_private::trace_intel_pt::ThreadDecoder::DoDecode(), and DumpTraceInfo().
|
overridevirtual |
Get the command handle for the "thread trace start" command.
Implements lldb_private::Trace.
Definition at line 38 of file TraceIntelPT.cpp.
TaskTimer & TraceIntelPT::GetTimer | ( | ) |
Definition at line 736 of file TraceIntelPT.cpp.
References GetUpdatedStorage(), and lldb_private::trace_intel_pt::TraceIntelPT::Storage::task_timer.
Referenced by DumpTraceInfoAsJson(), GetGlobalTimer(), and GetThreadTimer().
TraceIntelPT::TraceMode TraceIntelPT::GetTraceMode | ( | ) |
Definition at line 127 of file TraceIntelPT.cpp.
References trace_mode.
Referenced by lldb_private::trace_intel_pt::TraceIntelPTBundleSaver::SaveToDisk().
|
private |
Get the storage after refreshing the data in the case of a live process.
Definition at line 551 of file TraceIntelPT.cpp.
References m_storage, and lldb_private::Trace::RefreshLiveProcessState().
Referenced by Decode(), DumpTraceInfo(), DumpTraceInfoAsJson(), FindBeginningOfTimeNanos(), GetPerfZeroTscConversion(), GetRawTraceSize(), GetTimer(), and IsTraced().
|
static |
|
overridevirtual |
Check if a thread is currently traced by this object.
[in] | tid | The id of the thread in question. |
Implements lldb_private::Trace.
Definition at line 597 of file TraceIntelPT.cpp.
References GetUpdatedStorage(), lldb_private::trace_intel_pt::TraceIntelPT::Storage::multicpu_decoder, and lldb_private::trace_intel_pt::TraceIntelPT::Storage::thread_decoders.
Referenced by DumpTraceInfo(), and DumpTraceInfoAsJson().
Error TraceIntelPT::OnThreadBufferRead | ( | lldb::tid_t | tid, |
OnBinaryDataReadCallback | callback | ||
) |
See Trace::OnThreadBinaryDataRead().
Definition at line 731 of file TraceIntelPT.cpp.
References lldb_private::IntelPTDataKinds::kIptTrace, and lldb_private::Trace::OnThreadBinaryDataRead().
Referenced by lldb_private::trace_intel_pt::ThreadDecoder::DoDecode(), lldb_private::trace_intel_pt::ThreadDecoder::FindLowestTSC(), and GetRawTraceSize().
Save the trace to the specified directory, which will be created if needed.
This will also create a file <directory>/trace.json with the main properties of the trace session, along with others files which contain the actual trace data. The trace.json file can be used later as input for the "trace load" command to load the trace in LLDB.
[in] | directory | The directory where the trace files will be saved. |
[in] | compact | Try not to save to disk information irrelevant to the traced processes. Each trace plug-in implements this in a different fashion. |
Implements lldb_private::Trace.
Definition at line 105 of file TraceIntelPT.cpp.
References lldb_private::Trace::RefreshLiveProcessState(), and lldb_private::trace_intel_pt::TraceIntelPTBundleSaver::SaveToDisk().
|
overridevirtual |
Start tracing a live process.
[in] | configuration | See SBTrace::Start(const lldb::SBStructuredData &) for more information. |
Implements lldb_private::Trace.
Definition at line 698 of file TraceIntelPT.cpp.
References lldb_private::StructuredData::Object::GetAsDictionary(), lldb_private::trace_intel_pt::kDefaultEnableTscValue, lldb_private::trace_intel_pt::kDefaultIptTraceSize, lldb_private::trace_intel_pt::kDefaultPsbPeriod, lldb_private::trace_intel_pt::ParsingUtils::ParseUserFriendlySizeExpression(), and Start().
llvm::Error TraceIntelPT::Start | ( | llvm::ArrayRef< lldb::tid_t > | tids, |
uint64_t | ipt_trace_size, | ||
bool | enable_tsc, | ||
std::optional< uint64_t > | psb_period | ||
) |
Start tracing live threads.
More information on the parameters below can be found in the jLLDBTraceStart section in lldb/docs/lldb-gdb-remote.txt.
[in] | tids | Threads to trace. |
[in] | ipt_trace_size | Trace size per thread or per cpu core in bytes. |
[in] | enable_tsc | Whether to use enable TSC timestamps or not. |
[in] | psb_period | This value defines the period in which PSB packets will be generated. |
Definition at line 684 of file TraceIntelPT.cpp.
References lldb_private::TraceIntelPTStartRequest::enable_tsc, GetPluginName(), lldb_private::TraceIntelPTStartRequest::ipt_trace_size, lldb_private::TraceIntelPTStartRequest::psb_period, lldb_private::Trace::Start(), lldb_private::TraceStartRequest::tids, lldb_private::trace_intel_pt::toJSON(), and lldb_private::TraceStartRequest::type.
|
overridevirtual |
Start tracing a live process.
[in] | configuration | See SBTrace::Start(const lldb::SBStructuredData &) for more information. |
Implements lldb_private::Trace.
Definition at line 656 of file TraceIntelPT.cpp.
References lldb_private::StructuredData::Object::GetAsDictionary(), lldb_private::trace_intel_pt::kDefaultDisableCgroupFiltering, lldb_private::trace_intel_pt::kDefaultEnableTscValue, lldb_private::trace_intel_pt::kDefaultIptTraceSize, lldb_private::trace_intel_pt::kDefaultPerCpuTracing, lldb_private::trace_intel_pt::kDefaultProcessBufferSizeLimit, lldb_private::trace_intel_pt::kDefaultPsbPeriod, and Start().
Error TraceIntelPT::Start | ( | uint64_t | ipt_trace_size, |
uint64_t | total_buffer_size_limit, | ||
bool | enable_tsc, | ||
std::optional< uint64_t > | psb_period, | ||
bool | m_per_cpu_tracing, | ||
bool | disable_cgroup_filtering | ||
) |
Start tracing a live process.
More information on the parameters below can be found in the jLLDBTraceStart section in lldb/docs/lldb-gdb-remote.txt.
[in] | ipt_trace_size | Trace size per thread in bytes. |
[in] | total_buffer_size_limit | Maximum total trace size per process in bytes. |
[in] | enable_tsc | Whether to use enable TSC timestamps or not. |
[in] | psb_period | This value defines the period in which PSB packets will be generated. |
[in] | per_cpu_tracing | This value defines whether to have an intel pt trace buffer per thread or per cpu core. |
[in] | disable_cgroup_filtering | Disable the cgroup filtering that is automatically applied when doing per cpu tracing. |
Definition at line 641 of file TraceIntelPT.cpp.
References lldb_private::TraceIntelPTStartRequest::disable_cgroup_filtering, lldb_private::TraceIntelPTStartRequest::enable_tsc, GetPluginName(), lldb_private::TraceIntelPTStartRequest::ipt_trace_size, lldb_private::TraceIntelPTStartRequest::per_cpu_tracing, lldb_private::TraceIntelPTStartRequest::process_buffer_size_limit, lldb_private::TraceIntelPTStartRequest::psb_period, lldb_private::Trace::Start(), lldb_private::trace_intel_pt::toJSON(), and lldb_private::TraceStartRequest::type.
Referenced by lldb_private::trace_intel_pt::CommandObjectProcessTraceStartIntelPT::DoExecute(), lldb_private::trace_intel_pt::CommandObjectThreadTraceStartIntelPT::DoExecuteOnThreads(), and Start().
|
static |
Definition at line 95 of file TraceIntelPT.cpp.
References CreateInstanceForTraceBundle(), and lldb_private::PluginManager::UnregisterPlugin().
|
friend |
Definition at line 199 of file TraceIntelPT.h.
Referenced by CreateInstanceForTraceBundle().
|
private |
It is provided by either a trace bundle or a live process' "cpuInfo" binary data.
We don't put it in the Storage because this variable doesn't change.
Definition at line 281 of file TraceIntelPT.h.
Referenced by GetCPUInfo().
|
private |
Referenced by CreateNewCursor(), DoRefreshLiveProcessState(), and GetUpdatedStorage().
|
private |
The tracing mode of post mortem trace.
Definition at line 287 of file TraceIntelPT.h.
Referenced by CreateInstanceForPostmortemTrace(), and GetTraceMode().