function get_online_objects() { $device_browser_list = mmc_array_values(NS_DEVICE_LIST); time_print('性能分析:取列表:'); if (isset($_GET['debug'])) { $device_count = mmc_array_length(NS_DEVICE_LIST); $memcache_obj = new Memcache(); $memcache_obj->connect(MEMC_HOST, MEMC_PORT); $stats = $memcache_obj->getStats(); $memcache_obj->close(); $dbg_print = '开始时间:' . getDateStyle($stats['time'] - $stats['uptime']); $dbg_print .= ' 使用内存: ' . bytesToSize($stats['bytes']) . '/' . bytesToSize($stats['limit_maxbytes']); $dbg_print .= '<br>清理时间:' . getDateStyle(async_timer('/on_timer_online_list.php')); $dbg_print .= ' 维护设备数: ' . $device_count . ' 活跃设备数: ' . count($device_browser_list); $xmlStr = file_get_contents('http://' . $_SERVER['SERVER_NAME'] . '/channels-stats'); $channels = json_decode($xmlStr); $dbg_print .= '<br>推送开始:' . getDateStyle(time() - $channels->uptime) . ' 频道数: ' . $channels->channels; $dbg_print .= ' 订阅数: ' . $channels->subscribers . ' 消息数: ' . $channels->published_messages; $dbg_print .= '<br>流程计数: ' . counter() . '<br>'; echo $dbg_print; } /****************************************************** 预处理:账户绑定列表 ******************************************************/ $aDataSet = []; foreach ($device_browser_list as $browser) { if (empty($browser)) { continue; } $account = @$browser['bind_account']; $device = $browser['device']; $useragent = $browser['UserAgent']; $ref_obj = $browser['Visiting'] ? parse_url($browser['Visiting']) : null; $visiting = @$ref_obj['host']; $is_mobile = $browser['ismobiledevice'] ? 'mobi' : 'desk'; $aDataSet[] = [$account, $browser['region'], $visiting, $browser['browser'], $browser['platform'], $is_mobile, $browser['device_name'], $browser['device']]; } time_print('整合:'); if (isset($_GET['debug'])) { echo time_print(); } return $aDataSet; }
function omp_trace($descript = null) { if (!CLIENT_DEBUG) { return; } if (!is_debug_client()) { return; } if (is_array($descript)) { $descript = json_encode($descript); } return time_print($descript); }