Skip to content

Commit f535cb5

Browse files
committed
Update timing calculations
1 parent 7390725 commit f535cb5

File tree

1 file changed

+13
-18
lines changed

1 file changed

+13
-18
lines changed

TESTS/host_tests/timing_drift_auto.py

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -99,37 +99,32 @@ def setup(self):
9999
self.register_callback('final_time', self._callback_final_time)
100100

101101
def compute_parameter(self, failure_criteria=0.05):
102-
nominal_time = (self.round_trip_final_start + self.round_trip_final_end) / 2.0 - (self.round_trip_base_start + self.round_trip_base_end) / 2.0
103-
transport_error = self.round_trip_final_time / 2.0 + self.round_trip_base_time / 2.0
104-
105-
min_range = nominal_time * (1 - failure_criteria)
106-
max_range = nominal_time * (1 + failure_criteria)
107-
102+
t_max = self.round_trip_final_end - self.round_trip_base_start
103+
t_min = self.round_trip_final_start - self.round_trip_base_end
104+
t_max_hi = t_max * (1 + failure_criteria)
105+
t_max_lo = t_max * (1 - failure_criteria)
106+
t_min_hi = t_min * (1 + failure_criteria)
107+
t_min_lo = t_min * (1 - failure_criteria)
108108
device_time = (self.device_time_final - self.device_time_base) / self.mega
109109

110-
min_pass_value = (device_time - transport_error)
111-
max_pass_value = (device_time + transport_error)
112-
113110
self.log("Compute host events")
114111
self.log("Transport delay 0: {}".format(self.round_trip_base_time))
115112
self.log("Transport delay 1: {}".format(self.round_trip_final_time))
116-
self.log("Transport dealy avg : {} ".format(transport_error))
117113
self.log("DUT base time : {}".format(self.device_time_base))
118114
self.log("DUT end time : {}".format(self.device_time_final))
119-
self.log("Actual Time : {}".format(device_time))
120-
self.log("Nominal Time : {}".format(nominal_time))
121115

122-
self.log("min_pass : {} , max_pass : {}".format(min_pass_value, max_pass_value))
123-
self.log("min_range : {} , max_range : {}".format(min_range, max_range))
116+
self.log("min_pass : {} , max_pass : {} for {}%%".format(t_max_lo, t_min_hi, failure_criteria * 100))
117+
self.log("min_inconclusive : {} , max_inconclusive : {}".format(t_min_lo, t_max_hi))
118+
self.log("Time reported by device: {}".format(device_time))
124119

125-
if (min_pass_value >= min_range) and (max_pass_value <= max_range):
120+
if t_max_lo <= device_time <= t_min_hi:
126121
self.log("Test passed !!!")
127122
self.__result = True
128-
elif (min_pass_value > max_range) or (max_pass_value < min_pass_value):
129-
self.log("Time outside of passing range. Timing drift seems to be present !!!")
123+
elif t_min_lo <= device_time <= t_max_hi:
124+
self.log("Test inconclusive due to transport delay, retrying")
130125
self.__result = False
131126
else:
132-
self.log("Test inconclusive due to transport delay, retrying")
127+
self.log("Time outside of passing range. Timing drift seems to be present !!!")
133128
self.__result = False
134129
return self.__result
135130

0 commit comments

Comments
 (0)