• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP swoole_set_process_name函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: 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 str_pad($serv->master_pid, self::$_maxMasterPidLength + 2), str_pad($serv->manager_pid, self::$_maxManagerPidLength + 2), str_pad($serv->worker_id, self::$_maxWorkerIdLength + 2), str_pad($serv->worker_pid, self::$_maxWorkerIdLength), "\n";
 }
开发者ID:stonegithubs,项目名称:swoole-JsonRPC,代码行数:12,代码来源:Server.php


示例17: onWorkerStart

 /**
  * worker start时调用
  * @param unknown $serv
  * @param int $worker_id
  */
 public function onWorkerStart($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 str_pad($serv->master_pid, self::$_maxMasterPidLength + 2), str_pad($serv->manager_pid, self::$_maxManagerPidLength + 2), str_pad($serv->worker_id, self::$_maxWorkerIdLength + 2), str_pad($serv->worker_pid, self::$_maxWorkerIdLength), "\n";
     define('APPLICATION_PATH', dirname(__DIR__));
 }
开发者ID:stonegithubs,项目名称:swoole-linux-dash,代码行数:18,代码来源:WebServer.php


示例18: onWorkerStart

 public function onWorkerStart($server, $workerId)
 {
     $workNum = ZConfig::getField('socket', 'worker_num');
     if ($workerId >= $workNum) {
         swoole_set_process_name(ZConfig::get('project_name') . " server tasker  num: " . ($server->worker_id - $workNum) . " 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();
     }
     Protocol\Request::setSocket($server);
 }
开发者ID:imdaqian,项目名称:zphp,代码行数:13,代码来源:Swoole.php


示例19: process_rename

/**
 * @param $name
 */
function process_rename($name)
{
    // hidden Mac OS error。
    set_error_handler(function () {
    });
    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);
        }
    }
    restore_error_handler();
}
开发者ID:JanHuang,项目名称:swoole,代码行数:17,代码来源:helpers.php


示例20: my_onWorkerStart

function my_onWorkerStart($serv, $worker_id)
{
    global $argv;
    global $class;
    opcache_reset();
    include "hot_update_class.php";
    $class = new HotUpdate();
    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:liangkwok,项目名称:Swoole,代码行数:15,代码来源:server_hot_update_opcache.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP swoole_timer_after函数代码示例发布时间:2022-05-23
下一篇:
PHP swoole_event_add函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap