Path: blob/main/contrib/llvm-project/lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.h
39645 views
//===-- TraceCursorIntelPT.h ------------------------------------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#ifndef LLDB_SOURCE_PLUGINS_TRACE_INTEL_PT_TRACECURSORINTELPT_H9#define LLDB_SOURCE_PLUGINS_TRACE_INTEL_PT_TRACECURSORINTELPT_H1011#include "ThreadDecoder.h"12#include <optional>1314namespace lldb_private {15namespace trace_intel_pt {1617class TraceCursorIntelPT : public TraceCursor {18public:19TraceCursorIntelPT(20lldb::ThreadSP thread_sp, DecodedThreadSP decoded_thread_sp,21const std::optional<LinuxPerfZeroTscConversion> &tsc_conversion,22std::optional<uint64_t> beginning_of_time_nanos);2324bool Seek(int64_t offset, lldb::TraceCursorSeekType origin) override;2526void Next() override;2728bool HasValue() const override;2930llvm::StringRef GetError() const override;3132lldb::addr_t GetLoadAddress() const override;3334lldb::TraceEvent GetEventType() const override;3536lldb::cpu_id_t GetCPU() const override;3738std::optional<uint64_t> GetHWClock() const override;3940lldb::TraceItemKind GetItemKind() const override;4142bool GoToId(lldb::user_id_t id) override;4344lldb::user_id_t GetId() const override;4546bool HasId(lldb::user_id_t id) const override;4748std::optional<double> GetWallClockTime() const override;4950std::optional<std::string> GetSyncPointMetadata() const override;5152private:53/// Clear the current TSC and nanoseconds ranges if after moving they are not54/// valid anymore.55void ClearTimingRangesIfInvalid();5657/// Get or calculate the TSC range that includes the current trace item.58const std::optional<DecodedThread::TSCRange> &GetTSCRange() const;5960/// Get or calculate the TSC range that includes the current trace item.61const std::optional<DecodedThread::NanosecondsRange> &62GetNanosecondsRange() const;6364/// Storage of the actual instructions65DecodedThreadSP m_decoded_thread_sp;66/// Internal instruction index currently pointing at.67int64_t m_pos;6869/// Timing information and cached values.70/// \{7172/// TSC -> nanos conversion utility. \a std::nullopt if not available at all.73std::optional<LinuxPerfZeroTscConversion> m_tsc_conversion;74/// Lowest nanoseconds timestamp seen in any thread trace, \a std::nullopt if75/// not available at all.76std::optional<uint64_t> m_beginning_of_time_nanos;77/// Range of trace items with the same TSC that includes the current trace78/// item, \a std::nullopt if not calculated or not available.79std::optional<DecodedThread::TSCRange> mutable m_tsc_range;80bool mutable m_tsc_range_calculated = false;81/// Range of trace items with the same non-interpolated timestamps in82/// nanoseconds that includes the current trace item, \a std::nullopt if not83/// calculated or not available.84std::optional<DecodedThread::NanosecondsRange> mutable m_nanoseconds_range;85bool mutable m_nanoseconds_range_calculated = false;86/// \}87};8889} // namespace trace_intel_pt90} // namespace lldb_private9192#endif // LLDB_SOURCE_PLUGINS_TRACE_INTEL_PT_TRACECURSORINTELPT_H939495