From cf2e5d60ee2b3378d4457143d2b6caacea0f0b33 Mon Sep 17 00:00:00 2001 From: Michael Larabel Date: Wed, 19 Nov 2008 13:31:13 -0500 Subject: pts-core: Eliminate THIS_RUN_TIME constant and add preferred way of using pts_unique_runtime_identifier() --- pts-core/functions/pts-functions-run.php | 4 +++- pts-core/functions/pts-functions.php | 22 ++++++++++++++++++++-- pts-core/functions/pts-init.php | 1 - pts-core/modules/system_monitor.php | 5 +++-- 4 files changed, 26 insertions(+), 6 deletions(-) (limited to 'pts-core') diff --git a/pts-core/functions/pts-functions-run.php b/pts-core/functions/pts-functions-run.php index 03e8d7b..fafc556 100644 --- a/pts-core/functions/pts-functions-run.php +++ b/pts-core/functions/pts-functions-run.php @@ -493,9 +493,11 @@ function pts_run_test($test_identifier, $extra_arguments = "", $arguments_descri pts_user_message($pre_run_message); + $runtime_identifier = pts_unique_runtime_identifier(); + for($i = 0; $i < $times_to_run; $i++) { - $benchmark_log_file = TEST_ENV_DIR . $test_identifier . "/" . $test_identifier . "-" . THIS_RUN_TIME . "-" . ($i + 1) . ".log"; + $benchmark_log_file = TEST_ENV_DIR . $test_identifier . "/" . $test_identifier . "-" . $runtime_identifier . "-" . ($i + 1) . ".log"; $start_timer = TEST_LIBRARIES_DIR . "timer-start.sh"; $stop_timer = TEST_LIBRARIES_DIR . "timer-stop.sh"; $timed_kill = TEST_LIBRARIES_DIR . "timed-kill.sh"; diff --git a/pts-core/functions/pts-functions.php b/pts-core/functions/pts-functions.php index 9c0aea3..e20b189 100644 --- a/pts-core/functions/pts-functions.php +++ b/pts-core/functions/pts-functions.php @@ -80,7 +80,7 @@ function pts_run_option_command($command, $pass_args = null, $command_descriptor $command = strtolower($command); pts_clear_assignments(); - pts_set_assignment("START_TIME", time()); + pts_set_assignment(array("START_TIME", "THIS_OPTION_IDENTIFIER"), time()); // For now THIS_OPTION_IDENTIFIER is also time pts_set_assignment("COMMAND", $command_descriptor); if(is_file("pts-core/options/" . $command . ".php")) @@ -186,7 +186,7 @@ function pts_env_variables() "OS_VERSION" => sw_os_version(), "OS_ARCH" => sw_os_architecture(), "OS_TYPE" => OPERATING_SYSTEM, - "THIS_RUN_TIME" => THIS_RUN_TIME + "THIS_RUN_TIME" => PTS_INIT_TIME ); } @@ -402,6 +402,19 @@ function pts_bool_question($question, $default = true, $question_id = "UNKNOWN") return $answer; } +function pts_unique_runtime_identifier() +{ + if(pts_is_assignment("THIS_OPTION_IDENTIFIER")) + { + $identifier = pts_read_assignment("THIS_OPTION_IDENTIFIER"); + } + else + { + $identifier = PTS_INIT_TIME; + } + + return $identifier; +} function pts_clean_information_string($str) { // Clean a string containing hardware information of some common things to change/strip out @@ -758,10 +771,15 @@ function pts_user_message($message) } function pts_set_assignment_once($assignment, $value) { + $set_assignment = false; + if(!pts_is_assignment($assignment)) { pts_set_assignment($assignment, $value); + $set_assignment = true; } + + return $set_assignment; } function pts_set_assignment($assignment, $value) { diff --git a/pts-core/functions/pts-init.php b/pts-core/functions/pts-init.php index 46ae5e9..1397732 100644 --- a/pts-core/functions/pts-init.php +++ b/pts-core/functions/pts-init.php @@ -61,7 +61,6 @@ function pts_basic_init() // PTS Defines define("PTS_TEMP_DIR", "/tmp/phoronix-test-suite/"); define("PHP_BIN", getenv("PHP_BIN")); - define("THIS_RUN_TIME", time()); define("PTS_INIT_TIME", time()); // Run in debug mode? diff --git a/pts-core/modules/system_monitor.php b/pts-core/modules/system_monitor.php index 157f337..b548880 100644 --- a/pts-core/modules/system_monitor.php +++ b/pts-core/modules/system_monitor.php @@ -459,11 +459,12 @@ class system_monitor extends pts_module_interface $first_run = false; } } + $save_filename = pts_unique_runtime_identifier() . '-' . $image_count . "." . strtolower($t->getRenderer()); $t->loadGraphVersion(PTS_VERSION); - $t->save_graph(pts_module::save_dir() . THIS_RUN_TIME . '-' . $image_count . "." . strtolower($t->getRenderer())); + $t->save_graph(pts_module::save_dir() . $save_filename); $t->renderGraph(); - array_push($image_list, THIS_RUN_TIME . '-' . $image_count . "." . strtolower($t->getRenderer())); + array_push($image_list, $save_filename); $image_count++; } } -- cgit