[Lldb-commits] [PATCH] D137645: [trace] Add `SBTraceCursor::GetWallClockTime` API

Jakob Johnson via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Nov 8 07:35:19 PST 2022


jj10306 created this revision.
jj10306 added reviewers: wallace, persona0220.
Herald added a project: All.
jj10306 requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Test Plan:


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D137645

Files:
  lldb/bindings/interface/SBTraceCursor.i
  lldb/include/lldb/API/SBTraceCursor.h
  lldb/source/API/SBTraceCursor.cpp


Index: lldb/source/API/SBTraceCursor.cpp
===================================================================
--- lldb/source/API/SBTraceCursor.cpp
+++ lldb/source/API/SBTraceCursor.cpp
@@ -124,6 +124,13 @@
   return m_opaque_sp->GetCPU();
 }
 
+double SBTraceCursor::GetWallClockTime() const {
+  LLDB_INSTRUMENT_VA(this);
+
+  const auto &maybe_wall_clock_time = m_opaque_sp->GetWallClockTime();
+  return maybe_wall_clock_time ? *maybe_wall_clock_time : -1.0;
+}
+
 bool SBTraceCursor::IsValid() const {
   LLDB_INSTRUMENT_VA(this);
 
Index: lldb/include/lldb/API/SBTraceCursor.h
===================================================================
--- lldb/include/lldb/API/SBTraceCursor.h
+++ lldb/include/lldb/API/SBTraceCursor.h
@@ -169,6 +169,12 @@
   ///    not available for the current item.
   lldb::cpu_id_t GetCPU() const;
 
+  /// \return
+  ///     The approximate wall clock time for the trace item, or \a -1.0
+  ///     if not available.
+  double GetWallClockTime() const;
+  /// \}
+
   bool IsValid() const;
 
   explicit operator bool() const;
Index: lldb/bindings/interface/SBTraceCursor.i
===================================================================
--- lldb/bindings/interface/SBTraceCursor.i
+++ lldb/bindings/interface/SBTraceCursor.i
@@ -51,6 +51,8 @@
 
   lldb::cpu_id_t GetCPU() const;
 
+  double GetWallClockTime() const;
+
   bool IsValid() const;
 
   explicit operator bool() const;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137645.474005.patch
Type: text/x-patch
Size: 1424 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20221108/e0ae91ba/attachment.bin>


More information about the lldb-commits mailing list