Access the statistics

@return \Twilio\Rest\Taskrouter\V1\Workspace\Worker\WorkerStatisticsList
343175
protected function getStatistics() {
        if (!$this->_statistics) {
            $this->_statistics = new WorkerStatisticsList(
                $this->version,
                $this->solution['workspaceSid'],
                $this->solution['sid']
            );
        }

        return $this->_statistics;
    }
463899
protected function getRealTimeStatistics() {
        if (!$this->_realTimeStatistics) {
            $this->_realTimeStatistics = new TaskQueueRealTimeStatisticsList(
                $this->version,
                $this->solution['workspaceSid'],
                $this->solution['sid']
            );
        }

        return $this->_realTimeStatistics;
    }
11891
public function getStats()
    {
        $service = $this->getService();

        // stats for a site
        $response = $service->request('stats', 'GET', NULL, $this->getParams());

        $responseArray = $this->getResponseArray($response);

        if (!$this->isError()) {
            $this->_data = $responseArray;
        } else {
            $this->_data = array();
        }

        return $this;
    }
777383
public function getStat()
    {
        $sources = [];
        $names = [];
        foreach ($this->lines as $line) {
            $line->loadStat($sources, $names);
        }
        return [
            'sources' => $sources,
            'names' => $names,
        ];
    }
967234
public static function getStateOfWorkers()
    {
        $offset = 0;

        $stat = [
            'idle' => 0,
            'busy' => 0,
            'alive' => 0,
            'shutdown' => 0,
            'preinit' => 0,
            'init' => 0,
            'reloading' => 0,
        ];
        $readed = 0;
        while (($buf = Daemon::$shm_wstate->read($readed, 1024)) !== false) {
            $buflen = mb_orig_strlen($buf);
            $readed += $buflen;
            for ($i = 0; $i < $buflen; ++$i) {
                $code = ord($buf[$i]);
                if ($code >= 100) {
                    // reloaded (shutdown)
                    $code -= 100;
                    if ($code !== Daemon::WSTATE_SHUTDOWN) {
                        ++$stat['alive'];
                        if (Daemon::$process instanceof Thread\Master) {
                            Daemon::$process->reloadWorker($offset + $i + 1);
                            ++$stat['reloading'];
                            continue;
                        }
                    }
                }
                if ($code === Daemon::WSTATE_IDLE) {
                    // idle
                    ++$stat['alive'];
                    ++$stat['idle'];
                } elseif ($code === Daemon::WSTATE_BUSY) {
                    // busy
                    ++$stat['alive'];
                    ++$stat['busy'];
                } elseif ($code === Daemon::WSTATE_SHUTDOWN) {
                    // shutdown
                    ++$stat['shutdown'];
                } elseif ($code === Daemon::WSTATE_PREINIT) {
                    // pre-init
                    ++$stat['alive'];
                    ++$stat['preinit'];
                    ++$stat['idle'];
                } elseif ($code === Daemon::WSTATE_INIT) { // init
                    ++$stat['alive'];
                    ++$stat['init'];
                    ++$stat['idle'];
                }
            }
        }
        return $stat;
    }
1173094
protected function _getWorkers()
    {
        foreach ($this->workersMap as $workerUid => $workerConfig) {
            if (is_string($workerConfig)) {
                $workerConfig = [
                    'class' => $workerConfig,
                ];
            }
            if (
                !isset($workerConfig['class'])
                || (isset($workerConfig['active']) && !$workerConfig['active'])
            ) {
                continue;
            }
            if (
                !isset($workerConfig['delay'])
                || !isset($workerConfig['maxProcesses'])
            ) {
                $worker = new $workerConfig['class']();
                if (!isset($workerConfig['delay'])) {
                    $workerConfig['delay'] = $worker->delay;
                }
                if (!isset($workerConfig['maxProcesses'])) {
                    $workerConfig['maxProcesses'] = $worker->maxProcesses;
                }
                unset($worker);
            }
            static::$_workersData[$workerUid] = [
                'class' => $workerConfig['class'],
                'maxProcesses' => $workerConfig['maxProcesses'],
                'delay' => $workerConfig['delay'],
                'tick' => 1,
            ];
            static::$_workersConfig[$workerUid] = $workerConfig;
            static::$workersPids[$workerUid] = [];
        }
    }
113814
def statistics(self):
        
        if self._statistics is None:
            self._statistics = WorkersStatisticsList(
                self._version,
                workspace_sid=self._solution['workspace_sid'],
            )
        return self._statistics
412894
private function getStatisticSites() {
		$result = [ ];
		
		$StatistikQuery = new \SMWPrintRequest ( \SMWPrintRequest::PRINT_PROP, "StatistikQuery",
				\SMWPropertyValue::makeUserProperty ( 'StatistikQuery' ) );
		$StatistikTemplate = new \SMWPrintRequest ( \SMWPrintRequest::PRINT_PROP, "StatistikTemplate",
				\SMWPropertyValue::makeUserProperty ( 'StatistikTemplate' ) );
		
		$pages = QueryUtils::executeBasicQuery ( '[[Category:Statistik]]', [$StatistikQuery, $StatistikTemplate ], [] );
		
		while ( $res = $pages->getNext () ) {
			$pageID = $res [0]->getNextText ( SMW_OUTPUT_WIKI );
			$StatistikQuery = $res [1]->getNextText ( SMW_OUTPUT_WIKI );
			$StatistikTemplate = $res [2]->getNextText ( SMW_OUTPUT_WIKI );
			$mwTitle = \Title::newFromText ( $pageID );
			$result [] = [ 'title' => $mwTitle,
						   'statistikQuery' => urldecode($StatistikQuery),
						   'statistikTemplate' => urldecode($StatistikTemplate)
			];
		}
		
		return $result;
	}
813195
public function getSendStatistics() {
		$rest = new SimpleEmailServiceRequest($this, 'GET');
		$rest->setParameter('Action', 'GetSendStatistics');

		$rest = $rest->getResponse();
		if($rest->error === false && $rest->code !== 200) {
			$rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status');
		}
		if($rest->error !== false) {
			$this->__triggerError('getSendStatistics', $rest->error);
			return false;
		}

		$response = array();
		if(!isset($rest->body)) {
			return $response;
		}

		$datapoints = array();
		foreach($rest->body->GetSendStatisticsResult->SendDataPoints->member as $datapoint) {
			$p = array();
			$p['Bounces'] = (string)$datapoint->Bounces;
			$p['Complaints'] = (string)$datapoint->Complaints;
			$p['DeliveryAttempts'] = (string)$datapoint->DeliveryAttempts;
			$p['Rejects'] = (string)$datapoint->Rejects;
			$p['Timestamp'] = (string)$datapoint->Timestamp;

			$datapoints[] = $p;
		}

		$response['SendDataPoints'] = $datapoints;
		$response['RequestId'] = (string)$rest->body->ResponseMetadata->RequestId;

		return $response;
	}
1257772
public function getStats()
    {
        $this->stats = array(
            'tooSlow'        => 0,
            'slowAcceptable' => 0,
            'aBitSlow'       => 0,
            'goodSlow'       => 0,
            'perfect'        => 0,
            'goodFast'       => 0,
            'aBitFast'       => 0,
            'fastAcceptable' => 0,
            'tooFast'        => 0
        );

        $cuesCount = $this->getCuesCount();
        for ($i = 0; $i < $cuesCount; $i++) {
            $rs = $this->getCue($i)->getReadingSpeed();

            if ($rs < 5) {
                $this->stats['tooSlow']++;
            } elseif ($rs < 10) {
                $this->stats['slowAcceptable']++;
            } elseif ($rs < 13) {
                $this->stats['aBitSlow']++;
            } elseif ($rs < 15) {
                $this->stats['goodSlow']++;
            } elseif ($rs < 23) {
                $this->stats['perfect']++;
            } elseif ($rs < 27) {
                $this->stats['goodFast']++;
            } elseif ($rs < 31) {
                $this->stats['aBitFast']++;
            } elseif ($rs < 35) {
                $this->stats['fastAcceptable']++;
            } else {
                $this->stats['tooFast']++;
            }
        }

        return $this->stats;
    }
1226529
public function getAllTasks()
    {
        $result = $this->callService('GET', self::API_FS_TASK);

        return $result->getModels(models\FileSystem\FsTask::class);
    }
111674
public function collectStats()
    {
        Container::get('hooks')->fire('model.index.collect_stats_start');

        // Collect some statistics from the database
        if (!Container::get('cache')->isCached('users_info')) {
            Container::get('cache')->store('users_info', Cache::getUsersInfo());
        }

        $stats = Container::get('cache')->retrieve('users_info');

        $query = DB::forTable('forums')
            ->select_expr('SUM(num_topics)', 'total_topics')
            ->select_expr('SUM(num_posts)', 'total_posts');

        $query = Container::get('hooks')->fireDB('model.index.collect_stats_query', $query);

        $query = $query->find_one();

        $stats['total_topics'] = Utils::numberFormat((int)$query['total_topics']);
        $stats['total_posts'] = Utils::numberFormat((int)$query['total_posts']);

        if (User::get()->g_view_users == '1') {
            $stats['newest_user'] = '<a href="'.
                Router::pathFor('userProfile', ['id' => $stats['last_user']['id']]).'">'.
                Utils::escape($stats['last_user']['username']).'</a>';
        } else {
            $stats['newest_user'] = Utils::escape($stats['last_user']['username']);
        }
        $stats['total_users'] = Utils::numberFormat((int)$stats['total_users']);

        $stats = Container::get('hooks')->fire('model.index.collect_stats', $stats);

        return $stats;
    }
