我已經計算了我的程序中兩個進程的經過時間。當我在0.203秒內執行程序時,如果我離開頁面一段時間,經過時間改變並變爲0.173。這是什麼反應?我的php程序是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";
}
也許你的進程列表改變了? – BlitZ
臺式電腦和軟件不能實時運行。在常規計算機中,進程正在不斷地等待彼此,並且在任何給定時間都有數百個進程正在運行。沒有什麼能在可預測或持續的時間內執行。 – deceze