Skip to content

Conversation

@harp-intel
Copy link
Contributor

This pull request adds support for recording and restoring configuration in the perfspect config command, along with comprehensive tests for the new functionality. Users can now record the current configuration to a file and restore it later, which is useful for reverting changes or applying settings across systems. The implementation refactors the configuration reporting logic and updates documentation and usage examples accordingly.

New features: Configuration record & restore

  • Added a --record flag to perfspect config for saving the current configuration to a file, and a restore subcommand to apply settings from a saved file. Usage examples and documentation were updated in README.md and the command's help output. [1] [2] [3] [4]

Refactoring and implementation

  • Refactored the configuration reporting logic by splitting it into getConfig, processConfig, and printConfig functions in cmd/config/config.go, improving separation of concerns and code readability. [1] [2] [3] [4]
  • Updated flag handling to support the new --record option and ensure output directories are created as needed. [1] [2]

Testing

  • Added a comprehensive test suite in cmd/config/restore_test.go covering parsing, value conversion, file handling, and result presentation for the restore functionality.

Minor improvements

  • Improved error handling and output reporting throughout the configuration command implementation. [1] [2]

These changes collectively make it easier to manage and reproduce system configurations using perfspect.

Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
@harp-intel harp-intel linked an issue Dec 2, 2025 that may be closed by this pull request
Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
Signed-off-by: Harper, Jason M <jason.m.harper@intel.com>
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.

save and restore system config to/from file

2 participants