|
@@ -1,4 +1,16 @@
|
|
|
<?php
|
|
<?php
|
|
|
|
|
+/**
|
|
|
|
|
+ * This file is part of workerman.
|
|
|
|
|
+ *
|
|
|
|
|
+ * Licensed under The MIT License
|
|
|
|
|
+ * For full copyright and license information, please see the MIT-LICENSE.txt
|
|
|
|
|
+ * Redistributions of files must retain the above copyright notice.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @author walkor<walkor@workerman.net>
|
|
|
|
|
+ * @copyright walkor<walkor@workerman.net>
|
|
|
|
|
+ * @link http://www.workerman.net/
|
|
|
|
|
+ * @license http://www.opensource.org/licenses/mit-license.php MIT License
|
|
|
|
|
+ */
|
|
|
namespace Workerman;
|
|
namespace Workerman;
|
|
|
|
|
|
|
|
use \Workerman\Events\Libevent;
|
|
use \Workerman\Events\Libevent;
|
|
@@ -12,8 +24,8 @@ use \Workerman\Autoloader;
|
|
|
use \Exception;
|
|
use \Exception;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- *
|
|
|
|
|
- * @author walkor<walkor@workerman.net>
|
|
|
|
|
|
|
+ * Worker 类
|
|
|
|
|
+ * 是一个容器,用于监听端口,维持客户端连接
|
|
|
*/
|
|
*/
|
|
|
class Worker
|
|
class Worker
|
|
|
{
|
|
{
|
|
@@ -1008,7 +1020,7 @@ class Worker
|
|
|
|
|
|
|
|
// 子进程部分
|
|
// 子进程部分
|
|
|
$worker = current(self::$_workers);
|
|
$worker = current(self::$_workers);
|
|
|
- $wrker_status_str = posix_getpid()."\t".str_pad(round(memory_get_usage()/(1024*1024),2)."M", 7)." " .str_pad($worker->getSocketName(), self::$_maxSocketNameLength) ." ".str_pad(($worker->name === $worker->getSocketName() ? 'none' : $worker->name), self::$_maxWorkerNameLength)." ";
|
|
|
|
|
|
|
+ $wrker_status_str = posix_getpid()."\t".str_pad(round(memory_get_usage(true)/(1024*1024),2)."M", 7)." " .str_pad($worker->getSocketName(), self::$_maxSocketNameLength) ." ".str_pad(($worker->name === $worker->getSocketName() ? 'none' : $worker->name), self::$_maxWorkerNameLength)." ";
|
|
|
$wrker_status_str .= str_pad(ConnectionInterface::$statistics['connection_count'], 11)." ".str_pad(ConnectionInterface::$statistics['total_request'], 14)." ".str_pad(ConnectionInterface::$statistics['send_fail'],9)." ".str_pad(ConnectionInterface::$statistics['throw_exception'],15)."\n";
|
|
$wrker_status_str .= str_pad(ConnectionInterface::$statistics['connection_count'], 11)." ".str_pad(ConnectionInterface::$statistics['total_request'], 14)." ".str_pad(ConnectionInterface::$statistics['send_fail'],9)." ".str_pad(ConnectionInterface::$statistics['throw_exception'],15)."\n";
|
|
|
file_put_contents(self::$_statisticsFile, $wrker_status_str, FILE_APPEND);
|
|
file_put_contents(self::$_statisticsFile, $wrker_status_str, FILE_APPEND);
|
|
|
}
|
|
}
|