Adding more timing statistics, a=chris
Adding more timing statistics, a=chris
diff --git a/lib/index_bundle_iterators/network_iterator.php b/lib/index_bundle_iterators/network_iterator.php
index 8d6e13b..faf6968 100644
--- a/lib/index_bundle_iterators/network_iterator.php
+++ b/lib/index_bundle_iterators/network_iterator.php
@@ -219,12 +219,16 @@ class NetworkIterator extends IndexBundleIterator
}
$i++;
}
-
+ $net_times = AnalyticsManager::get("NET_TIMES");
+ $net_times = ($net_times) ? $net_times : 0;
+ $download_time = microtime();
$downloads = array();
if(count($sites) > 0) {
$downloads = FetchUrl::getPages($sites, false, 0, NULL, self::URL,
self::PAGE, true);
}
+ $net_times += changeInMicrotime($download_time);
+ AnalyticsManager::set("NET_TIMES", $net_times);
$results = array();
$count = count($downloads);
$this->num_docs = 0;
@@ -233,6 +237,9 @@ class NetworkIterator extends IndexBundleIterator
$machine_times = AnalyticsManager::get("MACHINE_TIMES");
$machine_times = ($machine_times) ? $machine_times . "<br />$in4" :
"$in4";
+ $max_machine_times = AnalyticsManager::get("MAX_MACHINE_TIMES");
+ $max_machine_times = ($max_machine_times) ? $max_machine_times : 0;
+ $max_time = 0;
for($j = 0; $j < $count; $j++) {
$download = & $downloads[$j];
if(isset($download[self::PAGE])) {
@@ -254,11 +261,14 @@ class NetworkIterator extends IndexBundleIterator
}
}
}
+ $max_time = max($max_time, $pre_result['ELAPSED_TIME']);
+ $max_machine_times += $max_time;
$machine_times .= "ID_".$lookup[$j].": ".
$pre_result['ELAPSED_TIME']." ";
}
}
AnalyticsManager::set("MACHINE_TIMES", $machine_times);
+ AnalyticsManager::set("MAX_MACHINE_TIMES", $max_machine_times);
if($results == array()) {
$results = -1;
}
diff --git a/models/phrase_model.php b/models/phrase_model.php
index 3fee1d4..afa9eb9 100755
--- a/models/phrase_model.php
+++ b/models/phrase_model.php
@@ -409,7 +409,7 @@ class PhraseModel extends ParallelModel
}
if(QUERY_STATISTICS) {
- $this->query_info['QUERY'] .= "<b>Format time</b>: ".
+ $this->query_info['QUERY'] .= "<b>Format Time</b>: ".
changeInMicrotime($format_time)."<br />";
$this->query_info['ELAPSED_TIME'] = changeInMicrotime($start_time);
$this->db->total_time += $this->query_info['ELAPSED_TIME'];
@@ -848,6 +848,7 @@ class PhraseModel extends ParallelModel
if($raw != 1) {
// initialize scores
+ $sort_start = microtime();
for($i = 0; $i < $result_count; $i++) {
$pages[$i]["OUT_SCORE"] = 0;
}
@@ -876,6 +877,7 @@ class PhraseModel extends ParallelModel
for($i = 0; $i < $result_count; $i++) {
$pages[$i][self::SCORE] = $pages[$i]["OUT_SCORE"];
}
+ $sort_time = changeInMicrotime($sort_start);
}
if($num_retrieved < $to_retrieve) {
@@ -914,9 +916,23 @@ class PhraseModel extends ParallelModel
changeInMicrotime($lookup_time)."<br />";
$machine_times = AnalyticsManager::get("MACHINE_TIMES");
if($machine_times) {
- $this->query_info['QUERY'] .= "$in3<b>Machine Times</b>:<br />".
+ $this->query_info['QUERY'] .=
+ "$in3<b>Machine Sub-Times</b>:<br />".
$machine_times."<br />";
}
+ $net_times = AnalyticsManager::get("NET_TIMES");
+ $max_machine_times = AnalyticsManager::get("MAX_MACHINE_TIMES");
+ if($net_times && $max_machine_times) {
+ $this->query_info['QUERY'] .=
+ "$in3<b>Network Overhead Sub-Time</b>: ".
+ ($net_times - $max_machine_times)."<br />";
+ }
+ if($sort_time) {
+ $this->query_info['QUERY'] .=
+ "$in3<b>Merge-Rank Sub-Time</b>: ".
+ $sort_time."<br />";
+ }
+
$summaries_time = microtime();
}
@@ -939,7 +955,7 @@ class PhraseModel extends ParallelModel
}
}
if(QUERY_STATISTICS) {
- $this->query_info['QUERY'] .= "$in2<b>Get Summaries time</b>: ".
+ $this->query_info['QUERY'] .= "$in2<b>Get Summaries Time</b>: ".
changeInMicrotime($summaries_time)."<br />";
$format_time = microtime();
}
diff --git a/views/layouts/web_layout.php b/views/layouts/web_layout.php
index f636e52..4a8a196 100755
--- a/views/layouts/web_layout.php
+++ b/views/layouts/web_layout.php
@@ -139,8 +139,7 @@ class WebLayout extends Layout
?></script>
</body>
- </html>
- <?php
+ </html><?php
}
}
?>