Get the number of Horizon workers for a given supervisor.

@param  string  $name
@return int
167104
public function get($name)
    {
        $process = Process::fromShellCommandline('exec ps aux | grep '.static::$command, null, ['COLUMNS' => '2000']);

        $process->run();

        return substr_count($process->getOutput(), 'supervisor='.$name);
    }
869524
public static function hasTask($name)
    {
        if (!self::$tasks) {
            return false;
        }
        if (isset(self::$tasks[$name])) {
            return true;
        }

        return false;
    }
403045
private static String getWorkerMetricName(String name) {
    String result = CACHED_METRICS.get(name);
    if (result != null) {
      return result;
    }
    return CACHED_METRICS.computeIfAbsent(name,
        n -> getMetricNameWithUniqueId(InstanceType.WORKER, name));
  }
425990
public function countOfType(string $name): int
    {
        $oid = AttributeType::attrNameToOID($name);
        return array_sum(
            array_map(
                function (RDN $rdn) use ($oid) {
                    return count($rdn->allOf($oid));
                }, $this->_rdns));
    }
1321187
public function find($name)
	{
		$hztp = new self();

		if (is_numeric($name))
		{
			$hztp->id = $name;
		}
		else
		{
			$hztp->name = $name;
		}

		if ($hztp->read() == false)
		{
			return false;
		}

		return $hztp;
	}
861005
public function count($name, $query, CountableFilterInterface $filter)
    {
        // if the columnname is not set, assume an id field based on a table name
        $columnName  = (empty($this->columnName))
                            ?   $name
                            :   $this->columnName;

        if ( ! $this->includeEmpty) {
            $query->whereNotNull($columnName);
        }

        return $query->select(
                        "{$columnName} AS {$this->columnAlias}",
                        DB::raw("{$this->countRaw} AS {$this->countAlias}")
                     )
                     ->groupBy($columnName)
                     ->pluck($this->countAlias, $this->columnAlias);
    }
256285
public function getCleanedFieldAsInt(string $field_name): int
    {
        if (empty($this->initial_data[$field_name])) {
            return 0;
        }

        if (!is_scalar($this->initial_data[$field_name])) {
            return 0;
        }

        return (int)$this->initial_data[$field_name];
    }
536872
protected function totalProcessCount()
    {
        $supervisors = app(SupervisorRepository::class)->all();

        return collect($supervisors)->reduce(function ($carry, $supervisor) {
            return $carry + collect($supervisor->processes)->sum();
        }, 0);
    }
79270
public static function counting(string $name, int $hit, $total = null)
    {
        self::getLogger()->counting($name, $hit, $total);
    }
857800
public static function getWorkerID()
    {
        if(null === static::$workerID)
        {
            $main = ServerManage::getServer('main');
            if($main)
            {
                $workerID = $main->getSwooleServer()->worker_id;
                if($workerID > -1)
                {
                    static::$workerID = $workerID;
                }
            }
        }
        return static::$workerID;
    }
442665
public function getMinkParameter($name)
    {
        return isset($this->minkParameters[$name]) ? $this->minkParameters[$name] : null;
    }
1097054
public function get($name)
    {
        if (isset($this->factories[$name])) {
            return $this->factories[$name];
        }

        throw JobFactoryException::create(sprintf('Not found %s job factory', $name));
    }
1360994
public function lastByName($name) {
        for ($i = count($this->tokens) - 1; $i >= 0; $i--) {
            if ($this->tokens[$i]->getName() === $name) {
                return $this->tokens[$i];
            }
        }

        return null;
    }
1237649
public static function benchmark(string $name = '') {
		if (self::$debug) {
			static $start = NULL;
			static $total = 0;
			$benchmark = 0;
			if (is_null($start)) {
				$start = self::getMicrotime();
			} else {
				$temp = self::getMicrotime();
				$benchmark = $temp - $start;
				$start = $temp;
			}
			$total+= $benchmark;
			self::$data['benchmark'][] = [
				'name' => $name,
				'time' => \Format::timeSeconds($benchmark) . '',
				'total' => \Format::timeSeconds($total),
				'start' => \Format::datetime($start, ['skip_user_timezone' => true]),
				'memory' => memory_get_peak_usage(true)
			];
		}
	}
1316873
public function staticPartLength($name)
    {
        $nestedTypes = $this->nestedTypes($name);

        if ($nestedTypes === false) {
            $nestedTypes = ['[1]'];
        }
        $count = 32;

        foreach ($nestedTypes as $type) {
            $num = mb_substr($type, 1, 1);

            if (!is_numeric($num)) {
                $num = 1;
            } else {
                $num = intval($num);
            }
            $count *= $num;
        }

        return $count;
    }
310131
public function counting($name, $hit, $total = null)
    {
        if (! \is_string($name) || empty($name)) {
            return;
        }

        $cid = Coroutine::tid();
        if (! isset($this->countings[$cid][$name])) {
            $this->countings[$cid][$name] = ['hit' => 0, 'total' => 0];
        }
        $this->countings[$cid][$name]['hit'] += (int)$hit;
        if ($total !== null) {
            $this->countings[$cid][$name]['total'] += (int)$total;
        }
    }
1055923
public function extract($name)
    {
        $queue = $this->getInstance($name);
        return $queue->isEmpty() ? false : $queue->extract();
    }