Go to the documentation of this file.
9 #ifndef LLDB_SOURCE_PLUGINS_TRACE_INTEL_PT_TRACEINTELPT_H
10 #define LLDB_SOURCE_PLUGINS_TRACE_INTEL_PT_TRACEINTELPT_H
19 #include "llvm/Support/raw_ostream.h"
22 namespace trace_intel_pt {
54 static llvm::Expected<lldb::TraceSP>
56 llvm::StringRef bundle_dir,
59 static llvm::Expected<lldb::TraceSP>
80 llvm::StringRef json_response)
override;
110 llvm::Error Start(uint64_t ipt_trace_size, uint64_t total_buffer_size_limit,
111 bool enable_tsc, llvm::Optional<uint64_t> psb_period,
112 bool m_per_cpu_tracing);
138 llvm::Error Start(llvm::ArrayRef<lldb::tid_t> tids, uint64_t ipt_trace_size,
139 bool enable_tsc, llvm::Optional<uint64_t> psb_period);
184 llvm::ArrayRef<lldb::ProcessSP> traced_processes,
185 llvm::ArrayRef<lldb::ThreadPostMortemTraceSP> traced_threads);
190 llvm::ArrayRef<lldb::ProcessSP> traced_processes);
236 #endif // LLDB_SOURCE_PLUGINS_TRACE_INTEL_PT_TRACEINTELPT_H
We package all the data that can change upon process stops to make sure this contract is very visible...
llvm::StringRef GetPluginName() override
PluginInterface protocol.
std::function< llvm::Error(llvm::ArrayRef< uint8_t > data)> OnBinaryDataReadCallback
llvm::Expected< DecodedThreadSP > Decode(Thread &thread)
Decode the trace of the given thread that, i.e.
llvm::StringRef GetSchema() override
void Dump(Stream *s) const override
Dump the trace data that this plug-in has access to.
static llvm::Expected< lldb::TraceSP > CreateInstanceForLiveProcess(Process &process)
llvm::DenseMap< lldb::tid_t, std::unique_ptr< ThreadDecoder > > thread_decoders
These decoders are used for the non-per-cpu case.
llvm::Optional< LinuxPerfZeroTscConversion > GetPerfZeroTscConversion()
Get or fetch the values used to convert to and from TSCs and nanos.
const char * GetStartConfigurationHelp() override
llvm::Error DoRefreshLiveProcessState(TraceGetStateResponse state, llvm::StringRef json_response) override
Method to be overriden by the plug-in to refresh its own state.
std::shared_ptr< Object > ObjectSP
lldb::CommandObjectSP GetProcessTraceStartCommand(CommandInterpreter &interpreter) override
Get the command handle for the "process trace start" command.
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.
llvm::Optional< LinuxPerfZeroTscConversion > tsc_conversion
It is provided by either a trace bundle or a live process to convert TSC counters to and from nanos.
llvm::Expected< llvm::Optional< uint64_t > > GetRawTraceSize(Thread &thread)
TraceIntelPT(Process &live_process)
Constructor for live processes.
std::shared_ptr< TraceIntelPT > TraceIntelPTSP
bool IsTraced(lldb::tid_t tid) override
Check if a thread is currently traced by this object.
lldb::CommandObjectSP GetThreadTraceStartCommand(CommandInterpreter &interpreter) override
Get the command handle for the "thread trace start" command.
TaskTimer task_timer
Helper variable used to track long running operations for telemetry.
void DumpTraceInfo(Thread &thread, Stream &s, bool verbose) override
Dump general info about a given thread's trace.
static TraceIntelPTSP CreateInstanceForPostmortemTrace(JSONTraceBundleDescription &bundle_description, llvm::ArrayRef< lldb::ProcessSP > traced_processes, llvm::ArrayRef< lldb::ThreadPostMortemTraceSP > traced_threads)
Postmortem trace constructor.
llvm::Expected< lldb::TraceCursorUP > CreateNewCursor(Thread &thread) override
Get a TraceCursor for the given thread's trace.
Class used to track the duration of long running tasks for reporting.
~TraceIntelPT() override=default
TraceIntelPT(JSONTraceBundleDescription &bundle_description, llvm::ArrayRef< lldb::ProcessSP > traced_processes)
This constructor is used by CreateInstanceForPostmortemTrace to get the instance ready before using s...
llvm::Expected< pt_cpu > GetCPUInfoForLiveProcess()
struct lldb_private::trace_intel_pt::TraceIntelPT::Storage m_storage
llvm::Optional< TraceIntelPTMultiCpuDecoder > multicpu_decoder
A class that represents a running process on the host machine.
llvm::Optional< pt_cpu > m_cpu_info
It is provided by either a trace bundle or a live process' "cpuInfo" binary data.
TraceIntelPTSP GetSharedPtr()
llvm::Expected< pt_cpu > GetCPUInfo()
Get or fetch the cpu information from, for example, /proc/cpuinfo.
static llvm::StringRef GetPluginNameStatic()
llvm::Error Start(uint64_t ipt_trace_size, uint64_t total_buffer_size_limit, bool enable_tsc, llvm::Optional< uint64_t > psb_period, bool m_per_cpu_tracing)
Start tracing a live process.
llvm::Error OnThreadBufferRead(lldb::tid_t tid, OnBinaryDataReadCallback callback)
See Trace::OnThreadBinaryDataRead().
Storage & GetUpdatedStorage()
Get the storage after refreshing the data in the case of a live process.
llvm::Error SaveLiveTraceToDisk(FileSpec directory) override
Save the trace of a live process to the specified directory, which will be created if needed.