-
Notifications
You must be signed in to change notification settings - Fork 16
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
Parametrise number of top ps #36
base: master
Are you sure you want to change the base?
Conversation
ed95683
to
5aa7e92
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.
bug: input a ridiculously high number in nproc
for i := 0; i < howManyProcessesToShow; i++ { | ||
memoryPercentOfIthProcess, err := processes[i].MemoryPercent() | ||
if err != nil { | ||
StandardPrinter(ErrorRedColor, "Process memory usage access denied.") //More descriptive error | ||
panic(err) | ||
} |
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 need to handle out of range cases in this loop
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, thanks for testing
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 added:
howManyProcessesToShow := numberOfRequestedProcessesif len(processes) < howManyProcessesToShow { howManyProcessesToShow = len(processes) }
5aa7e92
to
c3f28ad
Compare
This PR is dependent on #35.
It enables user to specify the number of top memory consuming processes to be displayed.