From 6e14d1ff457b8101f5fc3b4e8f212e4c59df5899 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 25 May 2024 00:03:23 +0200 Subject: [PATCH] Add summary printer for robin hood. --- extra/natvis.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/extra/natvis.py b/extra/natvis.py index e2c4bfed..3d645033 100644 --- a/extra/natvis.py +++ b/extra/natvis.py @@ -134,12 +134,19 @@ class ZoneEventPrinter: if index == 4: 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): 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.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.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.ShortPtrPrinter -x ^tracy::short_ptr<.+>') debugger.HandleCommand('type synthetic add -w tracy -l natvis.ZoneEventPrinter -x ^tracy::ZoneEvent')