當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Stats::getStats方法代碼示例

本文整理匯總了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));
 }
開發者ID:Terppa,項目名稱:Tsoha-Bootstrap,代碼行數:7,代碼來源:pokemon_controller.php

示例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);
開發者ID:TheProjecter,項目名稱:miscellaneousrepo,代碼行數:31,代碼來源:job.php

示例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 />';
    }
}
開發者ID:JPKCom,項目名稱:Basehold.it,代碼行數:25,代碼來源:getStats.php

示例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());
開發者ID:Macavity,項目名稱:phormium,代碼行數:30,代碼來源:events.php


注:本文中的Stats::getStats方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。