Add summary printer for robin hood.

This commit is contained in:
Bartosz Taudul 2024-05-25 00:03:23 +02:00
parent 535a2c8504
commit 6e14d1ff45
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -134,12 +134,19 @@ class ZoneEventPrinter:
if index == 4: if index == 4:
return self.val.CreateValueFromExpression('extra', f'uint32_t x = {self.extra}; x') return self.val.CreateValueFromExpression('extra', f'uint32_t x = {self.extra}; x')
def RobinHoodSummary(value, dict):
val = value.GetNonSyntheticValue()
size = val.GetChildMemberWithName('mNumElements').GetValueAsUnsigned()
mask = val.GetChildMemberWithName('mMask').GetValueAsUnsigned()
return f'{{size={size}, load={float(size) / (mask+1)}}}'
def __lldb_init_module(debugger, dict): def __lldb_init_module(debugger, dict):
lldb.formatters.Logger._lldb_formatters_debug_level = 2 lldb.formatters.Logger._lldb_formatters_debug_level = 2
debugger.HandleCommand('type summary add -w tracy -F natvis.VectorSummary -x ^tracy::Vector<.+>') debugger.HandleCommand('type summary add -w tracy -F natvis.VectorSummary -x ^tracy::Vector<.+>')
debugger.HandleCommand('type summary add -w tracy -F natvis.ShortPtrSummary -x ^tracy::short_ptr<.+>') debugger.HandleCommand('type summary add -w tracy -F natvis.ShortPtrSummary -x ^tracy::short_ptr<.+>')
debugger.HandleCommand('type summary add -w tracy -F natvis.Int24Summary -x ^tracy::Int24') debugger.HandleCommand('type summary add -w tracy -F natvis.Int24Summary -x ^tracy::Int24')
debugger.HandleCommand('type summary add -w tracy -F natvis.Int48Summary -x ^tracy::Int48') debugger.HandleCommand('type summary add -w tracy -F natvis.Int48Summary -x ^tracy::Int48')
debugger.HandleCommand('type summary add -w tracy -F natvis.RobinHoodSummary -x ^tracy::detail::Table<.*>')
debugger.HandleCommand('type synthetic add -w tracy -l natvis.VectorPrinter -x ^tracy::Vector<.+>') debugger.HandleCommand('type synthetic add -w tracy -l natvis.VectorPrinter -x ^tracy::Vector<.+>')
debugger.HandleCommand('type synthetic add -w tracy -l natvis.ShortPtrPrinter -x ^tracy::short_ptr<.+>') debugger.HandleCommand('type synthetic add -w tracy -l natvis.ShortPtrPrinter -x ^tracy::short_ptr<.+>')
debugger.HandleCommand('type synthetic add -w tracy -l natvis.ZoneEventPrinter -x ^tracy::ZoneEvent') debugger.HandleCommand('type synthetic add -w tracy -l natvis.ZoneEventPrinter -x ^tracy::ZoneEvent')