Skip to content

7.x Intel processor core types#2141

Merged
ljm42 merged 5 commits into
unraid:masterfrom
SimonFair:Intel-processor-core-types
May 6, 2025
Merged

7.x Intel processor core types#2141
ljm42 merged 5 commits into
unraid:masterfrom
SimonFair:Intel-processor-core-types

Conversation

@SimonFair

@SimonFair SimonFair commented Apr 9, 2025

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features
    • Enhanced CPU displays with detailed core type information for Intel processors across multiple interfaces.
    • Updated tooltips and labels in CPU selectors, checkboxes, and overview tables to provide additional context on core types.
    • More informative headers and visual cues in system monitoring and VM management interfaces for improved clarity on processor configurations.

@coderabbitai

coderabbitai Bot commented Apr 9, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

This pull request integrates enhanced CPU handling by introducing two new global variables, $is_intel_cpu and $core_types, across several modules. These variables detect Intel CPUs and retrieve associated core type details, which are incorporated into UI elements via title attributes. Changes include updates to pages, form templates, global scope declarations, helper functions for CPU data parsing, removal of a legacy dmidecode function, and enhanced CPU display with core type information.

Changes

File(s) Change Summary
emhttp/plugins/dynamix.vm.manager/VMMachines.page
emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php
Added $is_intel_cpu and $core_types; updated global scope; enhanced CPU UI labels with conditional title attributes showing core type info for Intel CPUs.
emhttp/plugins/dynamix/CPUvms.page Added $is_intel_cpu and $core_types to global scope in create function; updated table headers and links to include core type info conditionally for Intel CPUs.
emhttp/plugins/dynamix/DashStats.page Removed legacy dmidecode function; introduced $cpu_vendor, $is_intel_cpu, and $core_types; enhanced CPU display with core type labels when applicable.
emhttp/plugins/dynamix/include/CPUset.php Added $is_intel_cpu and $core_types to global scope; updated checkbox label rendering to include core type title attributes for Intel CPUs.
emhttp/plugins/dynamix/include/Helpers.php Added new helper functions: parse_cpu_ranges($file), get_intel_core_types(), dmidecode($key, $n, $all=true), and is_intel_cpu() for improved CPU info parsing and detection.
emhttp/plugins/dynamix/include/SysDevs.php Enhanced t2 case to initialize Intel CPU detection variables; updated output to append core type info alongside CPU thread sibling data.

Sequence Diagram(s)

sequenceDiagram
    participant UI as User Interface
    participant Module as Plugin/Module
    participant H as Helpers

    UI->>Module: Request CPU information rendering
    Module->>H: Call is_intel_cpu()
    H-->>Module: Return true/false

    alt Intel CPU detected
        Module->>H: Call get_intel_core_types()
        H-->>Module: Return array of core types
        Module->>UI: Render CPU labels with title (core type info)
    else Non-Intel CPU
        Module->>UI: Render standard CPU labels without extra title
    end
Loading

Poem

I'm a hopping rabbit, swift and keen,
Through lines of code where CPUs are seen.
With Intel cores shining in their display,
I celebrate each change along the way.
🐇 Code dances bright beneath the moon’s ray!


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between 343f66f and f74fb75.

📒 Files selected for processing (1)
  • emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bce0348 and 787dad8.

