phpsysinfo / phpsysinfo

phpSysInfo: a customizable PHP script that displays information about your system nicely
http://phpsysinfo.github.io/phpsysinfo
GNU General Public License v2.0
1.38k stars 234 forks source link

Darwin memory usage not good #59

Closed pelletierr closed 9 years ago

pelletierr commented 9 years ago

Darwin display of memory usage is not good. I fixed it in my fork

rk4an commented 9 years ago

Hi,

Thanks for your contribution :smiley: I paste the link of your commit below, we need a Mac computer to try it on different version.

https://github.com/pelletierr/phpsysinfo/commit/5b396a8b2885307b71a5331b3f0dab9801c0f29e#diff-d41d8cd98f00b204e9800998ecf8427e

pelletierr commented 9 years ago

If I had a beefier setup @ home, I'd virtualize 10.5 to 10.9 so you could try it. It was trial and error to get the good numbers. What Activity monitor was showing before 10.9 was different also.

pelletierr commented 9 years ago

Oh.. and I'm running my patch here : http://www.menzonet.org/phpSysInfo :)

namiltd commented 9 years ago

Please paste output of commands: vm_stat sysctl hw.memsize

I'll test it tomorrow morning on different versions of the system.

namiltd commented 9 years ago

Unfortunately, version 10.8.5 received the wrong values

pelletierr commented 9 years ago

vm_stat : Mach Virtual Memory Statistics: (page size of 4096 bytes) Pages free: 753222. Pages active: 1870856. Pages inactive: 535981. Pages speculative: 531793. Pages throttled: 0. Pages wired down: 443492. Pages purgeable: 277. "Translation faults": 2912088170. Pages copy-on-write: 239224603. Pages zero filled: 962449612. Pages reactivated: 378063. Pages purged: 635699. File-backed pages: 844582. Anonymous pages: 2094048. Pages stored in compressor: 79413. Pages occupied by compressor: 56969. Decompressions: 2126. Compressions: 82387. Pageins: 1961548. Pageouts: 23343. Swapins: 264. Swapouts: 264.

hw.memsize: 17179869184

Note that Activity Monitor doesn't show the same values in 10.8 and 10.9. I changed phpSysInfo to show the 10.9 values, which IMHO makes more sense than what was shown prior to Mavericks, since OS X was doing a lot of file cache but was showing that memory as free.

namiltd commented 9 years ago

Paste values ​​from Activity Monitor and corresponding vm_stat.

pelletierr commented 9 years ago

capture decran 2014-08-06 a 10 57 14

Mach Virtual Memory Statistics: (page size of 4096 bytes) Pages free: 10618. Pages active: 1894043. Pages inactive: 988141. Pages speculative: 806200. Pages throttled: 0. Pages wired down: 437176. Pages purgeable: 10356. "Translation faults": 2938853787. Pages copy-on-write: 241916814. Pages zero filled: 971743078. Pages reactivated: 379509. Pages purged: 637333. File-backed pages: 1552166. Anonymous pages: 2136218. Pages stored in compressor: 77894. Pages occupied by compressor: 56429. Decompressions: 3639. Compressions: 82391. Pageins: 1973731. Pageouts: 23343. Swapins: 264. Swapouts: 264.

namiltd commented 9 years ago

Try now.

pelletierr commented 9 years ago

It doesn't make sense... image

namiltd commented 9 years ago

Mio <-> Gio

10.01+5,75 = 15.75 15.99-15.75=0,24 = only 240 Mio unknown memory

Look at: http://www.badrit.com/blog/2014/5/1/how-to-calc-memory-usage-in-mavericks-programmatically

pelletierr commented 9 years ago

Anonymous pages doesn't work to list app memory. My server's runing 7.5GiO/8GiO app memory all the time.

namiltd commented 9 years ago

appMemory means "Kernel + applications" (Pages wired down + Anonymous pages)

pelletierr commented 9 years ago

It is now what Activity Monitor shows though.

namiltd commented 9 years ago

If ok close issue (also check your second issue).

pelletierr commented 9 years ago

sorry, said "now" but wanted to say "not"

pelletierr commented 9 years ago

I guess best option would be to define new mem variables to show wired and compressed. I started looking into it.

namiltd commented 9 years ago

Test now (Pages occupied by compressor as buffers).

pelletierr commented 9 years ago

You should'nt set buffer to 0 if there's nothing, that way the line won't be drawn