[ Index ]
 

Code source de eGroupWare 1.2.106-2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/filemanager/tests/ -> benchmark_dav.php (source)

   1  <?php
   2  
   3  
   4  $phpgw_info["flags"] = array("currentapp" => "filemanager",
   5                                  "noheader" => False,
   6                                  "noappheader" => False,
   7                                  "enable_vfs_class" => True);
   8  
   9  include("../../header.inc.php");
  10  
  11    function getmicrotime()
  12    { 
  13      list($usec, $sec) = explode(" ",microtime()); 
  14      return ((float)$usec + (float)$sec); 
  15     } 
  16     
  17  	function stats($array)
  18      {
  19             $mean = array_sum($array)/count($array);
  20             $a = 0;
  21             foreach ($array as $value)
  22             {
  23                 $a += ($value - $mean)*($value - $mean);
  24             }
  25             $std = sqrt($a/count($array));
  26             $error = $std/sqrt(count($array));
  27             echo "mean time: $mean error: +-$error";
  28      }
  29      echo '<b>Benchmarking vfs::ls</b><br>';
  30      $times = array(); 
  31      $phpgw->vfs->cd();
  32      for ($i=0;$i<20; $i++)
  33      {
  34          $phpgw->vfs->dav_client->cached_props = array();
  35          $time1 = getmicrotime();
  36          $result = $phpgw->vfs->ls (array ('string' => ''));
  37          $time = getmicrotime() - $time1;
  38          $times[] = $time;
  39          echo "run $i: $time<br>";
  40          //sleep(1);
  41          flush();
  42      }
  43      stats($times);
  44      
  45      echo '<br><b>Benchmarking dav_client::get_properties</b><br>';
  46      $times = array(); 
  47      $phpgw->vfs->cd();
  48      for ($i=0;$i<20; $i++)
  49      {
  50          $phpgw->vfs->dav_client->cached_props = array();
  51          $time1 = getmicrotime();
  52          $result = $phpgw->vfs->dav_client->get_properties('/home/sim');
  53          $time = getmicrotime() - $time1;
  54          $times[] = $time;
  55          echo "run $i: $time<br>";
  56          flush();
  57      }
  58      stats($times);
  59  
  60  
  61  ?>


Généré le : Sun Feb 25 17:20:01 2007 par Balluche grâce à PHPXref 0.7