TRITON-2516 optimize cpu_detailed cmon gz plugin #3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR modifies the cpu_detailed plugin to use awk efficiently. Some rudimentary testing shows a 98% speed gain after this change.
AI Disclosure
@jperkin worked with Claude to optimize this script.
Problem Statement
The average time to execute the cpu_detailed plugin on one of our EPYC CNs crosses well over the default three second threshold.
Testing
The version of this plugin released in v0.0.6 was manually replaced with this version on one of the problematic EPYC CNs. The log shows no errors:
And the execution time decreased sharply according to our CMON metrics:

Additional Notes
IIf anyone has some suggestions on how to optimize the runtime for the plugin, I am open to suggestions. I would much rather optimize the plugin than increase the timeout.I already refactored it to use associative arrays in #2, which greatly improved performance, but perhaps there is something else I have not considered.Thank you @jperkin for the optimization!