我已经计算了我的程序中两个进程的经过时间。当我执行程序时,经过时间为 0.203 秒,但如果我离开页面一段时间,经过时间会改变并变为 0.173。这是什么原因?我的php程序是
include ('db.php');
$data=array();
session_start();
$start_time= microtime(true);
if (isset($_SESSION['img']))
{
$image=$_SESSION['img'];
$addr="C:/Users/adithi.a/Desktop/FashionSearch/trial/db_features/distrib/db_features.exe $image";
exec($addr,$data);
/*for($i=18;$i<=34;$i++)
{
if($i!=30)
{
echo $data[$i]."<br>";
}
}*/
$start_time1=microtime(true);
$result=mysql_query("select tbl_features.img_id,img_path,((pow(($data[18]-features_1),2))+(pow(($data[19]-features_2),2))+(pow(($data[20]-features_3),2))+(pow(($data[21]-features_4),2))+(pow(($data[22]-features_5),2))+(pow(($data[23]-features_6),2))+(pow(($data[24]-features_7),2))+(pow(($data[25]-features_8),2))+(pow(($data[26]-features_9),2))+(pow(($data[27]-features_10),2))+(pow(($data[28]-features_11),2))+(pow(($data[29]-features_12),2))+(pow(($data[31]-features_13),2))+(pow(($data[32]-features_14),2))+(pow(($data[33]-features_15),2))+(pow(($data[34]-features_16),2))) as distance from tbl_features join tbl_image where tbl_features.img_id=tbl_image.img_id AND tbl_features.img_id>=92303 AND tbl_features.img_id<124232 ORDER BY distance ASC LIMIT 6") or die(mysql_error());
while($num=mysql_fetch_assoc($result))
{
echo "<a href='Dressinformation.php?image=$num[img_id]'><div class='imgdiv'><img src='$num[img_path]'></div></a>";
//echo $num["img_id"]." ".$num["img_path"]." ".$num["distance"]."<br>";
}
$stop_time1= microtime(true);
$time1=$stop_time1-$start_time1;
print "Euclidean distance time is $time1 seconds";
$stop_time= microtime(true);
$time=$stop_time-$start_time;
print "elapse time was $time seconds.";
}
else
{
echo "Please upload image";
}