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 arithmetic expression: division by zero #9

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

Conversation

takano32
Copy link

@takano32 takano32 commented Mar 3, 2024

Count cpu cores with getconf _NPROCESSORS_ONLN

Count cpu cores with `getconf _NPROCESSORS_ONLN`
@isaumya
Copy link
Owner

isaumya commented Mar 4, 2024

Have you tested these changes on a general shared server? Cause a lot of things are not allowed in shared servers.
Also what problem is it solving? According to this: https://stackoverflow.com/a/23569003/2308992 it might not work globally across all servers (considering many different hosts are using many different Linux OS and configs).

@takano32
Copy link
Author

takano32 commented Mar 5, 2024

Amazon ECS or Google CloudRun containers has no grep cores /proc/cpuinfo lines.

Sorry for might not work globally.

@takano32
Copy link
Author

takano32 commented Mar 7, 2024

This is my /proc/cpuinfo

root@ip-10-0-102-138:/var/www/html# cat /proc/cpuinfo
processor	: 0
BogoMIPS	: 243.75
Features	: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp ssbs
CPU implementer	: 0x41
CPU architecture: 8
CPU variant	: 0x3
CPU part	: 0xd0c
CPU revision	: 1

processor	: 1
BogoMIPS	: 243.75
Features	: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp ssbs
CPU implementer	: 0x41
CPU architecture: 8
CPU variant	: 0x3
CPU part	: 0xd0c
CPU revision	: 1

root@ip-10-0-102-138:/var/www/html#

This is ECS container deployed with Fargate.

https://github.com/takano32/wordpress-on-aws

They have no cores line.

@takano32
Copy link
Author

takano32 commented Mar 7, 2024

Using cat /proc/cpuinfo | grep '^processor' | wc -l is better way ?

Insted of `getconf _NPROCESSORS_ONLN`
@takano32
Copy link
Author

takano32 commented Mar 7, 2024

I'm adding commit using cat /proc/cpuinfo | grep '^processor' | wc -l, But I can't make sense of grep -o '[0-9]' | uniq, sorry.

@isaumya
Copy link
Owner

isaumya commented Mar 7, 2024

I need to test this on shared servers and see how they work. Will let you know when I test it. Will let you know.

@takano32
Copy link
Author

takano32 commented Mar 7, 2024

I got it. I would be waiting forward your test result.

Thank you.

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