diff options
-rw-r--r-- | EXPERIMENTAL-CHANGE-LOG | 1 | ||||
-rw-r--r-- | pts-core/functions/pts-functions-run.php | 17 | ||||
-rwxr-xr-x | pts-core/scripts/timer-start.sh | 3 | ||||
-rwxr-xr-x | pts-core/scripts/timer-stop.sh | 3 | ||||
-rwxr-xr-x | pts/test-resources/encode-ogg/install.sh | 5 | ||||
-rw-r--r-- | pts/test-resources/encode-ogg/parse-results.php | 3 |
6 files changed, 27 insertions, 5 deletions
diff --git a/EXPERIMENTAL-CHANGE-LOG b/EXPERIMENTAL-CHANGE-LOG index dbd4391..9a63a60 100644 --- a/EXPERIMENTAL-CHANGE-LOG +++ b/EXPERIMENTAL-CHANGE-LOG @@ -50,6 +50,7 @@ Phoronix Test Suite - pts-core: Add PlatformSpecific tag to download file XML for OS-specific files - pts-core: Add ArchitectureSpecific tag to download file XML for hardware architecture-specific files - pts-core: When RandR detection fails in xrandr_available_modes(), apply some logic to sort the stock modes that should work +- pts-core: Add in a micro-timer framework that is platform universal - pts: Move pcqs tests out of tree - pts: Switch all relevant test profiles using ArgumentName to using ArgumentPrefix - pts: Move the byte test profile to using the new $LOG_FILE capability for an example and for testing diff --git a/pts-core/functions/pts-functions-run.php b/pts-core/functions/pts-functions-run.php index 999bd10..d6a43ba 100644 --- a/pts-core/functions/pts-functions-run.php +++ b/pts-core/functions/pts-functions-run.php @@ -485,7 +485,10 @@ function pts_run_test($test_identifier, $extra_arguments = "", $arguments_descri for($i = 0; $i < $times_to_run; $i++) { $benchmark_log_file = TEST_ENV_DIR . $test_identifier . "/" . $test_identifier . "-" . THIS_RUN_TIME . "-" . ($i + 1) . ".log"; - $test_extra_runtime_variables = array_merge($extra_runtime_variables, array("LOG_FILE" => $benchmark_log_file)); + $start_timer = PTS_DIR . "pts-core/scripts/timer-start.sh"; + $stop_timer = PTS_DIR . "pts-core/scripts/timer-stop.sh"; + $test_extra_runtime_variables = array_merge($extra_runtime_variables, array("LOG_FILE" => $benchmark_log_file, "TIMER_START" => $start_timer, "TIMER_STOP" => $stop_timer)); + echo pts_string_header($test_title . " (Run " . ($i + 1) . " of " . $times_to_run . ")"); $result_output = array(); @@ -493,9 +496,19 @@ function pts_run_test($test_identifier, $extra_arguments = "", $arguments_descri if(!($i == 0 && pts_string_bool($ignore_first_run) && $times_to_run > 1)) { + $test_extra_runtime_variables_post = $test_extra_runtime_variables; + if(is_file(TEST_ENV_DIR . $test_identifier . "/pts-timer")) + { + $run_time = trim(file_get_contents(TEST_ENV_DIR . $test_identifier . "/pts-timer")); + unlink(TEST_ENV_DIR . $test_identifier . "/pts-timer"); + + if(is_numeric($run_time)) + $test_extra_runtime_variables_post = array_merge($test_extra_runtime_variables_post, array("TIMER_RESULT" => $run_time)); + } + if(is_file(pts_location_test_resources($test_identifier) . "parse-results.php")) { - $test_results = pts_exec("cd " . $test_directory . " && " . PHP_BIN . " " . pts_location_test_resources($test_identifier) . "parse-results.php \"" . $test_results . "\"", $test_extra_runtime_variables); + $test_results = pts_exec("cd " . $test_directory . " && " . PHP_BIN . " " . pts_location_test_resources($test_identifier) . "parse-results.php \"" . $test_results . "\"", $test_extra_runtime_variables_post); } if(!empty($test_results)) diff --git a/pts-core/scripts/timer-start.sh b/pts-core/scripts/timer-start.sh new file mode 100755 index 0000000..dc951c6 --- /dev/null +++ b/pts-core/scripts/timer-start.sh @@ -0,0 +1,3 @@ +#!/bin/sh +php -r "file_put_contents(getenv(\"HOME\") . \"/pts-timer\", microtime(true));" + diff --git a/pts-core/scripts/timer-stop.sh b/pts-core/scripts/timer-stop.sh new file mode 100755 index 0000000..3be84d1 --- /dev/null +++ b/pts-core/scripts/timer-stop.sh @@ -0,0 +1,3 @@ +#!/bin/sh +php -r "\$start_time = @file_get_contents(getenv(\"HOME\") . \"/pts-timer\"); \$end_time = microtime(true); file_put_contents(getenv(\"HOME\") . \"/pts-timer\", (\$end_time - \$start_time));" + diff --git a/pts/test-resources/encode-ogg/install.sh b/pts/test-resources/encode-ogg/install.sh index 1dd383f..7ca4983 100755 --- a/pts/test-resources/encode-ogg/install.sh +++ b/pts/test-resources/encode-ogg/install.sh @@ -29,5 +29,8 @@ cd .. rm -rf vorbis-tools-1.2.0/ echo "#!/bin/sh -/usr/bin/time -f \"WAV To OGG Encode Time: %e Seconds\" ./vorbis/bin/oggenc --quiet \$TEST_EXTENDS/pts-trondheim.wav -q 10 -o /dev/null 2>&1" > oggenc +\$TIMER_START +./vorbis/bin/oggenc \$TEST_EXTENDS/pts-trondheim.wav -q 10 -o /dev/null > \$LOG_FILE 2>&1 +\$TIMER_STOP +cat \$LOG_FILE" > oggenc chmod +x oggenc diff --git a/pts/test-resources/encode-ogg/parse-results.php b/pts/test-resources/encode-ogg/parse-results.php index e090ce7..06bbde7 100644 --- a/pts/test-resources/encode-ogg/parse-results.php +++ b/pts/test-resources/encode-ogg/parse-results.php @@ -1,5 +1,4 @@ <?php -$BENCHMARK_RESULTS = substr($argv[1], strpos($argv[1], "WAV To OGG Encode Time:") + 23); -echo trim(substr($BENCHMARK_RESULTS, 0, strpos($BENCHMARK_RESULTS, "Seconds"))); +echo getenv("TIMER_RESULT"); ?> |