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

fix: optimize the algorithm for cpu count calculation in the linux #34

Merged
merged 1 commit into from
Jul 5, 2022

Conversation

beita1
Copy link

@beita1 beita1 commented Jul 5, 2022

Background

  • This pr is created as a result of discussion. We found the max thread count when equal to the number of physical cores is the best way, but not before.

Content

  • We use the command cat /proc/cpuinfo | grep "physical id" | sort |uniq | wc -l to get the physical CPU number and use the command cat /proc/cpuinfo | grep "core id" | sort | uniq | wc -l to get physical CPU core number in each CPU. Finally, we can get the physical CPU cores number by multiplying these two values together.

@Aslemammad
Copy link
Member

Thank you so much for teaching me and sending a PR :)

@Aslemammad Aslemammad merged commit 1ed09c5 into tinylibs:main Jul 5, 2022
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