[Lldb-commits] [PATCH] D105741: [trace] Add `thread trace dump ctf -f <filename>` command
Jakob Johnson via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Fri Jul 9 14:51:06 PDT 2021
jj10306 created this revision.
jj10306 added reviewers: wallace, clayborg.
Herald added subscribers: dang, mgorny.
jj10306 requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
This diff enables visualization of Intel PT traces by converting a summarized trace representation (HTR) to Chrome Trace Format (CTF) via the `thread trace dump ctf -f <filename>` command - see attached video for an example of Intel PT trace visualization.
**Context**
To efficiently store and operate on traces we introduce HTR (Hierarchical Trace Representation). HTR is designed to be extensible and agnostic to trace type. In HTR, a trace is transformed in a way akin to compiler passes. Each pass modifies the trace and outputs a new HTR-based representation of the trace. A **layer** is each instance of trace data between passes.
A layer is composed of **blocks** - a block in //layer n// refers to a sequence of blocks in //layer n - 1//. The blocks in the first layer correspond to a dynamic instruction in the trace.
A **pass** is applied to a layer to extract useful information (summarization) and compress the trace representation into a new layer. The idea is to have a series of passes where each pass specializes in extracting certain information about the trace. Some examples of potential passes include: identifying functions, identifying loops, or a more general purpose such as identifying long sequences of instructions that are repeated. This diff contains one such pass - //Basic Super Block Reduction//.
**Overview of Changes**
- Add basic HTR structures (layer, block, block metadata)
- Implement Super Basic Block Reduction Pass (HeadsAndTailsMerge in the code) to identify and merge patterns of repeated instructions
- Add 'thread trace dump ctf' command to export the HTR of an Intel PT trace to Chrome Trace Format (CTF)
F17851042: lldbdemo.mov <https://reviews.llvm.org/F17851042>
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D105741
Files:
lldb/include/lldb/Target/Trace.h
lldb/include/lldb/Target/TraceHTR.h
lldb/source/Commands/CommandObjectThread.cpp
lldb/source/Commands/Options.td
lldb/source/Target/CMakeLists.txt
lldb/source/Target/Trace.cpp
lldb/source/Target/TraceCursor.cpp
lldb/source/Target/TraceHTR.cpp
lldb/test/API/commands/trace/TestTraceDumpCTF.py
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105741.357641.patch
Type: text/x-patch
Size: 32853 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210709/8914b477/attachment-0001.bin>
More information about the lldb-commits
mailing list