本文整理汇总了PHP中Stats::getStats方法的典型用法代码示例。如果您正苦于以下问题:PHP Stats::getStats方法的具体用法?PHP Stats::getStats怎么用?PHP Stats::getStats使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stats
的用法示例。
在下文中一共展示了Stats::getStats方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
public static function show($id)
{
$pokemon = Pokemons::find($id);
//$joins = Joins::getJoins($id);
$stats = Stats::getStats($id);
View::make('Pokemons/:id.html', array('pokemon' => $pokemon, 'stats' => $stats));
}
示例2: sscanf
foreach ($files as $file) {
if (strpos($file, "snapshot") !== false) {
// fnt is YYYY.mm.dd.HH.ii.ss
sscanf($file, "snapshot-%d.%d.%d.%d.%d.%d", $y, $m, $d, $h, $i, $s);
$time = mktime($h, $i, $s, $m, $d, $y);
if ($time > $ts || $ts == 0) {
$newfiles[] = $file;
}
}
}
print "finding files took: " . (microtime(true) - $start) . " secs\n";
$start = microtime(true);
// count the number of snapshots
$c = count($newfiles);
// get data we are interested in from each snapshot (quarantined/fast/ssl/good)
$bad = $stats->getStats(Stats::BAD);
$fast = $stats->getStats(Stats::FAST);
$ssl = $stats->getStats(Stats::SSL);
$good = $stats->getStats(Stats::GOOD);
//$xAxis = array();
$files = $stats->getDates(X_AXIS_FORMAT);
print "fetching stats took: " . (microtime(true) - $start) . " secs\n";
$start = microtime(true);
for ($j = 0; $j < $c; $j++) {
$file = PF_DIR . "/" . $newfiles[$j];
sscanf($newfiles[$j], "snapshot-%d.%d.%d.%d.%d.%d", $y, $m, $d, $h, $i, $s);
$date = sprintf("%d.%02d.%02d.%02d.%02d.%02d", $y, $m, $d, $h, $i, $s);
print "date: {$date}\n";
$db = new DatabaseImpl($file);
$count = count($db->searchEntries(SEARCH_FIELD_OFFSET | SEARCH_ARRAY, 8, 1));
$stats->addStats($date, Stats::BAD, $count);
示例3: die
<?php
/**
* Stats Example
* @author Michael Wright @MichaelW90
*/
// Stats class include
if (!(include_once './Stats.class.php')) {
die('Error including Stats.class.php');
}
// Instantiate instance of class
$stats = new Stats();
// Store the stats!
foreach ($stats->getStats() as $key => $item) {
echo '<strong>' . ucwords($key) . ':</strong> ';
if (is_array($item)) {
echo '<br />';
ksort($item);
foreach ($item as $subkey => $subitem) {
echo '<strong>- ' . $subkey . ':</strong> ' . $subitem . '<br />';
}
} else {
echo $item . '<br />';
}
}
示例4: started
Event::on('query.started', array($this, 'started'));
Event::on('query.completed', array($this, 'completed'));
}
/** Called when a query has started. */
public function started($query, $arguments)
{
$this->active = array('query' => $query, 'arguments' => $arguments, 'start' => microtime(true));
}
/** Called when a query has completed. */
public function completed($query)
{
$active = $this->active;
$active['end'] = microtime(true);
$active['duration'] = $active['end'] - $active['start'];
$this->stats[] = $active;
$this->active = null;
}
/** Returns the collected statistics. */
public function getStats()
{
return $this->stats;
}
}
$stats = new Stats();
$stats->register();
// Execute some queries
Person::find(10);
Person::objects()->fetch();
// Print collected statistics
print_r($stats->getStats());