This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Remove timer from SBModule copy ctor
Needs ReviewPublic

Authored by kastiglione on Jan 19 2023, 11:12 AM.

Details

Summary

The SBModule copy constructor has fast execution, and is high firing. Fast and
frequent functions are not good candidates for timers.

Diff Detail

Event Timeline

kastiglione created this revision.Jan 19 2023, 11:12 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 19 2023, 11:12 AM
kastiglione requested review of this revision.Jan 19 2023, 11:12 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 19 2023, 11:12 AM
This revision was not accepted when it landed; it landed in state Needs Review.Jan 20 2023, 1:00 PM
This revision was automatically updated to reflect the committed changes.
JDevlieghere reopened this revision.Jan 20 2023, 2:19 PM

There's two issues with this patch:

  • LLDB_INSTRUMENT_VA is not the same as LLDB_SCOPED_TIMER. It's used for logging and tracks ABI boundaries. This breaks boundary tracking.
  • Next time someone runs lldb-instr on this file, the tool will just add this again.

If we want to avoid the overhead from the timer, we'll need to adjust the macro.

What about adding a trivial parameter to the macro that has the effect of skipping it in instrumentation if the instrumentation is the costly signpost mechanism?

What about adding a trivial parameter to the macro that has the effect of skipping it in instrumentation if the instrumentation is the costly signpost mechanism?

sounds good to me

What about adding a trivial parameter to the macro that has the effect of skipping it in instrumentation if the instrumentation is the costly signpost mechanism?

The _VA macro is variadic so you'd have to define a new macro, but yeah that's the idea. As discussed offline with Dave, we probably never want timers/signposts for constructors. My suggestion is to re-instrument all constructors with that new "trivial" macro. During the reproducer era constructs required different macros, so there should be code in lldb-instr that can already tell the two apart.