Summary
Description: Phoronix Test Suite open-source benchmarking development
Last Change: Tue 5/21/13 15:49
Recent Commits
>
--git a/CHANGE-LOG b/CHANGE-LOG
index 1ad14b2..0b7dc6c 100644
--- a/CHANGE-LOG
+++ b/CHANGE-LOG
@@ -22,6 +22,7 @@ Phoronix Test Suite (Git)
- pts-core: Add PTS External Dependencies support for Optware
- pts-core: Add yasm to PTS External Dependencies
- pts-core: Support using PHP's cURL library for handling downloads when available
+- pts-core: Calculate download speeds for each test file download, to provide estimations on future downloads for how long it may take to download
- phodevi: Split out phodevi_parser module into phodevi_linux_parser, phodevi_osx_parser, and phodevi_solaris_parser for OS-specific functions
- phodevi: Avoid situations of the manufacturer/vendor string being repeated in the motherboard property
- phodevi: Add device notes and special settings string functionality to API
diff --git a/pts-core/library/pts-functions_assignments.php b/pts-core/library/pts-functions_assignments.php
index 0925c9c..06cba27 100644
--- a/pts-core/library/pts-functions_assignments.php
+++ b/pts-core/library/pts-functions_assignments.php
@@ -33,6 +33,13 @@ function pts_read_assignment($assignment)
{
return pts_assignment_manager::read($assignment);
}
+function pts_read_and_clear_assignment($assignment)
+{
+ $read = pts_assignment_manager::read($assignment);
+ pts_assignment_manager::clear($assignment);
+
+ return $read;
+}
function pts_is_assignment($assignment)
{
return pts_assignment_manager::is_set($assignment);
diff --git a/pts-core/library/pts-functions_tests.php b/pts-core/library/pts-functions_tests.php
index 3ab3e2d..68192de 100644
--- a/pts-core/library/pts-functions_tests.php
+++ b/pts-core/library/pts-functions_tests.php
@@ -457,12 +457,12 @@ function pts_suite_identifier_to_name($identifier)
return $cache[$identifier];
}
-function pts_estimated_download_size($identifier)
+function pts_estimated_download_size($identifier, $divider = 1048576)
{
// Estimate the size of files to be downloaded
static $cache;
- if(is_array($identifier) || !isset($cache[$identifier]))
+ if(is_array($identifier) || !isset($cache[$identifier][$divider]))
{
$estimated_size = 0;
@@ -471,17 +471,19 @@ function pts_estimated_download_size($identifier)
// The work for calculating the download size in 1.4.0+
foreach(pts_objects_test_downloads($test) as $download_object)
{
- $estimated_size += pts_trim_double($download_object->get_filesize() / 1048576);
+ $estimated_size += $download_object->get_filesize();
}
}
+ $estimated_size = pts_trim_double($estimated_size / $divider);
+
if(!is_array($identifier))
{
- $cache[$identifier] = $estimated_size;
+ $cache[$identifier][$divider] = $estimated_size;
}
}
- return is_array($identifier) ? $estimated_size : $cache[$identifier];
+ return is_array($identifier) ? $estimated_size : $cache[$identifier][$divider];
}
function pts_estimated_environment_size($identifier)
{
diff --git a/pts-core/library/pts-includes-install.php b/pts-core/library/pts-includes-install.php
index f1379bb..fd80b25 100644
--- a/pts-core/library/pts-includes-install.php
+++ b/pts-core/library/pts-includes-install.php
@@ -69,6 +69,8 @@ function pts_start_install($to_install, &$display_mode)
"\nEstimated Install Size: " . pts_estimated_environment_size($tests) . " MB");
}
pts_set_assignment("TEST_INSTALL_COUNT", $install_count);
+ pts_set_assignment("DOWNLOAD_AVG_COUNT", pts_storage_object::read_from_file(PTS_CORE_STORAGE, "download_average_count"));
+ pts_set_assignment("DOWNLOAD_AVG_SPEED", pts_storage_object::read_from_file(PTS_CORE_STORAGE, "download_average_speed"));
pts_module_process("__pre_install_process", $tests);
$failed_installs = array();
@@ -79,6 +81,9 @@ function pts_start_install($to_install, &$display_mode)
}
pts_module_process("__post_install_process", $tests);
+ pts_storage_object::set_in_file(PTS_CORE_STORAGE, "download_average_count", pts_read_and_clear_assignment("DOWNLOAD_AVG_COUNT"));
+ pts_storage_object::set_in_file(PTS_CORE_STORAGE, "download_average_speed", pts_read_and_clear_assignment("DOWNLOAD_AVG_SPEED"));
+
if(!pts_is_assignment("SILENCE_MESSAGES") && count($failed_installs) > 0 && count($tests) > 1)
{
echo "\nThe following tests failed to install:\n\n";
@@ -235,7 +240,9 @@ function pts_download_test_files($identifier, &$display_mode)
}
$display_mode->test_install_download_file($download_package, "DOWNLOAD");
+ $download_start = time();
echo pts_download($url, $download_destination_temp);
+ $download_end = time();
if(!pts_validate_md5_download_file($download_destination_temp, $package_md5))
{
@@ -274,6 +281,24 @@ function pts_download_test_files($identifier, &$display_mode)
}
$file_downloaded = true;
$fail_count = 0;
+
+ if(($download_size = $download_package->get_filesize()) > 0)
+ {
+ $download_speed = floor($download_size / ($download_end - $download_start)); // bytes per second
+
+ if(($c_s = pts_read_assignment("DOWNLOAD_AVG_SPEED")) && ($c_c = pts_read_assignment("DOWNLOAD_AVG_COUNT")))
+ {
+ $avg_speed = floor((($c_s * $c_c) + $download_speed) / ($c_c + 1));
+
+ pts_set_assignment("DOWNLOAD_AVG_SPEED", $avg_speed);
+ pts_set_assignment("DOWNLOAD_AVG_COUNT", ($c_c + 1));
+ }
+ else
+ {
+ pts_set_assignment("DOWNLOAD_AVG_SPEED", $download_speed);
+ pts_set_assignment("DOWNLOAD_AVG_COUNT", 1);
+ }
+ }
}
if(!$try_again)
diff --git a/pts-core/objects/display_modes/pts_concise_display_mode.php b/pts-core/objects/display_modes/pts_concise_display_mode.php
index 96437cb..3e8d244 100644
--- a/pts-core/objects/display_modes/pts_concise_display_mode.php
+++ b/pts-core/objects/display_modes/pts_concise_display_mode.php
@@ -51,9 +51,18 @@ class pts_concise_display_mode implements pts_display_mode_interface
{
echo "\t\t" . count($download_packages) . " File" . (isset($download_packages[1]) ? "s" : "") . " Needed";
- if(($size = pts_estimated_download_size($identifier)) > 0)
+ if(($size = pts_estimated_download_size($identifier, 1048576)) > 0)
{
echo " / " . $size . " MB";
+
+ /*
+ // TODO: the below code is currently disabled as this size is taking into account download caches, etc. Need to take that out of there otherwise number is overinflated.
+ if(($avg_speed = pts_read_assignment("DOWNLOAD_AVG_SPEED")) > 0)
+ {
+ $avg_time = ($size * 1048576) / $avg_speed;
+ echo " / " . pts_format_time_string($avg_time, "SECONDS", true, 60);
+ }
+ */
}
echo "\n";
@@ -61,6 +70,7 @@ class pts_concise_display_mode implements pts_display_mode_interface
public function test_install_download_file(&$pts_test_file_download, $process)
{
echo "\t\t" . $pts_test_file_download->get_filename() . ": ";
+ $expected_time = 0;
switch($process)
{
@@ -75,10 +85,17 @@ class pts_concise_display_mode implements pts_display_mode_interface
break;
case "DOWNLOAD":
echo "Downloading";
+
+ if(($avg_speed = pts_read_assignment("DOWNLOAD_AVG_SPEED")) > 0 && ($this_size = $pts_test_file_download->get_filesize()) > 0)
+ {
+ $expected_time = $this_size / $avg_speed;
+ }
break;
}
- echo " [" . pts_trim_double($pts_test_file_download->get_filesize() / 1048576, 1) . "MB]\n";
+ $expected_time = is_numeric($expected_time) && $expected_time > 0 ? pts_format_time_string($expected_time, "SECONDS", false, 60) : null;
+
+ echo " [" . pts_trim_double($pts_test_file_download->get_filesize() / 1048576, 1) . "MB" . ($expected_time != null ? " / ~" . $expected_time : null) . "]\n";
}
public function test_install_process($identifier)
{
diff --git a/pts/test-resources/x264/install.sh b/pts/test-resources/x264/install.sh
index 0807e7d..8c91c70 100755
--- a/pts/test-resources/x264/install.sh
+++ b/pts/test-resources/x264/install.sh
@@ -12,6 +12,6 @@ cd ..
rm -rf x264-snapshot-20091118-2245/
echo "#!/bin/sh
-./x264_/bin/x264 -o /dev/null soccer_4cif.y4m > \$LOG_FILE 2>&1
+./x264_/bin/x264 -o /dev/null --threads \$NUM_CPU_CORES soccer_4cif.y4m > \$LOG_FILE 2>&1
echo \$? > ~/test-exit-status" > x264
chm
Copyright © 2013 by Phoronix Media