Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

fredoh9
Copy link
Collaborator

@fredoh9 fredoh9 commented Dec 21, 2023

It can generate a graph from text output. matplotlib is new dependency.

It can generate a graph from text output. matplotlib is new dependency.

Signed-off-by: Fred Oh <[email protected]>
@fredoh9 fredoh9 requested a review from a team as a code owner December 21, 2023 16:21
@fredoh9 fredoh9 requested a review from keqiaozhang December 21, 2023 16:23
Copy link
Collaborator

@marc-hb marc-hb left a 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)
Copy link
Collaborator

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:
Copy link
Collaborator

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()
Copy link
Collaborator

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.

Copy link
Collaborator

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

@marc-hb
Copy link
Collaborator

marc-hb commented Dec 26, 2023

Either some already available python library or at least a more "parser-friendly" output.

There is apparently some -r option.

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.

@marc-hb
Copy link
Collaborator

marc-hb commented Jan 4, 2024

Demoting to draft as @fredoh9 is on vacation.

@marc-hb marc-hb marked this pull request as draft January 4, 2024 21:02
@marc-hb
Copy link
Collaborator

marc-hb commented Feb 6, 2024

SOFCI TEST

@marc-hb
Copy link
Collaborator

marc-hb commented Apr 24, 2024

@fredoh9 close, re-open if you find time for this?

BTW there's a git conflict

@fredoh9 fredoh9 closed this Apr 25, 2024
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.

2 participants