[Lldb-commits] [lldb] [lldb-dap] Add timestamps to protocol logs (PR #93540)
via lldb-commits
lldb-commits at lists.llvm.org
Tue May 28 05:19:31 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: Pavel Labath (labath)
<details>
<summary>Changes</summary>
I've found them very useful as a rudimentary form of benchmark.
---
Full diff: https://github.com/llvm/llvm-project/pull/93540.diff
1 Files Affected:
- (modified) lldb/tools/lldb-dap/DAP.cpp (+9-4)
``````````diff
diff --git a/lldb/tools/lldb-dap/DAP.cpp b/lldb/tools/lldb-dap/DAP.cpp
index c7eb3db4304a9..d419f821999e6 100644
--- a/lldb/tools/lldb-dap/DAP.cpp
+++ b/lldb/tools/lldb-dap/DAP.cpp
@@ -103,7 +103,9 @@ void DAP::SendJSON(const llvm::json::Value &json) {
SendJSON(json_str);
if (log) {
- *log << "<-- " << std::endl
+ auto now = std::chrono::duration<double>(
+ std::chrono::system_clock::now().time_since_epoch());
+ *log << llvm::formatv("{0:f9} <-- ", now.count()).str() << std::endl
<< "Content-Length: " << json_str.size() << "\r\n\r\n"
<< llvm::formatv("{0:2}", json).str() << std::endl;
}
@@ -130,9 +132,12 @@ std::string DAP::ReadJSON() {
if (!input.read_full(log.get(), length, json_str))
return json_str;
- if (log)
- *log << "--> " << std::endl << "Content-Length: " << length << "\r\n\r\n";
-
+ if (log) {
+ auto now = std::chrono::duration<double>(
+ std::chrono::system_clock::now().time_since_epoch());
+ *log << llvm::formatv("{0:f9} --> ", now.count()).str() << std::endl
+ << "Content-Length: " << length << "\r\n\r\n";
+ }
return json_str;
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/93540
More information about the lldb-commits
mailing list