forked from hans/Nominatim
set osm2pgsql cache memory to a default based on memory in the machine
This commit is contained in:
14
lib/lib.php
14
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;
|
||||
|
||||
Reference in New Issue
Block a user