diff --git a/lldb/bindings/interface/SBTraceCursor.i b/lldb/bindings/interface/SBTraceCursor.i --- a/lldb/bindings/interface/SBTraceCursor.i +++ b/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; diff --git a/lldb/include/lldb/API/SBTraceCursor.h b/lldb/include/lldb/API/SBTraceCursor.h --- a/lldb/include/lldb/API/SBTraceCursor.h +++ b/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; diff --git a/lldb/source/API/SBTraceCursor.cpp b/lldb/source/API/SBTraceCursor.cpp --- a/lldb/source/API/SBTraceCursor.cpp +++ b/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);