当前位置: 首页>>代码示例>>PHP>>正文


PHP Piwik::getPrettySizeFromBytes方法代码示例

本文整理汇总了PHP中Piwik::getPrettySizeFromBytes方法的典型用法代码示例。如果您正苦于以下问题:PHP Piwik::getPrettySizeFromBytes方法的具体用法?PHP Piwik::getPrettySizeFromBytes怎么用?PHP Piwik::getPrettySizeFromBytes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Piwik的用法示例。


在下文中一共展示了Piwik::getPrettySizeFromBytes方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getAllTablesStatus

 public static function getAllTablesStatus()
 {
     Piwik::checkUserIsSuperUser();
     $db = Zend_Registry::get('db');
     // http://dev.mysql.com/doc/refman/5.1/en/show-table-status.html
     $tablesPiwik = Piwik::getTablesInstalled();
     $total = array('Name' => 'Total', 'Data_length' => 0, 'Index_length' => 0, 'Rows' => 0);
     $table = array();
     foreach ($tablesPiwik as $tableName) {
         $t = self::getTableStatus($tableName);
         $total['Data_length'] += $t['Data_length'];
         $total['Index_length'] += $t['Index_length'];
         $total['Rows'] += $t['Rows'];
         $t['Total_length'] = Piwik::getPrettySizeFromBytes($t['Index_length'] + $t['Data_length']);
         $t['Data_length'] = Piwik::getPrettySizeFromBytes($t['Data_length']);
         $t['Index_length'] = Piwik::getPrettySizeFromBytes($t['Index_length']);
         $t['Rows'] = Piwik::getPrettySizeFromBytes($t['Rows']);
         $table[] = $t;
     }
     $total['Total_length'] = Piwik::getPrettySizeFromBytes($total['Data_length'] + $total['Index_length']);
     $total['Data_length'] = Piwik::getPrettySizeFromBytes($total['Data_length']);
     $total['Index_length'] = Piwik::getPrettySizeFromBytes($total['Index_length']);
     $total['TotalRows'] = Piwik::getPrettySizeFromBytes($total['Rows']);
     $table['Total'] = $total;
     return $table;
 }
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:26,代码来源:API.php

示例2: index

 /**
  * Returns the index for this plugin. Shows every other report defined by this plugin,
  * except the '...ByYear' reports. These can be loaded as related reports.
  * 
  * Also, the 'getIndividual...Summary' reports are loaded by AJAX, as they can take
  * a significant amount of time to load on setups w/ lots of websites.
  */
 public function index()
 {
     Piwik::checkUserIsSuperUser();
     $view = Piwik_View::factory('index');
     $this->setBasicVariablesView($view);
     $view->menu = Piwik_GetAdminMenu();
     $view->databaseUsageSummary = $this->getDatabaseUsageSummary(true);
     $view->trackerDataSummary = $this->getTrackerDataSummary(true);
     $view->metricDataSummary = $this->getMetricDataSummary(true);
     $view->reportDataSummary = $this->getReportDataSummary(true);
     $view->adminDataSummary = $this->getAdminDataSummary(true);
     list($siteCount, $userCount, $totalSpaceUsed) = Piwik_DBStats_API::getInstance()->getGeneralInformation();
     $view->siteCount = Piwik::getPrettyNumber($siteCount);
     $view->userCount = Piwik::getPrettyNumber($userCount);
     $view->totalSpaceUsed = Piwik::getPrettySizeFromBytes($totalSpaceUsed);
     echo $view->render();
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:24,代码来源:Controller.php

示例3: oneShotTest_memoryUsageArrayIncreasingIndexOrJumps

 function oneShotTest_memoryUsageArrayIncreasingIndexOrJumps()
 {
     ini_set('memory_limit', '200M');
     Piwik::createConfigObject();
     Piwik::createLogObject();
     //test array[0] array[1] array[2]
     //VS
     // test array[0] array[100] array[200]
     // same memory  usage? hash
     echo "start " . __FUNCTION__ . "<br>";
     Piwik::printMemoryUsage();
     $timer = new Piwik_Timer();
     $testId = 2;
     if ($testId == 1) {
         echo "start incrementing index<br>";
         $array = array();
         for ($i = 0; $i < 1000000; $i++) {
             $array[$i] = 1;
         }
     } elseif ($testId == 2) {
         echo "start indexing by strings<br>";
         $array = array();
         for ($i = 0; $i < 1000000; $i++) {
             $array[$i . "_" . $i] = 1;
         }
     } elseif ($testId == 3) {
         echo "start jumping index<br>";
         for ($i = 0; $i < 1000000; $i++) {
             $array[$i * 100] = 1;
         }
     }
     echo $timer . "<br>";
     echo "size serialized:" . Piwik::getPrettySizeFromBytes(strlen(serialize($array))) . "<br>";
     Piwik::printMemoryUsage();
     echo "end " . __FUNCTION__ . "<br>";
 }
开发者ID:klando,项目名称:pgpiwik,代码行数:36,代码来源:PHP_Related.test.php

示例4: getMemoryLeak

 public function getMemoryLeak()
 {
     return "Memory delta: " . Piwik::getPrettySizeFromBytes($this->getMemoryUsage() - $this->memoryStart);
 }
开发者ID:Doluci,项目名称:tomatocart,代码行数:4,代码来源:Timer.php

示例5: run_test

function run_test($klass, $method)
{
    try {
        // create instance
        $reflector = new ReflectionClass($klass);
        $instance = $reflector->newInstanceArgs();
        // run setUp
        $instance->setUp();
        // start timing
        $start_time = microtime(true);
        $start_memory = memory_get_usage();
        // run test
        $result = $reflector->getMethod($method)->invoke($instance);
        // end timing
        $end_time = microtime(true);
        $end_memory = memory_get_usage();
        // run tearDown
        $instance->tearDown();
        // return results
        echo json_encode(array('start_time' => round($start_time, 4), 'end_time' => round($end_time, 4), 'elapsed' => round($end_time - $start_time, 4), 'memory' => Piwik::getPrettySizeFromBytes($end_memory - $start_memory, $unit = null, $precision = 2), 'result' => $result));
    } catch (Exception $ex) {
        echo json_encode(array('error' => $ex->getMessage(), 'trace' => $ex->getTraceAsString()));
    }
}
开发者ID:nnnnathann,项目名称:piwik,代码行数:24,代码来源:benchmark_runner.php


注:本文中的Piwik::getPrettySizeFromBytes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。