wp-server-stats
wp-server-stats copied to clipboard
fix `arithmetic expression: division by zero`
Count cpu cores with getconf _NPROCESSORS_ONLN
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).
Amazon ECS or Google CloudRun containers has no grep cores /proc/cpuinfo
lines.
Sorry for might not work globally.
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.
Using cat /proc/cpuinfo | grep '^processor' | wc -l
is better way ?
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.
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.
I got it. I would be waiting forward your test result.
Thank you.