bcmstat icon indicating copy to clipboard operation
bcmstat copied to clipboard

Incorrect memory in title

Open StackKorora opened this issue 5 years ago • 0 comments

Snipping out bits that aren't relevant, but I noticed the memory calculations aren't correct.

$ bcmstat.sh J1mrg -oGPUfree,MEMfree
  Config: v0.5.5, args "J1mrg -oGPUfree,MEMfree", priority lowest (+19)
   Board: 4 x ARMv7 cores available, ondemand governor (Pi4 Model B rev 1.1, BCM2838 SoC with 4GB RAM by Sony UK)
  Memory: 1024MB (split 704MB ARM, 320MB GPU)
<snip>
Time     GPUMem Free MemFreeKB / %used
======== =========== =================
20:17:08 295M ( 98%) 3,483,968 /  7.1%

bcmstat sees two different memory configurations and the Board matches what it actually polls via /proc/meminfo. The one in the header is wrong. The code that does it is:

  MEM_ARM = int(vcgencmd("get_mem arm")[:-1])
  MEM_GPU = int(vcgencmd("get_mem gpu")[:-1])
  MEM_MAX = MEM_ARM + MEM_GPU

The documentation for vcgencmd says:

On a Raspberry Pi 4 with greater than 1GB of RAM, the arm option is inaccurate. This is because the GPU firmware which implements this command is only aware of the first gigabyte of RAM on the system, so the arm setting will always return 1GB minus the gpu memory value. To get an accurate report of the amount of ARM memory, use one of the standard Linux commands, such as free or cat /proc/meminfo

MEMTOTAL is actually already pulled. I was thinking about swapping this value in for the header.

Thoughts?

StackKorora avatar Sep 28 '20 01:09 StackKorora