当前位置: 首页>>代码示例>>PHP>>正文


PHP swoole_set_process_name函数代码示例

本文整理汇总了PHP中swoole_set_process_name函数的典型用法代码示例。如果您正苦于以下问题:PHP swoole_set_process_name函数的具体用法?PHP swoole_set_process_name怎么用?PHP swoole_set_process_name使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了swoole_set_process_name函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: my_onStart

function my_onStart(swoole_server $serv)
{
    global $argv;
    swoole_set_process_name("php {$argv[0]}: master");
    echo "MasterPid={$serv->master_pid}|Manager_pid={$serv->manager_pid}\n";
    echo "Server: start.Swoole version is [" . SWOOLE_VERSION . "]\n";
}
开发者ID:liangkwok,项目名称:Swoole,代码行数:7,代码来源:exist.php

示例2: set_process_name

 /**
  * 设置进程名
  */
 private static function set_process_name()
 {
     if (!function_exists("swoole_set_process_name")) {
         self::exit2p("Please install swoole extension.http://www.swoole.com/");
     }
     swoole_set_process_name(self::$process_name);
 }
开发者ID:royalwang,项目名称:swoole-crontab,代码行数:10,代码来源:Crontab.class.php

示例3: run

 public static function run($fd)
 {
     self::$fp = fopen("php://fd/" . $fd, "a");
     swoole_set_process_name(self::$name);
     self::http_server();
     self::start();
 }
开发者ID:jymsy,项目名称:swoole-crontab,代码行数:7,代码来源:http.php

示例4: start

 protected function start()
 {
     if ($this->pidManager->get()) {
         echo "ERROR: plumber is already running.\n";
         return;
     }
     echo "plumber started.\n";
     if ($this->config['daemonize']) {
         swoole_process::daemon();
     }
     $this->logger = new Logger(['log_path' => $this->config['log_path']]);
     $this->output = new Logger(['log_path' => $this->config['output_path']]);
     $this->logger->info('plumber starting...');
     $this->stats = $stats = $this->createListenerStats();
     swoole_set_process_name('plumber: master');
     $this->workers = $this->createWorkers($stats);
     $this->registerSignal();
     $this->pidManager->save(posix_getpid());
     swoole_timer_tick(1000, function ($timerId) {
         $statses = $this->stats->getAll();
         foreach ($statses as $pid => $s) {
             if ($s['last_update'] + $this->config['reserve_timeout'] + $this->config['execute_timeout'] > time()) {
                 continue;
             }
             if (!$s['timeout']) {
                 $this->logger->notice("process #{$pid} last upadte at " . date('Y-m-d H:i:s') . ', it is timeout.', $s);
                 $this->stats->timeout($pid);
             }
         }
     });
 }
开发者ID:codeages,项目名称:plumber,代码行数:31,代码来源:Plumber.php

示例5: my_set_process_name

 private function my_set_process_name($title)
 {
     if (substr(PHP_VERSION, 0, 3) >= '5.5') {
         cli_set_process_title($title);
     } else {
         swoole_set_process_name($title);
     }
 }
开发者ID:xtjsxtj,项目名称:esp,代码行数:8,代码来源:swoole.php

示例6: onStart

 public function onStart()
 {
     swoole_set_process_name(SWOOLE_DEAMON);
     $reload = "echo 'Reloading...'\n";
     $reload .= "pid=\$(pidof " . SWOOLE_DEAMON . ")\n";
     $reload .= "kill -USR1 \"\$pid\"\n";
     $reload .= "echo 'Reloaded'\n";
     file_put_contents(__DIR__ . '/reload_' . SWOOLE_DEAMON . '.sh', $reload);
 }
开发者ID:baitongda,项目名称:mPHP,代码行数:9,代码来源:swoole_server.php

示例7: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $operation = $input->getArgument('operation');
     swoole_set_process_name("kerisy-rpcserver:manage");
     if (!in_array($operation, ['run', "stop", "start", "restart"])) {
         throw new InvalidParamException('The <operation> argument is invalid');
     }
     return call_user_func([$this, 'handle' . $operation]);
 }
开发者ID:kerisy,项目名称:framework,代码行数:9,代码来源:RpcServerCommand.php

示例8: onWorkerStart

 public function onWorkerStart($server, $worker_id)
 {
     global $argv;
     if ($worker_id >= $server->setting['worker_num']) {
         swoole_set_process_name("php {$argv[0]} task worker");
     } else {
         swoole_set_process_name("php {$argv[0]} event worker");
     }
     echo "WorkerStart|MasterPid={$server->master_pid}|Manager_pid={$server->manager_pid}|WorkerId={$worker_id}\n";
 }
