mirror of
https://github.com/esphome/esphome.git
synced 2025-10-27 13:13:50 +00:00
tweak
This commit is contained in:
@@ -1477,16 +1477,25 @@ class MemoryAnalyzer:
|
|||||||
|
|
||||||
lines.append("=" * table_width)
|
lines.append("=" * table_width)
|
||||||
|
|
||||||
# Add detailed analysis for top 5 ESPHome components
|
# Add detailed analysis for top ESPHome and external components
|
||||||
esphome_components = [
|
esphome_components = [
|
||||||
(name, mem)
|
(name, mem)
|
||||||
for name, mem in components
|
for name, mem in components
|
||||||
if name.startswith("[esphome]") and name != "[esphome]core"
|
if name.startswith("[esphome]") and name != "[esphome]core"
|
||||||
]
|
]
|
||||||
|
external_components = [
|
||||||
|
(name, mem) for name, mem in components if name.startswith("[external]")
|
||||||
|
]
|
||||||
|
|
||||||
top_esphome_components = sorted(
|
top_esphome_components = sorted(
|
||||||
esphome_components, key=lambda x: x[1].flash_total, reverse=True
|
esphome_components, key=lambda x: x[1].flash_total, reverse=True
|
||||||
)[:30]
|
)[:30]
|
||||||
|
|
||||||
|
# Include all external components (they're usually important)
|
||||||
|
top_external_components = sorted(
|
||||||
|
external_components, key=lambda x: x[1].flash_total, reverse=True
|
||||||
|
)
|
||||||
|
|
||||||
# Check if API component exists and ensure it's included
|
# Check if API component exists and ensure it's included
|
||||||
api_component = None
|
api_component = None
|
||||||
for name, mem in components:
|
for name, mem in components:
|
||||||
@@ -1494,8 +1503,10 @@ class MemoryAnalyzer:
|
|||||||
api_component = (name, mem)
|
api_component = (name, mem)
|
||||||
break
|
break
|
||||||
|
|
||||||
# If API exists and not in top 5, add it to the list
|
# Combine all components to analyze: top ESPHome + all external + API if not already included
|
||||||
components_to_analyze = list(top_esphome_components)
|
components_to_analyze = list(top_esphome_components) + list(
|
||||||
|
top_external_components
|
||||||
|
)
|
||||||
if api_component and api_component not in components_to_analyze:
|
if api_component and api_component not in components_to_analyze:
|
||||||
components_to_analyze.append(api_component)
|
components_to_analyze.append(api_component)
|
||||||
|
|
||||||
@@ -1518,17 +1529,18 @@ class MemoryAnalyzer:
|
|||||||
lines.append(f"Total size: {comp_mem.flash_total:,} B")
|
lines.append(f"Total size: {comp_mem.flash_total:,} B")
|
||||||
lines.append("")
|
lines.append("")
|
||||||
|
|
||||||
# For API component, show all symbols; for others show top 10
|
# Show all symbols > 100 bytes for better visibility
|
||||||
if comp_name == "[esphome]api":
|
large_symbols = [
|
||||||
lines.append(f"All {comp_name} Symbols (sorted by size):")
|
(sym, dem, size)
|
||||||
for i, (symbol, demangled, size) in enumerate(sorted_symbols):
|
for sym, dem, size in sorted_symbols
|
||||||
lines.append(f"{i + 1}. {demangled} ({size:,} B)")
|
if size > 100
|
||||||
else:
|
]
|
||||||
lines.append(f"Top 12 Largest {comp_name} Symbols:")
|
|
||||||
for i, (symbol, demangled, size) in enumerate(
|
lines.append(
|
||||||
sorted_symbols[:12]
|
f"{comp_name} Symbols > 100 B ({len(large_symbols)} symbols):"
|
||||||
):
|
)
|
||||||
lines.append(f"{i + 1}. {demangled} ({size:,} B)")
|
for i, (symbol, demangled, size) in enumerate(large_symbols):
|
||||||
|
lines.append(f"{i + 1}. {demangled} ({size:,} B)")
|
||||||
|
|
||||||
lines.append("=" * table_width)
|
lines.append("=" * table_width)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user