aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandObjectThread.cpp
diff options
context:
space:
mode:
authorymeng <ymeng@devvm4974.frc0.facebook.com>2022-07-07 06:52:04 -0700
committerWalter Erquinigo <wallace@fb.com>2022-07-13 12:26:11 -0700
commit0466d1df23b9157144c32e03f6477ed250991215 (patch)
tree6e920bd7ca325159f118dbd84e08fa00241a6abb /lldb/source/Commands/CommandObjectThread.cpp
parentd30fd5c3a17b5b8301e3413ae9b398ca7ee1f69c (diff)
downloadllvm-0466d1df23b9157144c32e03f6477ed250991215.zip
llvm-0466d1df23b9157144c32e03f6477ed250991215.tar.gz
llvm-0466d1df23b9157144c32e03f6477ed250991215.tar.bz2
[trace][intel pt] Support dumping the trace info in json
Thanks to ymeng@fb.com for coming up with this change. `thread trace dump info` can dump some metrics that can be useful for analyzing the performance and quality of a trace. This diff adds a --json option for dumping this information in json format that can be easily understood my machines. Differential Revision: https://reviews.llvm.org/D129332
Diffstat (limited to 'lldb/source/Commands/CommandObjectThread.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectThread.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/lldb/source/Commands/CommandObjectThread.cpp b/lldb/source/Commands/CommandObjectThread.cpp
index 1b92702..ad49d27 100644
--- a/lldb/source/Commands/CommandObjectThread.cpp
+++ b/lldb/source/Commands/CommandObjectThread.cpp
@@ -2351,6 +2351,10 @@ public:
m_verbose = true;
break;
}
+ case 'j': {
+ m_json = true;
+ break;
+ }
default:
llvm_unreachable("Unimplemented option");
}
@@ -2359,6 +2363,7 @@ public:
void OptionParsingStarting(ExecutionContext *execution_context) override {
m_verbose = false;
+ m_json = false;
}
llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
@@ -2367,15 +2372,9 @@ public:
// Instance variables to hold the values for command options.
bool m_verbose;
+ bool m_json;
};
- bool DoExecute(Args &command, CommandReturnObject &result) override {
- Target &target = m_exe_ctx.GetTargetRef();
- result.GetOutputStream().Format("Trace technology: {0}\n",
- target.GetTrace()->GetPluginName());
- return CommandObjectIterateOverThreads::DoExecute(command, result);
- }
-
CommandObjectTraceDumpInfo(CommandInterpreter &interpreter)
: CommandObjectIterateOverThreads(
interpreter, "thread trace dump info",
@@ -2397,7 +2396,7 @@ protected:
ThreadSP thread_sp =
m_exe_ctx.GetProcessPtr()->GetThreadList().FindThreadByID(tid);
trace_sp->DumpTraceInfo(*thread_sp, result.GetOutputStream(),
- m_options.m_verbose);
+ m_options.m_verbose, m_options.m_json);
return true;
}