mirror of
https://github.com/esphome/esphome.git
synced 2026-09-22 20:48:43 +00:00
Merge branch 'analyze-memory-pstorage-attribution' into integration
This commit is contained in:
@@ -191,11 +191,13 @@ class MemoryAnalyzerCLI(MemoryAnalyzer):
|
||||
for i, (_, demangled, size, section, component) in enumerate(top_symbols):
|
||||
# Format section label
|
||||
section_label = f"[{section[1:]}]" if section else ""
|
||||
# Truncate demangled name if too long
|
||||
# Format storage symbols readably
|
||||
display_name = _format_pstorage_name(demangled)
|
||||
# Truncate if too long
|
||||
demangled_display = (
|
||||
f"{demangled[:truncate_limit]}..."
|
||||
if len(demangled) > self.COL_TOP_SYMBOL_NAME
|
||||
else demangled
|
||||
f"{display_name[:truncate_limit]}..."
|
||||
if len(display_name) > self.COL_TOP_SYMBOL_NAME
|
||||
else display_name
|
||||
)
|
||||
lines.append(
|
||||
f"{i + 1:>2}. {size:>7,} B {section_label:<8} {demangled_display:<{self.COL_TOP_SYMBOL_NAME}} {component}"
|
||||
|
||||
@@ -586,8 +586,11 @@ def Pvariable(id_: ID, rhs: SafeExpType, type_: "MockObj" = None) -> "MockObj":
|
||||
the_type = id_.type
|
||||
# Extract component namespace from type for memory analysis attribution
|
||||
type_str = str(the_type)
|
||||
if "::" in type_str:
|
||||
component_ns = type_str.split("::", maxsplit=1)[0].rstrip("_")
|
||||
# Strip leading esphome:: to get the component namespace
|
||||
# e.g. esphome::dsmr::Dsmr -> dsmr, logger::Logger -> logger
|
||||
bare = type_str.removeprefix("esphome::")
|
||||
if "::" in bare:
|
||||
component_ns = bare.split("::", maxsplit=1)[0].rstrip("_")
|
||||
else:
|
||||
component_ns = "esphome"
|
||||
storage_name = f"{component_ns}__{id_.id}__pstorage"
|
||||
|
||||
Reference in New Issue
Block a user