22 const std::optional<LinuxPerfZeroTscConversion> &tsc_conversion,
23 std::optional<uint64_t> beginning_of_time_nanos)
24 :
TraceCursor(thread_sp), m_decoded_thread_sp(decoded_thread_sp),
25 m_tsc_conversion(tsc_conversion),
26 m_beginning_of_time_nanos(beginning_of_time_nanos) {
52const std::optional<DecodedThread::TSCRange> &
61const std::optional<DecodedThread::NanosecondsRange> &
107 if (
const std::optional<DecodedThread::TSCRange> &range =
GetTSCRange())
113 if (
const std::optional<DecodedThread::NanosecondsRange> &range =
143 return formatv(
"offset = 0x{0:x}",
Class used for iterating over the instructions of a thread's trace, among other kinds of information.
bool IsForwards() const
Check if the direction to use in the TraceCursor::Next() method is forwards.
void ClearTimingRangesIfInvalid()
Clear the current TSC and nanoseconds ranges if after moving they are not valid anymore.
TraceCursorIntelPT(lldb::ThreadSP thread_sp, DecodedThreadSP decoded_thread_sp, const std::optional< LinuxPerfZeroTscConversion > &tsc_conversion, std::optional< uint64_t > beginning_of_time_nanos)
std::optional< uint64_t > GetHWClock() const override
Get the last hardware clock value that was emitted before the current trace item.
lldb::TraceItemKind GetItemKind() const override
Trace item information (instructions, errors and events)
std::optional< DecodedThread::TSCRange > m_tsc_range
Range of trace items with the same TSC that includes the current trace item, std::nullopt if not calc...
std::optional< double > GetWallClockTime() const override
Get the approximate wall clock time in nanoseconds at which the current trace item was executed.
std::optional< std::string > GetSyncPointMetadata() const override
Get some metadata associated with a synchronization point event.
bool HasValue() const override
const std::optional< DecodedThread::NanosecondsRange > & GetNanosecondsRange() const
Get or calculate the TSC range that includes the current trace item.
lldb::TraceEvent GetEventType() const override
lldb::addr_t GetLoadAddress() const override
lldb::cpu_id_t GetCPU() const override
Get the CPU associated with the current trace item.
void Next() override
Move the cursor to the next item (instruction or error).
bool m_tsc_range_calculated
llvm::StringRef GetError() const override
std::optional< LinuxPerfZeroTscConversion > m_tsc_conversion
Timing information and cached values.
DecodedThreadSP m_decoded_thread_sp
Storage of the actual instructions.
bool m_nanoseconds_range_calculated
int64_t m_pos
Internal instruction index currently pointing at.
std::optional< uint64_t > m_beginning_of_time_nanos
Lowest nanoseconds timestamp seen in any thread trace, std::nullopt if not available at all.
std::optional< DecodedThread::NanosecondsRange > m_nanoseconds_range
Range of trace items with the same non-interpolated timestamps in nanoseconds that includes the curre...
bool GoToId(lldb::user_id_t id) override
Instruction identifiers:
bool Seek(int64_t offset, lldb::TraceCursorSeekType origin) override
Make the cursor point to an item in the trace based on an origin point and an offset.
const std::optional< DecodedThread::TSCRange > & GetTSCRange() const
Get or calculate the TSC range that includes the current trace item.
bool HasId(lldb::user_id_t id) const override
lldb::user_id_t GetId() const override
std::shared_ptr< DecodedThread > DecodedThreadSP
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::Thread > ThreadSP
TraceEvent
Events that might happen during a trace session.
TraceCursorSeekType
Enum to indicate the reference point when invoking TraceCursor::Seek().
@ eTraceCursorSeekTypeCurrent
The current position in the trace.
@ eTraceCursorSeekTypeEnd
The end of the trace, i.e the most recent item.
@ eTraceCursorSeekTypeBeginning
The beginning of the trace, i.e the oldest item.