Skip to content

Conversation

@harp-intel
Copy link
Contributor

This pull request refactors how DIMM (memory module) information is handled and accessed throughout the codebase. The main change is moving the DIMM index constants and related helper functions from cmd/report/dimm.go to the internal/common package, making them reusable and centralizing DIMM parsing logic. All code that previously used local DIMM helpers and constants now references the shared versions in internal/common. This improves maintainability and reduces code duplication.

Key changes include:

Improvements to Summary Table Logic:

  • Enhanced the brief summary table in internal/common/table_defs.go to prefer DIMM information from DMI decode, falling back to /proc/meminfo only if necessary, and updated the field name to "Memory" for clarity. [1] [2]

Refactoring and Code Reuse:

  • Moved DIMM index constants (e.g., BankLocatorIdx, SizeIdx, etc.) and DIMM helper functions (DimmInfoFromDmiDecode, InstalledMemoryFromOutput) from cmd/report/dimm.go to internal/common/table_helpers.go for shared use across the codebase. [1] [2]

Code Updates to Use Shared Helpers:

  • Updated all references in cmd/report/dimm.go to use common.DimmInfoFromDmiDecode and common.<IndexConstant> instead of local definitions. [1] [2] [3] [4] [5] [6]
  • Updated summary and table rendering logic in cmd/report/report_tables.go and cmd/report/system.go to use common.InstalledMemoryFromOutput and common.<IndexConstant>. [1] [2] [3] [4]

These changes centralize DIMM parsing logic, reduce duplication, and ensure consistency across different parts of the codebase when handling memory module information.

Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
@harp-intel harp-intel requested a review from Copilot December 16, 2025 19:33
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors DIMM (memory module) information handling by centralizing parsing logic and index constants into the internal/common package. The main purpose is to improve code maintainability and reduce duplication across the codebase.

Key changes:

  • Moved DIMM index constants and helper functions from cmd/report/dimm.go to internal/common/table_helpers.go for reuse
  • Enhanced the brief summary table to prioritize DIMM information from DMI decode over /proc/meminfo
  • Updated all references throughout the codebase to use the centralized common.DimmInfoFromDmiDecode and common.InstalledMemoryFromOutput functions

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
internal/common/table_helpers.go Added DIMM index constants and helper functions (DimmInfoFromDmiDecode, InstalledMemoryFromOutput) moved from cmd/report/dimm.go
internal/common/table_defs.go Updated brief summary table to prefer DIMM info from DMI decode with fallback to meminfo, changed field name to "Memory"
cmd/report/system.go Updated to use common.InstalledMemoryFromOutput instead of local function
cmd/report/report_tables.go Updated table value functions and HTML renderer to use common DIMM constants and helper functions
cmd/report/dimm.go Removed local DIMM constants and helper functions, updated all references to use common package versions

@harp-intel harp-intel merged commit 028ee2e into main Dec 16, 2025
5 checks passed
@harp-intel harp-intel deleted the memsummary branch December 16, 2025 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants