diff options
author | Daniel Friesel <daniel.friesel@uos.de> | 2019-08-14 15:03:28 +0200 |
---|---|---|
committer | Daniel Friesel <daniel.friesel@uos.de> | 2019-08-14 15:03:28 +0200 |
commit | 830705b59483181eb5577173318c2df6255518af (patch) | |
tree | a20713527b61c213163ef3a325434a8d80b46f21 /lib/harness.py | |
parent | 680e7498a128c752e6eb43156ee990807c042769 (diff) |
add support for a posteriori parameters (e.g. TX success / retry count)
Diffstat (limited to 'lib/harness.py')
-rw-r--r-- | lib/harness.py | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/lib/harness.py b/lib/harness.py index 8f48d00..cad7b06 100644 --- a/lib/harness.py +++ b/lib/harness.py @@ -135,6 +135,11 @@ class OnboardTimerHarness(TransitionHarness): ret += 'ptalog.stopTransition(counter);\n' return ret + def _append_nondeterministic_parameter_value(self, log_data_target, parameter_name, parameter_value): + if log_data_target['parameter'][parameter_name] is None: + log_data_target['parameter'][parameter_name] = list() + log_data_target['parameter'][parameter_name].append(parameter_value) + def parser_cb(self, line): #print('[HARNESS] got line {}'.format(line)) if re.match(r'\[PTA\] benchmark start, id=(\S+)', line): @@ -178,12 +183,29 @@ class OnboardTimerHarness(TransitionHarness): if self.log_return_values and len(transition.return_value_handlers): for handler in transition.return_value_handlers: if 'parameter' in handler: - print('got return value {:x} for transition {}, which has a handler. whoop whoop.'.format(int(res.group(4)), transition.name)) - # TODO handle value. - #print('[HARNESS] Logging data for transition {}'.format(log_data_target['name'])) + parameter_value = return_value = int(res.group(4)) + + if 'return_values' not in log_data_target: + log_data_target['return_values'] = list() + log_data_target['return_values'].append(return_value) + + if 'formula' in handler: + parameter_value = handler['formula'].eval(return_value) + + print('append current') + self._append_nondeterministic_parameter_value(log_data_target, handler['parameter'], parameter_value) + print('append following') + for following_log_data_target in self.traces[self.trace_id]['trace'][(self.current_transition_in_trace * 2 + 1) :]: + self._append_nondeterministic_parameter_value(following_log_data_target, handler['parameter'], parameter_value) + print('append preceding') + if 'apply_from' in handler and any(map(lambda x: x['name'] == handler['apply_from'], self.traces[self.trace_id]['trace'][: (self.current_transition_in_trace * 2 + 1)])): + for preceding_log_data_target in reversed(self.traces[self.trace_id]['trace'][: (self.current_transition_in_trace * 2)]): + self._append_nondeterministic_parameter_value(preceding_log_data_target, handler['parameter'], parameter_value) + if preceding_log_data_target['name'] == handler['apply_from']: + break if 'offline_aggregates' not in log_data_target: log_data_target['offline_aggregates'] = { 'duration' : list() } log_data_target['offline_aggregates']['duration'].append(duration_us) - self.current_transition_in_trace += 1
\ No newline at end of file + self.current_transition_in_trace += 1 |