This is an archive of the discontinued LLVM Phabricator instance.

[trace] Add `SBTraceCursor::GetWallClockTime` API
AcceptedPublic

Authored by jj10306 on Nov 8 2022, 7:35 AM.

Details

Summary

WIP

Diff Detail

Event Timeline

jj10306 created this revision.Nov 8 2022, 7:35 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 8 2022, 7:35 AM
jj10306 requested review of this revision.Nov 8 2022, 7:35 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 8 2022, 7:35 AM
jj10306 added inline comments.Nov 8 2022, 7:36 AM
lldb/source/API/SBTraceCursor.cpp
131

open to suggestions on the best way to indicate that the current item doesn't have a timestamp associated with it

jj10306 edited the summary of this revision. (Show Details)Nov 8 2022, 7:37 AM
hawkinsw added inline comments.
lldb/source/API/SBTraceCursor.cpp
131

Could we use llvm::Optional? Sorry if that is a silly suggestion.

wallace requested changes to this revision.Nov 8 2022, 10:13 AM
wallace added inline comments.
lldb/include/lldb/API/SBTraceCursor.h
175

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

lldb/source/API/SBTraceCursor.cpp
127–131

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;
}
This revision now requires changes to proceed.Nov 8 2022, 10:13 AM
hawkinsw added inline comments.Nov 8 2022, 11:08 AM
lldb/source/API/SBTraceCursor.cpp
127–131

Not that it matters, but *that* was going to be my other suggestion! @wallace is smarter than I am!

jj10306 updated this revision to Diff 474092.Nov 8 2022, 2:39 PM

update the way items with no timestamps are handled

wallace accepted this revision.Nov 8 2022, 10:20 PM
wallace added inline comments.
lldb/source/API/SBTraceCursor.cpp
127–131

<3

This revision is now accepted and ready to land.Nov 8 2022, 10:20 PM