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 support for enc/dec gpu utilization (#79) #80
Conversation
But Travis gives a passed result. Can you also try to add the cli interface? |
Edit: It was because the tests were importing the system version of Ok, will look into the cli interface soon. Do you think it should be hidden behind a flag or always exposed? |
42be639
to
0b287e5
Compare
@Stonesjtu I hid the encoder/decoder info behind a The functionality seems to be working well, however the test is currently failing, and I'm not exactly sure why:
Even though Another minor thing is that I expected the strings "enc" and "dec" in |
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.
Plz see comments
aa92b4c
to
09963d5
Compare
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.
Plz fix the failed test.
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.
Thanks for the PR. I added some comments.
09963d5
to
dfc2ecb
Compare
Can you modify second paragraph of the pr message because you have added cli output feature. |
gpustat/core.py
Outdated
@@ -221,6 +249,14 @@ def _repr(v, none_value='??'): | |||
reps += "%(FSpeed)s{entry[fan.speed]:>3} %%%(C0)s, " | |||
|
|||
reps += "%(CUtil)s{entry[utilization.gpu]:>3} %%%(C0)s" | |||
if "enc" in show_codec: |
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.
I think it's good to wrap them with parenthesis when --show-codec
is specified, like the first version.
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.
Ok, I added the parenthesis back.
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 PR looks good overall.
dfc2ecb
to
e9b9381
Compare
I added the parenthesis back and force pushed. |
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.
You can append encoder_line and decoder_line in to a list and then ' '.join(a_certain_ilst)
Do you mean, instead of: if "enc" in show_codec and "dec" in show_codec:
reps += encoder_line + " " + decoder_line
elif "enc" in show_codec:
reps += encoder_line
elif "dec" in show_codec:
reps += decoder_line Something like: if "enc" in show_codec and "dec" in show_codec:
reps += " ".join([encoder_line, decoder_line])
elif "enc" in show_codec:
reps += encoder_line
elif "dec" in show_codec:
reps += decoder_line I'd still need to have three separate if/elif clauses. I think it's less readable, no? |
I mean: codec_fields = []
if "enc" in show_codec:
codec_fields.append(encoder_field)
if "dec" in show_codec:
codec_fields.append(decoder_field)
reps += " ".join(codec_fields) I think this should be easier to follow. BTW: I would rather not calling them encoder/decoder line because they are not lines. |
e9b9381
to
59c979a
Compare
I'm happy with the PR now. If we want to be extra picky:
|
@ChaoticMind Overall LGTM, thanks. I will update CHANGELOG and do a bit more of cleanup myself. I am supportive of For bold text, you may need to configure your terminal to draw bold text in bold font. For example, iTerm2 has such an option (Preferences > Text > Text Rendering). |
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.
Lgtm
@wookayin Actually we don't have to give every option an abbr. It's enough to cover the most frequently used ones. |
@wookayin can you approve the PR so we can merge it. |
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.
LGTM! Thanks for the contribution.
This PR only adds encoder and decoder utilization to
--json
from the cmdline, or to theGPUStat
object ifgpustat
is used as a library.The information is also exposed to the standard command line output via the
-e
or--show-codec
flagSee issue #79