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

Parametrise number of top ps #36

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Vulwsztyn
Copy link
Contributor

@Vulwsztyn Vulwsztyn commented Oct 2, 2020

This PR is dependent on #35.

It enables user to specify the number of top memory consuming processes to be displayed.
image

@Vulwsztyn Vulwsztyn changed the title Parametrise number of top ps WIP: Parametrise number of top ps Oct 2, 2020
@Vulwsztyn Vulwsztyn force-pushed the parametrise_number_of_top_ps branch from ed95683 to 5aa7e92 Compare October 2, 2020 15:15
@Vulwsztyn Vulwsztyn changed the title WIP: Parametrise number of top ps Parametrise number of top ps Oct 2, 2020
Copy link
Member

@DarthBenro008 DarthBenro008 left a 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

Comment on lines +92 to 101
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)
}
Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, thanks for testing

Copy link
Contributor Author

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) }

@Vulwsztyn Vulwsztyn force-pushed the parametrise_number_of_top_ps branch from 5aa7e92 to c3f28ad Compare October 5, 2020 06:28
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.

2 participants