mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
improve efficiency of devices/ports/, add some caching, fix db profiling.
git-svn-id: http://www.observium.org/svn/observer/trunk@2349 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -88,7 +88,20 @@ if ($_GET['optc'] == thumbs)
|
||||
if ($_GET['opta'] == "details") { $port_details = 1; }
|
||||
echo("<div style='margin: 0px;'><table border=0 cellspacing=0 cellpadding=5 width=100%>");
|
||||
$i = "1";
|
||||
foreach (dbFetchRows("SELECT * FROM `ports` WHERE `device_id` = ? AND `deleted` = '0' ORDER BY `ifIndex` ASC", array($device['device_id'])) as $interface)
|
||||
|
||||
global $port_cache;
|
||||
global $port_index_cache;
|
||||
|
||||
$ports = dbFetchRows("SELECT * FROM `ports` WHERE `device_id` = ? AND `deleted` = '0' ORDER BY `ifIndex` ASC", array($device['device_id']));
|
||||
### As we've dragged the whole database, lets pre-populate our caches :)
|
||||
### FIXME - we should probably split the fetching of link/stack/etc into functions and cache them here too to cut down on single row queries.
|
||||
foreach($ports as $port)
|
||||
{
|
||||
$port_cache[$port['interface_id']] = $port;
|
||||
$port_index_cache[$port['device_id']][$port['ifIndex']] = $port;
|
||||
}
|
||||
|
||||
foreach ($ports as $interface)
|
||||
{
|
||||
include("includes/print-interface.inc.php");
|
||||
$i++;
|
||||
|
Reference in New Issue
Block a user