Skip to content

Conversation

harp-intel
Copy link
Contributor

This pull request refactors the logic for parsing turbostat output to improve how summary (platform) and package rows are identified and extracted. The changes introduce helper functions for clearer row classification and enhance compatibility with different turbostat output formats.

Row classification improvements:

  • Added the isPlatformRow helper function to accurately identify platform (summary) rows by checking that Package, Die, Node, Core, and CPU are all "-" or missing. This replaces previous inline logic and improves maintainability.
  • Updated the turbostatPlatformRows function to use isPlatformRow for filtering, ensuring only platform rows are returned.

Package row handling enhancements:

  • Added the isPackageRow helper function to identify package rows where Package is present and not "-".
  • Modified the turbostatPackageRows function to use isPackageRow and to handle cases where the Package column is missing by inferring package information from the CPU column. This improves robustness across different turbostat outputs.

Documentation updates:

  • Improved function comments to clarify that only summary and package rows are returned, and updated descriptions to reflect the new logic for identifying row types. [1] [2]

@harp-intel harp-intel requested a review from Copilot September 26, 2025 23:13
Copy link
Contributor

@Copilot 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 the turbostat output parsing logic to improve row classification and compatibility with different output formats. The changes introduce dedicated helper functions to identify platform (summary) and package rows, making the code more maintainable and robust.

  • Replaced inline row filtering logic with dedicated isPlatformRow and isPackageRow helper functions
  • Enhanced package row handling to support turbostat outputs that lack a Package column
  • Updated function documentation to clarify that only summary and package rows are returned

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@harp-intel harp-intel merged commit 00a330b into main Sep 29, 2025
5 checks passed
@harp-intel harp-intel deleted the tspower branch September 29, 2025 19:54
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.

1 participant