611359
public function getStatistics()
    {
        return [
            'currentCallCount'       => count($this->calls),
            'registeredAt'           => $this->registeredAt,
            'invocationCount'        => $this->invocationCount,
            'invocationAverageTime'  => $this->invocationAverageTime,
            'busyTime'               => $this->busyTime,
            'busyStart'              => $this->busyStart,
            'lastIdledAt'            => $this->lastIdledAt,
            'lastCallStartedAt'      => $this->lastCallStartedAt,
            'completedCallTimeTotal' => $this->completedCallTimeTotal
        ];
    }
802417
public function getStats()
    {
        $result = [
            self::STATS_QUEUES_LIST   => [],
            self::STATS_JOBS_TOTAL    => 0,
            self::STATS_JOBS_READY    => 0,
            self::STATS_JOBS_RESERVED => 0,
            self::STATS_JOBS_DELAYED  => 0,
            self::STATS_JOBS_BURIED   => 0,
        ];

        $queueList = $this->getQueueNames();
        if (count($queueList) == 0) {
            return $result;
        }

        $result[self::STATS_QUEUES_LIST] = $queueList;

        foreach ($queueList as $queueName) {
            $itemStats = $this->getQueueInfo($queueName);
            $result[self::STATS_JOBS_READY] += $itemStats[self::STATS_JOBS_READY];
            $result[self::STATS_JOBS_RESERVED] += $itemStats[self::STATS_JOBS_RESERVED];
            $result[self::STATS_JOBS_DELAYED] += $itemStats[self::STATS_JOBS_DELAYED];
            $result[self::STATS_JOBS_BURIED] += $itemStats[self::STATS_JOBS_BURIED];
            $result[self::STATS_JOBS_TOTAL] += $itemStats[self::STATS_JOBS_TOTAL];
            $result[self::STATS_QUEUES][$queueName] = $itemStats;
        }

        return $result;
    }
814635
public function rowCounts()
    {
        if (!$this->rowCounts) {
            foreach ($this->data['resultSets'] as $resultSet) {
                $this->rowCounts[] = $resultSet['stats']['rowCountExact'];
            }
        }

        return $this->rowCounts;
    }
94768
public function getStats()
    {
        if (isset($this->stats)) return $this->stats;
        
        $stats = array();
        $stats['channels'] = '1';
        
        foreach (explode("\n", $this->sox('-n', 'stats')) as $line) {
            if (empty($line) || preg_match('/^\S+ WARN/', $line)) continue;
            
            if ($line[0] == ' ') {
                $stats['channels'] = (string)count(preg_split('/\s+/', trim($line))) - 1;
                continue;
            }
            
            list($key, $value) = preg_split('/\s{2,}/', $line) + array(1=>null);
            if (!isset($value)) continue;
            
            $key = strtolower(preg_replace(array('/\s(s|dB)$/', '/\W+/'), array('', '_'), $key));
            $value = preg_replace('/\s.*$/', '', $value);
            $stats[$key] = $value;
        }
        
        foreach (explode("\n", $this->sox('-n', 'stat')) as $line) {
            if (preg_match('/^\S+ WARN/', $line)) continue;
            
            list($key, $value) = explode(':', $line) + array(1=>null);
            if (!isset($value)) continue;
            
            if ($key == 'Samples read') $key = 'samples';
             elseif ($key == 'Length (seconds)') $key = 'length';
             else $key = strtolower(preg_replace('/\s+/', '_', $key));
            
            $stats[$key] = trim($value);
        }
        
        unset($stats['num_samples']);
        $stats['sample_rate'] = (string)round(($stats['samples'] / $stats['channels']) / $stats['length']);
        
        $this->stats = (object)$stats;
        return $this->stats;
    }
1037883
def get(self):
        
        return WorkerStatisticsContext(
            self._version,
            workspace_sid=self._solution['workspace_sid'],
            worker_sid=self._solution['worker_sid'],
        )