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

Add a psplot command to plot and compare stats from multiple runs of psrecord #9

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

saimn
Copy link
Contributor

@saimn saimn commented Jun 10, 2014

This allow to compare multiple runs of psrecord on one plot. I have added a new command since it is easier than playing with argparse's sub-parsers.
It takes a list of log files from psrecord, with options to plot only mem or cpu. I don't know what is the best for colors and linestyles to distinguish easily all the lines (suggestions are welcome ;)). Currently it uses mpl's color cycle, so mem and cpu for a file will have the same color (and linestyle).
I didn't modify the plot from main.py, it could probably use the same code, but I'm waiting for your feedback before going further ;-).

usage: psplot [-h] [-m] [-c] [-o OUTPUT] [files [files ...]]

Plot stats from psrecord

positional arguments:
  files                 List of files to plot

optional arguments:
  -h, --help            show this help message and exit
  -m, --mem             Show memory values
  -c, --cpu             Show cpu values
  -o OUTPUT, --output OUTPUT
                        Save the plot to a file

@saimn
Copy link
Contributor Author

saimn commented Jun 10, 2014

An example (with the same code but two different sampling intervals):
plot

@astrofrog
Copy link
Owner

@saimn - sorry for never replying to this. In principle I like this, but I'm wondering if psrecord-compare might be a better command name, so that it's clearer that it's associated with psrecord. Or it could potentially be a special mode of psrecord, e.g. psrecord --compare. Could you rebase this and we can go through a round of comments?

@saimn
Copy link
Contributor Author

saimn commented Dec 2, 2016

@astrofrog - I had also forgotten this PR ! 😄 Ok for the rebase.

@saimn
Copy link
Contributor Author

saimn commented Dec 6, 2016

@astrofrog - I pushed the rebased branch with a few updates. About the command interface, I think I chose psplot because it can be useful also to plot one log file, so not only for comparison. There are also several options for the interface:

  • a new command,
  • a specific option, --compare or whatever, but it will possibly conflict with the exiting options and make the interface more difficult to understand
  • subcommands: psrecord plot for instance. This suppose that the existing psrecord command is moved to a subcommand psrecord run or something. And then I think it is possible to specify a default subcommand, to keep the compatibility.

@astrofrog
Copy link
Owner

So... better late than never, am I right? ;)

I think my preferred option would be psrecord plot, so a sub-command.

Is there a way we can re-use the existing plotting code so that if someone does psrecord plot activity.txt they get the same plot that psrecord would have generated originally? I know this also adds the ability to compare, but it would be good to make it so that plotting a single one is consistent.

@saimn
Copy link
Contributor Author

saimn commented Jul 6, 2018

@astrofrog - Ok ;), I will have a look.

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.

None yet

2 participants