📒 Files selected for processing (7)
  • emhttp/plugins/dynamix.vm.manager/VMMachines.page (3 hunks)
  • emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php (1 hunks)
  • emhttp/plugins/dynamix/CPUvms.page (3 hunks)
  • emhttp/plugins/dynamix/DashStats.page (3 hunks)
  • emhttp/plugins/dynamix/include/CPUset.php (3 hunks)
  • emhttp/plugins/dynamix/include/Helpers.php (1 hunks)
  • emhttp/plugins/dynamix/include/SysDevs.php (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
emhttp/plugins/dynamix/include/SysDevs.php (1)
emhttp/plugins/dynamix/include/Helpers.php (3)
  • is_intel_cpu (471-476)
  • get_intel_core_types (438-455)
  • my_preg_split (298-300)
🔇 Additional comments (20)
emhttp/plugins/dynamix.vm.manager/templates/Custom.form.php (3)

558-560: Good implementation of Intel CPU core type detection.

The addition of $is_intel_cpu and $core_types variables is a clean way to detect Intel CPUs and retrieve core type information. This enhances the VM management interface by making P-Core and E-Core information available to users.


564-565: Core type detection logic is concise and effective.

The conditional assignment of $core_type based on CPU type is well implemented. This check ensures the tooltip is only populated when relevant information is available (Intel CPU with defined core types).


566-571: Good UX enhancement for CPU selection.

Adding the core type information as a title attribute to the CPU checkbox labels provides useful context to users when selecting cores for their VMs, particularly for systems with Intel's hybrid architecture that have different core types.

emhttp/plugins/dynamix/include/SysDevs.php (1)

220-227: Good implementation of CPU core type display.

The code correctly extracts CPU information from $line2 and displays core type information when available. The formatting of the output with parentheses around the core type makes it visually distinct from the CPU identifier.

emhttp/plugins/dynamix/include/CPUset.php (3)

20-21: Good initialization of Intel CPU detection variables.

The early initialization of $is_intel_cpu and $core_types at the file level is a good approach since these values will be used across multiple functions in the file.


36-37: Appropriate modification of global scope.

Adding the new variables to the global scope of the create function ensures they're available where needed without having to pass them as parameters.


52-57: Consistent implementation of core type tooltips.

The code correctly implements core type tooltips for both single CPU and CPU pair cases. The approach is consistent with the implementations in other files, maintaining a unified user experience.

emhttp/plugins/dynamix.vm.manager/VMMachines.page (3)

23-24: Good initialization of Intel CPU detection variables.

The early initialization of the Intel CPU detection variables is consistent with the approach used in other files.


33-34: Appropriate global scope modification.

Adding the new variables to the global scope of showCPUs ensures they're accessible within the function, maintaining consistency with implementations in other files.


43-50: Effective implementation of core type display in UI.

The code correctly adds core type information to CPU labels, enhancing the user interface by providing more context about the CPU architecture through tooltips.

emhttp/plugins/dynamix/CPUvms.page (4)

25-26: Good addition of Intel CPU detection logic.

These new variables properly initialize detection of Intel CPUs and their core types, which enables enhanced CPU core information display in the interface.


30-30: Appropriate update to the global scope.

Adding these new variables to the global scope ensures they're accessible within the function, maintaining consistency with the existing code structure.


46-50: Well-implemented core type integration in table headers.

This code effectively adds core type information to the title attribute of table headers, enabling tooltips that show whether a core is a P-Core or E-Core on Intel CPUs with hybrid architectures.


184-188: Good preservation of existing tooltips.

This modification properly preserves any existing title attributes while adding the thread toggle information, ensuring a non-destructive enhancement to the UI.

emhttp/plugins/dynamix/include/Helpers.php (4)

422-436: Well-implemented CPU range parsing function.

This helper function effectively parses CPU core ranges from system files, handling both individual core numbers and ranges specified in the format "start-end". The null check on the file existence is a good defensive programming practice.


438-455: Good implementation of Intel core type detection.

This function properly maps CPU cores to their respective types (P-Core or E-Core) by leveraging the parse_cpu_ranges function. The implementation correctly handles internationalization with the _() function for the core type labels.


457-469: Well-structured dmidecode implementation.

This function effectively executes the dmidecode command and processes its output into a structured format. The boolean parameter $all provides flexibility in returning either all entries or just the first one.


471-476: Clean implementation of Intel CPU detection.

This function correctly uses the dmidecode function to check if the CPU manufacturer is Intel, providing a simple boolean result that can be used throughout the application.

emhttp/plugins/dynamix/DashStats.page (2)

246-249: Good addition of Intel CPU detection variables.

These variables properly initialize detection of Intel CPUs and retrieve their core types, consistent with the implementation in other files.


272-276: Effective integration of core type information in the CPU display.

This code nicely integrates the core type information into the CPU display, showing the core type (P-Core or E-Core) next to the CPU number when available, enhancing the user interface with valuable hardware information.

Comment thread emhttp/plugins/dynamix/include/SysDevs.php Outdated
@ljm42 ljm42 added the 7.2 label Apr 29, 2025
@SimonFair SimonFair marked this pull request as ready for review May 5, 2025 17:43
@ljm42 ljm42 merged commit 24b40ee into unraid:master May 6, 2025
@SimonFair SimonFair deleted the Intel-processor-core-types branch May 11, 2025 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants