-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test-case: add socwatch parsing toool to generate graph #1141
Conversation
It can generate a graph from text output. matplotlib is new dependency. Signed-off-by: Fred Oh <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure SoCWatch has no better option? Surely we're not the first ones trying to re-use SoCWatch output. Either some already available python library or at least a more "parser-friendly" output.
EDIT: 1 minor pylint warning:
https://github.com/thesofproject/sof-test/actions/runs/7290667116/job/19867965010?pr=1141
# Check if the input file parameter is provided | ||
if len(sys.argv) != 2: | ||
print("Usage: python script_name.py input_file.txt") | ||
sys.exit(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
argparse
is really easy to use and there are plenty examples.
lines = file.readlines() | ||
|
||
# Iterate through the lines and extract C-State data | ||
for line in lines: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now it does not look like you need to read the whole file at once.
plt.savefig(output_file) | ||
|
||
# Display the plot | ||
#plt.show() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be a new argparse option later. No need to add it now but good reason to use argparse now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main feature of this script is not parsing, parsing is only a means to an end. The end is matplotlib
, so the script should be named something like sof-socwatch-plot.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is apparently some I've also found mentions of a new "library interface". It wasn't ready at the time but this was last year, so maybe it's usable now. |
Demoting to draft as @fredoh9 is on vacation. |
SOFCI TEST |
@fredoh9 close, re-open if you find time for this? BTW there's a git conflict |
It can generate a graph from text output. matplotlib is new dependency.