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;


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;
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to