Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't clear results buffer between loops #736

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 0 additions & 2 deletions pts-core/objects/client/pts_test_execution.php
Expand Up @@ -68,8 +68,6 @@ public static function run_test(&$test_run_manager, &$test_run_request)
return false;
}

$test_run_request->active = new pts_test_result_buffer_active();
$test_run_request->generated_result_buffers = array();
$execute_binary = $test_run_request->test_profile->get_test_executable();
$times_to_run = $test_run_request->test_profile->get_times_to_run();
$ignore_runs = $test_run_request->test_profile->get_runs_to_ignore();
Expand Down
3 changes: 3 additions & 0 deletions pts-core/objects/pts_test_result.php
Expand Up @@ -49,6 +49,9 @@ class pts_test_result
public function __construct($test_profile)
{
$this->test_profile = clone $test_profile;

$this->active = new pts_test_result_buffer_active();
$this->generated_result_buffers = array();
$this->test_run_times = array();
}
public function get_estimated_run_time()
Expand Down
19 changes: 8 additions & 11 deletions pts-core/objects/pts_test_result_buffer.php
Expand Up @@ -51,26 +51,23 @@ public function __construct($buffer_items = array())
}
public function add_buffer_item($buffer_item)
{
if(isset($this->buffer_by_identifier[$buffer_item->get_result_identifier()]) && $this->buffer_items[$this->buffer_by_identifier[$buffer_item->get_result_identifier()]]->get_result_value() == '')
if(isset($this->buffer_by_identifier[$buffer_item->get_result_identifier()]))
{
// Overwrite the buffer item if there is a match but empty (incomplete) result
// Overwrite the buffer item if there is an existing match
$this->remove($buffer_item->get_result_identifier());
}

if(!$this->buffer_contained($buffer_item))
{
$this->buffer_items[] = $buffer_item;
$this->buffer_by_identifier[$buffer_item->get_result_identifier()] = (count($this->buffer_items) - 1);
$this->buffer_contains[$buffer_item->get_result_identifier() . $buffer_item->get_result_value()] = 1;
$this->check_buffer_item_for_min_max($buffer_item);
}
$this->buffer_items[] = $buffer_item;
$this->buffer_by_identifier[$buffer_item->get_result_identifier()] = (count($this->buffer_items) - 1);
$this->buffer_contains[$buffer_item->get_result_identifier() . $buffer_item->get_result_value()] = 1;
$this->check_buffer_item_for_min_max($buffer_item);
}
public function add_test_result($identifier, $value, $raw_value = null, $json = null, $min_value = null, $max_value = null)
{
$buffer_item = new pts_test_result_buffer_item($identifier, $value, $raw_value, $json, $min_value, $max_value);
if(isset($this->buffer_by_identifier[$buffer_item->get_result_identifier()]) && $this->buffer_items[$this->buffer_by_identifier[$buffer_item->get_result_identifier()]]->get_result_value() == '')
if(isset($this->buffer_by_identifier[$buffer_item->get_result_identifier()]))
{
// Overwrite the buffer item if there is a match but empty (incomplete) result
// Overwrite the buffer item if there is an existing match
$this->remove($buffer_item->get_result_identifier());
}

Expand Down
1 change: 0 additions & 1 deletion pts-core/objects/pts_test_result_parser.php
Expand Up @@ -381,7 +381,6 @@ public static function generate_extra_data(&$test_result, &$test_log_file = null
$tp->set_display_format('LINE_GRAPH');
$tp->set_identifier(null);
$extra_result = new pts_test_result($tp);
$extra_result->active = new pts_test_result_buffer_active();
$extra_result->set_used_arguments_description($test_result->get_arguments_description() . ' - Total Frame Time');
$extra_result->set_used_arguments($test_result->get_arguments() . ' - ' . $extra_result->get_arguments_description()); // this formatting is weird but to preserve pre-PTS7 comparsions of extra results
$extra_result->active->set_result(implode(',', $frame_all_times));
Expand Down