X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/7b430bc731ee68005a7b52bb2a22f53914011381..9b01ddd641e72c2d7fb5864f0079a5a39563eb7d:/lib/lib.php diff --git a/lib/lib.php b/lib/lib.php index 1564a83c..889cb2cf 100644 --- a/lib/lib.php +++ b/lib/lib.php @@ -57,6 +57,20 @@ return sizeof($aMatches[0]); } + function getTotalMemoryMB() + { + $sCPU = file_get_contents('/proc/meminfo'); + preg_match('#MemTotal: +([0-9]+) kB#', $sCPU, $aMatches); + return (int)($aMatches[1]/1024); + } + + function getCacheMemoryMB() + { + $sCPU = file_get_contents('/proc/meminfo'); + preg_match('#Cached: +([0-9]+) kB#', $sCPU, $aMatches); + return (int)($aMatches[1]/1024); + } + function bySearchRank($a, $b) { if ($a['iSearchRank'] == $b['iSearchRank']) return 0;