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

Get RSS and %CPU for Windows #1023

Merged
merged 6 commits into from
Dec 14, 2021

Conversation

splhack
Copy link
Contributor

@splhack splhack commented Aug 31, 2021

  • Implement native module (winps) to traverse process tree of each frame to get RSS (WorkingSetSize) and %CPU (the same way as Linux with /proc). The code path will be disabled if the native module is not available.
  • Factor out same code (__updateGpuAndLlu) from Linux and Windows

@splhack
Copy link
Contributor Author

splhack commented Aug 31, 2021

Doesn't platform.system() return Windows on Windows?

elif platform.system() == "win32":
import win32api

if platform.system() == "win32":
return win32api.GetTempPath()

I believe Windows can use this line as well as the other platform, so win32api is not needed.

return '%s/' % tempfile.gettempdir()

pids = [frame.pid for frame in list(
filter(lambda frame: frame.pid > 0, values)
)]
# pylint: disable=E1101
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's use the name of the rule being disabled instead of the ID -- IMO it makes it more easily understood and is consistent with the rest of the code. I think this one is no-member, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated to disable=no-member

elif platform.system() == "Windows":
winpsIsAvailable = False
try:
import winps
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do users need to perform any steps to install winps? Or it's just loaded directly from the source directory?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, users who are using source code need to install it using setup.py if they want to use the module on Windows.

cd rqd/winps
python setup.py install

If OpenCue supports PyPI, it can be installed automatically with RQD dependencies.

@DiegoTavares DiegoTavares merged commit 8551be7 into AcademySoftwareFoundation:master Dec 14, 2021
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

3 participants