
This diff introduces Hierarchical Trace Representation (HTR) and creates the `thread trace export ctf -f <filename> -t <thread_id>` command to export an Intel PT trace's HTR to Chrome Trace Format (CTF) for visualization. See `lldb/docs/htr.rst` for context/documentation on HTR. **Overview of Changes** - Add HTR documentation (see `lldb/docs/htr.rst`) - Add HTR structures (layer, block, block metadata) - Implement "Basic Super Block" HTR pass - Add 'thread trace export ctf' command to export the HTR of an Intel PT trace to Chrome Trace Format (CTF) As this diff is the first iteration of HTR and trace visualization, future diffs will build on this work by generalizing the internal design of HTR and implementing new HTR passes that provide better trace summarization/visualization. See attached video for an example of Intel PT trace visualization: {F17851042} Original Author: jj10306 Submitted by: wallace Reviewed By: wallace, clayborg Differential Revision: https://reviews.llvm.org/D105741
59 lines
2.1 KiB
C++
59 lines
2.1 KiB
C++
//===-- CommandObjectThreadTraceExportCTF.h -------------------*- C++ //-*-===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef LLDB_SOURCE_PLUGINS_TRACE_INTEL_PT_COMMANDOBJECTTHREADTRACEEXPORTCTF_H
|
|
#define LLDB_SOURCE_PLUGINS_TRACE_INTEL_PT_COMMANDOBJECTTHREADTRACEEXPORTCTF_H
|
|
|
|
#include "TraceExporterCTF.h"
|
|
#include "lldb/Interpreter/CommandInterpreter.h"
|
|
#include "lldb/Interpreter/CommandReturnObject.h"
|
|
|
|
namespace lldb_private {
|
|
namespace ctf {
|
|
|
|
class CommandObjectThreadTraceExportCTF : public CommandObjectParsed {
|
|
public:
|
|
class CommandOptions : public Options {
|
|
public:
|
|
CommandOptions() : Options() { OptionParsingStarting(nullptr); }
|
|
|
|
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg,
|
|
ExecutionContext *execution_context) override;
|
|
|
|
void OptionParsingStarting(ExecutionContext *execution_context) override;
|
|
|
|
llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
|
|
|
|
llvm::Optional<size_t> m_thread_index;
|
|
std::string m_file;
|
|
};
|
|
|
|
CommandObjectThreadTraceExportCTF(CommandInterpreter &interpreter)
|
|
: CommandObjectParsed(
|
|
interpreter, "thread trace export ctf",
|
|
"Export a given thread's trace to Chrome Trace Format",
|
|
"thread trace export ctf [<ctf-options>]",
|
|
lldb::eCommandRequiresProcess | lldb::eCommandTryTargetAPILock |
|
|
lldb::eCommandProcessMustBeLaunched |
|
|
lldb::eCommandProcessMustBePaused |
|
|
lldb::eCommandProcessMustBeTraced),
|
|
m_options() {}
|
|
|
|
Options *GetOptions() override { return &m_options; }
|
|
|
|
protected:
|
|
bool DoExecute(Args &command, CommandReturnObject &result) override;
|
|
|
|
CommandOptions m_options;
|
|
};
|
|
|
|
} // namespace ctf
|
|
} // namespace lldb_private
|
|
|
|
#endif // LLDB_SOURCE_PLUGINS_TRACE_INTEL_PT_COMMANDOBJECTTHREADTRACEEXPORTCTF_H
|