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

walter erquinigo via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Nov 8 10:13:59 PST 2022


wallace requested changes to this revision.
wallace added inline comments.
This revision now requires changes to proceed.


================
Comment at: lldb/include/lldb/API/SBTraceCursor.h:175
+  ///     if not available.
+  double GetWallClockTime() const;
+  /// \}
----------------
mention here that the trace plugin decides how to estimate wall clock time it needed, and that not all trace items are guaranteed to have wall clock time, as it depends on the trace plug-in capabilities


================
Comment at: lldb/source/API/SBTraceCursor.cpp:127-131
+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;
----------------
we don't have optionals in the SB bridge, so you could do the following

  bool SBTraceCursor::GetWallClockTime(double &time) {
    if (const auto &maybe_wall_clock_time = m_opaque_sp->GetWallClockTime()) {
      time = *maybe_wall_clock_time;
      return true;
    }
    return false;
  }


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137645/new/

https://reviews.llvm.org/D137645



More information about the lldb-commits mailing list