开发者ID:ilei,项目名称:blog,代码行数:10,代码来源:server.php

示例9: processRename

function processRename($serv, $worker_id)
{
    global $argv;
    if ($worker_id >= $serv->setting['worker_num']) {
        swoole_set_process_name("php {$argv[0]}: task");
    } else {
        swoole_set_process_name("php {$argv[0]}: worker");
    }
    echo "WorkerStart: MasterPid={$serv->master_pid}|Manager_pid={$serv->manager_pid}";
    echo "|WorkerId={$serv->worker_id}|WorkerPid={$serv->worker_pid}\n";
}
开发者ID:jinguanio,项目名称:swoolecrawler,代码行数:11,代码来源:server.php

示例10: onWorkerStart

 public function onWorkerStart($server, $worker_id)
 {
     global $argv;
     opcache_reset();
     include_once dirname(__FILE__) . "/test/test.php";
     if ($worker_id >= $this->_server->setting['worker_num']) {
         swoole_set_process_name("php {$argv[0]} task worker");
     } else {
         swoole_set_process_name("php {$argv[0]} event worker");
     }
 }
开发者ID:sukui,项目名称:swoole_auto_reload,代码行数:11,代码来源:server.php

示例11: onWorkerStart

 public function onWorkerStart($server, $workerId)
 {
     if ($workerId >= ZConfig::getField('socket', 'worker_num')) {
         swoole_set_process_name(ZConfig::get('project_name') . " server task  num: {$server->worker_id} pid " . $server->worker_pid);
     } else {
         swoole_set_process_name(ZConfig::get('project_name') . " server worker  num: {$server->worker_id} pid " . $server->worker_pid);
     }
     if (function_exists('opcache_reset')) {
         opcache_reset();
     }
 }
开发者ID:qai41,项目名称:zphp,代码行数:11,代码来源:Swoole.php

示例12: my_onWorkerStart

function my_onWorkerStart($serv, $worker_id)
{
    global $argv;
    if ($worker_id >= $serv->setting['worker_num']) {
        swoole_set_process_name("php {$argv[0]} task worker");
    } else {
        swoole_set_process_name("php {$argv[0]} event worker");
    }
    //echo "WorkerStart|MasterPid={$serv->master_pid}|Manager_pid={$serv->manager_pid}|WorkerId=$worker_id\n";
    //$serv->addtimer(500); //500ms
}
开发者ID:chenwenbin928,项目名称:swoole-src,代码行数:11,代码来源:task_shared_serv.php

示例13: setProcessName

 /**
  * 设置进程的名称
  * @param $name
  */
 static function setProcessName($name)
 {
     if (function_exists('cli_set_process_title')) {
         cli_set_process_title($name);
     } else {
         if (function_exists('swoole_set_process_name')) {
             swoole_set_process_name($name);
         } else {
             trigger_error(__METHOD__ . " failed. require cli_set_process_title or swoole_set_process_name.");
         }
     }
 }
开发者ID:jasonshaw,项目名称:framework-1,代码行数:16,代码来源:Console.php

示例14: onWorkerStart

 /**
  * worker start时调用
  * @param unknown $serv
  * @param int $worker_id
  */
 public function onWorkerStart($serv, $worker_id)
 {
     global $argv;
     if ($worker_id >= $serv->setting['worker_num']) {
         swoole_set_process_name("php {$argv[0]}: task");
     } else {
         swoole_set_process_name("php {$argv[0]}: worker");
     }
     echo "WorkerStart: MasterPid={$serv->master_pid}|Manager_pid={$serv->manager_pid}|WorkerId={$serv->worker_id}|WorkerPid={$serv->worker_pid}\n";
     define('APPLICATION_PATH', dirname(__DIR__));
     include APPLICATION_PATH . '/httpindex.php';
 }
开发者ID:niceDreamer,项目名称:ciswoole,代码行数:17,代码来源:http_server.php

示例15: processRename

 public function processRename($serv, $worker_id)
 {
     global $argv;
     $worker_num = isset($serv->setting['worker_num']) ? $serv->setting['worker_num'] : 1;
     $task_worker_num = isset($serv->setting['task_worker_num']) ? $serv->setting['task_worker_num'] : 0;
     if ($worker_id >= $worker_num) {
         swoole_set_process_name("php {$argv[0]}: task");
     } else {
         swoole_set_process_name("php {$argv[0]}: worker");
     }
     echo $serv->master_pid, '--', $serv->manager_pid, '--', $serv->worker_id, '--', $serv->worker_pid, "\n";
 }
开发者ID:tianyunchong,项目名称:php,代码行数:12,代码来源:SwooleServer.php


注:本文中的swoole_set_process_name函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。