<?php
require_once("iecho.php");

$nvfile="d:/union_2.log";
$data=file_get_contents ( $nvfile );

$reg = "#/users/([^/]+)/.+ HTTP/1\..\" 200 ([0-9]+)#im";
preg_match_all($reg,$data,$matches);
foreach$matches[1as $key=>$file )
{
    
$rows[$file]['cnt']++;
    
$rows[$file]['size']=$matches[2][$key];
}
arsort($rows);

$i=0;
$t = 0;
foreach$rows as $file=>$row )
{
    
$size = $row['cnt']*$row['size'];
    
$r[$file= getMbps($size);
    
    
$i++;
    
if$i>15 )
        
break;
    
$t+=$size;
}

echo getMbps($t);

pr(
$r);

//prt($matches);

function getMbps($bytes)
{
    
return 8*($bytes/(1024*1024))/(15*60. "Mbps";    
}


?>
Posted on 2007-06-26 17:18  古代  阅读(463)  评论(0编辑  收藏  举报