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

Replace ps argument lists with enum #1675

Merged
merged 16 commits into from Jul 10, 2021
Merged

Replace ps argument lists with enum #1675

merged 16 commits into from Jul 10, 2021

Conversation

dbwiddis
Copy link
Member

I really like this improvement for ps argument lists. Much less error prone. FreeBSD processes done, will do for other *nix PS lists for processes and threads.

@basil what do you think?

@coveralls
Copy link

coveralls commented Jun 30, 2021

Coverage Status

Coverage increased (+0.2%) to 85.96% when pulling 9749d3a on dbwiddis:psenum into 455185c on oshi:master.

@dbwiddis
Copy link
Member Author

Thinking more on this... I don't like the use of ordinal() much. So an array is not the ideal structure for the ps results. An EnumMap would be ideal here, and it could be efficiently populated in value order in an iteration. I'll try that...

Copy link
Contributor

@basil basil left a comment

Choose a reason for hiding this comment

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

Very nice PR!

@dbwiddis dbwiddis marked this pull request as ready for review July 10, 2021 21:04
@dbwiddis dbwiddis merged commit 9ae88cc into oshi:master Jul 10, 2021
@dbwiddis dbwiddis deleted the psenum branch July 10, 2021 22:23
dbwiddis added a commit that referenced this pull request Jul 18, 2021
* Replace ps argument lists with enum

* Replace arrays from split with enumMap

* Only need to check if last enum is populated

* OpenBSD update to use enummap (and same typo fix on context switches)

* AIX update to use enummap (and typo fix on state)

* Solaris update to use enummap

* FreeBSD Threads using enummap

* OpenBSD Threads

* Solaris Threads

* AIX Threads, prep debug output for testing

* Handle consecutive delimiters

* Solaris ps doesn't have system time

* Remove debug testing

* Remove unneeded subtraction by constant 0

* Changelog
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