Path: blob/main/contrib/llvm-project/lldb/source/Plugins/Trace/intel-pt/ThreadDecoder.h
39645 views
//===-- ThreadDecoder.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_THREAD_DECODER_H9#define LLDB_SOURCE_PLUGINS_TRACE_THREAD_DECODER_H1011#include "DecodedThread.h"12#include "forward-declarations.h"13#include "intel-pt.h"14#include "lldb/Target/Process.h"15#include "lldb/Utility/FileSpec.h"16#include <optional>1718namespace lldb_private {19namespace trace_intel_pt {2021/// Class that handles the decoding of a thread and caches the result.22class ThreadDecoder {23public:24/// \param[in] thread_sp25/// The thread whose intel pt trace buffer will be decoded.26///27/// \param[in] trace28/// The main Trace object who owns this decoder and its data.29ThreadDecoder(const lldb::ThreadSP &thread_sp, TraceIntelPT &trace);3031/// Decode the thread and store the result internally, to avoid32/// recomputations.33///34/// \return35/// A \a DecodedThread instance.36llvm::Expected<DecodedThreadSP> Decode();3738/// \return39/// The lowest TSC value in this trace if available, \a std::nullopt if40/// the trace is empty or the trace contains no timing information, or an41/// \a llvm::Error if it was not possible to set up the decoder.42llvm::Expected<std::optional<uint64_t>> FindLowestTSC();4344ThreadDecoder(const ThreadDecoder &other) = delete;45ThreadDecoder &operator=(const ThreadDecoder &other) = delete;4647private:48llvm::Expected<DecodedThreadSP> DoDecode();4950lldb::ThreadSP m_thread_sp;51TraceIntelPT &m_trace;52std::optional<DecodedThreadSP> m_decoded_thread;53};5455} // namespace trace_intel_pt56} // namespace lldb_private5758#endif // LLDB_SOURCE_PLUGINS_TRACE_THREAD_DECODER_H596061