本文整理汇总了PHP中cli_set_process_title函数的典型用法代码示例。如果您正苦于以下问题:PHP cli_set_process_title函数的具体用法?PHP cli_set_process_title怎么用?PHP cli_set_process_title使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cli_set_process_title函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public static function init()
{
pts_core::init();
if (defined('QUICK_START') && QUICK_START) {
return true;
}
if (function_exists('cli_set_process_title') && PHP_OS == 'Linux') {
cli_set_process_title('Phoronix Test Suite');
}
pts_define('PHP_BIN', pts_client::read_env('PHP_BIN'));
$dir_init = array(PTS_USER_PATH);
foreach ($dir_init as $dir) {
pts_file_io::mkdir($dir);
}
if (PTS_IS_CLIENT) {
pts_network::client_startup();
}
self::core_storage_init_process();
if (!is_file(PTS_TEMP_STORAGE)) {
self::build_temp_cache();
}
pts_define('PTS_TEST_INSTALL_DEFAULT_PATH', pts_strings::parse_for_home_directory(pts_config::read_user_config('PhoronixTestSuite/Options/Installation/EnvironmentDirectory', '~/.phoronix-test-suite/installed-tests/')));
pts_define('PTS_SAVE_RESULTS_PATH', pts_strings::parse_for_home_directory(pts_config::read_user_config('PhoronixTestSuite/Options/Testing/ResultsDirectory', '~/.phoronix-test-suite/test-results/')));
self::extended_init_process();
$openbenchmarking = pts_storage_object::read_from_file(PTS_CORE_STORAGE, 'openbenchmarking');
$openbenchmarking_account_settings = pts_storage_object::read_from_file(PTS_CORE_STORAGE, 'openbenchmarking_account_settings');
if ($openbenchmarking != null) {
// OpenBenchmarking.org Account
pts_openbenchmarking_client::init_account($openbenchmarking, $openbenchmarking_account_settings);
}
return true;
}
示例2: setProcessName
public function setProcessName($name)
{
if (function_exists('cli_set_process_title')) {
cli_set_process_title($name);
}
return $this;
}
示例3: setTitle
public function setTitle($title)
{
$this->title = trim($title);
if (function_exists('cli_set_process_title')) {
cli_set_process_title($this->title);
}
}
示例4: setProcessProperties
/**
* @param EnvironmentInterface $env
*/
private function setProcessProperties(EnvironmentInterface $env)
{
$props = $env->getEnv('cli');
if ($props['title'] !== 'php' && function_exists('cli_set_process_title')) {
cli_set_process_title($props['title']);
}
}
示例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);
}
}
示例6: init
protected function init()
{
$this->pid = posix_getpid();
$this->ppid = posix_getppid();
cli_set_process_title(sprintf('%s(%s)', $this->getName(), $this->getWorker()));
static::$currentProcess = $this;
return $this;
}
示例7: updateProcTitleIfPossible
private function updateProcTitleIfPossible($workerId, $queues)
{
if (!function_exists('cli_set_process_title')) {
return;
}
global $argv;
cli_set_process_title(sprintf("%s: %s watching %s", join(' ', $argv), $workerId, join(', ', $queues)));
}
示例8: changeProcessTitleTo
private static function changeProcessTitleTo($processTitle)
{
if (function_exists('cli_set_process_title')) {
cli_set_process_title($processTitle);
} elseif (function_exists('setproctitle')) {
setproctitle($processTitle);
}
}
示例9: updateProcTitleIfPossible
private function updateProcTitleIfPossible($jobId)
{
if (!function_exists('cli_set_process_title')) {
return;
}
global $argv;
cli_set_process_title(sprintf("%s: processing %s", join(' ', $argv), $jobId));
}
示例10: setProcessName
/**
* 设置进程名称
*
* @param $title
*/
protected static function setProcessName($title)
{
$title = "php_daemon_{$title}";
if (function_exists('cli_set_process_title')) {
cli_set_process_title($title);
} elseif (extension_loaded('proctitle') && function_exists('setproctitle')) {
setproctitle($title);
}
}
示例11: init
public static function init()
{
set_time_limit(0);
pts_define_directories();
// Define directories
if (function_exists('cli_set_process_title') && !phodevi::is_macosx()) {
cli_set_process_title('Phoronix Test Suite');
}
if (defined('QUICK_START') && QUICK_START) {
return true;
}
pts_define('PHP_BIN', pts_client::read_env('PHP_BIN'));
pts_define('PTS_INIT_TIME', time());
if (!defined('PHP_VERSION_ID')) {
// PHP_VERSION_ID is only available in PHP 5.2.6 and later
$php_version = explode('.', PHP_VERSION);
pts_define('PHP_VERSION_ID', $php_version[0] * 10000 + $php_version[1] * 100 + $php_version[2]);
}
$dir_init = array(PTS_USER_PATH);
foreach ($dir_init as $dir) {
pts_file_io::mkdir($dir);
}
if (PTS_IS_CLIENT) {
pts_network::client_startup();
}
self::core_storage_init_process();
if (!is_file(PTS_TEMP_STORAGE)) {
self::build_temp_cache();
}
//XXX
pts_define('PTS_ETC_PATH', is_dir('/etc') ? '/etc/phoronix-test-suite/' : false);
if (is_dir('/usr/local/share/phoronix-test-suite/')) {
pts_define('PTS_SHARE_PATH', '/usr/local/share/phoronix-test-suite/');
} else {
if (is_dir('/usr/share/')) {
pts_define('PTS_SHARE_PATH', '/usr/share/phoronix-test-suite/');
if (is_writable('/usr/share') && !is_dir(PTS_SHARE_PATH)) {
mkdir(PTS_SHARE_PATH);
}
} else {
pts_define('PTS_SHARE_PATH', false);
}
}
// XXX: technically the config init_files line shouldn't be needed since it should be dynamically called
// pts_config::init_files();
pts_define('PTS_TEST_INSTALL_DEFAULT_PATH', pts_client::parse_home_directory(pts_config::read_user_config('PhoronixTestSuite/Options/Installation/EnvironmentDirectory', '~/.phoronix-test-suite/installed-tests/')));
pts_define('PTS_SAVE_RESULTS_PATH', pts_client::parse_home_directory(pts_config::read_user_config('PhoronixTestSuite/Options/Testing/ResultsDirectory', '~/.phoronix-test-suite/test-results/')));
self::extended_init_process();
$openbenchmarking = pts_storage_object::read_from_file(PTS_CORE_STORAGE, 'openbenchmarking');
$openbenchmarking_account_settings = pts_storage_object::read_from_file(PTS_CORE_STORAGE, 'openbenchmarking_account_settings');
if ($openbenchmarking != null) {
// OpenBenchmarking.org Account
pts_openbenchmarking_client::init_account($openbenchmarking, $openbenchmarking_account_settings);
}
return true;
}
示例12: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$tube = $input->getArgument('tube');
$resolvedTubeName = \Mosaicoon\QueueManager\QueueManager::resolveChannelName($tube);
cli_set_process_title('JambonQueueListener-' . $resolvedTubeName);
$worker = new Worker('127.0.0.1', new JobRunner(), new QMLogger($output));
$this->printFiglet();
$output->writeln("<info>In attesa di Job in coda sul canale {$resolvedTubeName}...</info>");
$worker->execute($tube);
}
示例13: fork
/**
* Forks something into another process and returns a deferred object.
* @param $callable
* @param string $processTitle
* @return Fork
*/
public function fork($callable, $processTitle = null)
{
if (!is_callable($callable)) {
throw new UnexpectedTypeException($callable, 'callable');
}
// allow the system to cleanup before forking
$this->dispatcher->dispatch(Events::PRE_FORK);
if (-1 === ($pid = pcntl_fork())) {
throw new ProcessControlException('Unable to fork a new process');
}
if (0 === $pid) {
if (function_exists('cli_set_process_title') && $processTitle !== null) {
cli_set_process_title($processTitle);
}
// reset the list of child processes
$this->forks = array();
// setup the shared memory
$shm = $this->factory->createSharedMemory(null, $this->signal);
$message = new ExitMessage();
// phone home on shutdown
register_shutdown_function(function () use($shm, $message) {
$status = null;
try {
$shm->send($message, false);
} catch (\Exception $e) {
// probably an error serializing the result
$message->setResult(null);
$message->setError(Error::fromException($e));
$shm->send($message, false);
exit(2);
}
});
// dispatch an event so the system knows it's in a new process
$this->dispatcher->dispatch(Events::POST_FORK);
if (!$this->debug) {
ob_start();
}
try {
$result = call_user_func($callable, $shm);
$message->setResult($result);
$status = is_integer($result) ? $result : 0;
} catch (\Exception $e) {
$message->setError(Error::fromException($e));
$status = 1;
}
if (!$this->debug) {
$message->setOutput(ob_get_clean());
}
exit($status);
}
// connect to shared memory
$shm = $this->factory->createSharedMemory($pid);
return $this->forks[$pid] = $this->factory->createFork($pid, $shm, $this->debug);
}
示例14: runJob
private static function runJob($job) : bool
{
if ($job !== null) {
$class = new $job['class']();
$function = $job['function'];
\cli_set_process_title('php cron.php ' . $job['class'] . '->' . $function);
$args = $job['args'];
$class->{$function}($args);
}
return true;
}
示例15: onWorkerStart
public function onWorkerStart($serv, $worker_id)
{
// 判定是否为Task进程
if ($worker_id >= $serv->setting['worker_num']) {
//echo "----onTaskStart worker_id: {$worker_id} \n";
cli_set_process_title("php5 task_id {$worker_id}");
} else {
//echo "--onWorkerStart worker_id: {$worker_id} \n";
cli_set_process_title("php5 worker {$worker_id}");
}
}