jj10306 updated this revision to Diff 474092. jj10306 added a comment. update the way items with no timestamps are handled
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D137645/new/ 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,16 @@ return m_opaque_sp->GetCPU(); } +bool SBTraceCursor::GetWallClockTime(double &estimated_time) const { + LLDB_INSTRUMENT_VA(this); + + if (const auto &maybe_wall_clock_time = m_opaque_sp->GetWallClockTime()) { + estimated_time = *maybe_wall_clock_time; + return true; + } + return false; +} + 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,19 @@ /// not available for the current item. lldb::cpu_id_t GetCPU() const; + /// Get the approximate wall clock time in nanoseconds at which the current + /// trace item was executed. Each trace plug-in has a different definition for + /// what time 0 means. + /// + /// \param[out] estimated_time + /// The trace item's estimtated timestamp, if available. + /// + /// \return + /// true if the current trace item has an estimated timestamp associated + /// with it, false otherwise. + bool GetWallClockTime(double &estimated_time) 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; + bool GetWallClockTime(double &estimated_time) 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,16 @@ return m_opaque_sp->GetCPU(); } +bool SBTraceCursor::GetWallClockTime(double &estimated_time) const { + LLDB_INSTRUMENT_VA(this); + + if (const auto &maybe_wall_clock_time = m_opaque_sp->GetWallClockTime()) { + estimated_time = *maybe_wall_clock_time; + return true; + } + return false; +} + 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,19 @@ /// not available for the current item. lldb::cpu_id_t GetCPU() const; + /// Get the approximate wall clock time in nanoseconds at which the current + /// trace item was executed. Each trace plug-in has a different definition for + /// what time 0 means. + /// + /// \param[out] estimated_time + /// The trace item's estimtated timestamp, if available. + /// + /// \return + /// true if the current trace item has an estimated timestamp associated + /// with it, false otherwise. + bool GetWallClockTime(double &estimated_time) 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; + bool GetWallClockTime(double &estimated_time) 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