+ self.loss_ratio = (
+ float(self.loss_count) / self.transmit_count
+ if self.transmit_count > 0 else 1.0
+ )
+ self.effective_loss_ratio = self.loss_ratio
+ if effective_loss_ratio is not None:
+ if effective_loss_ratio > self.loss_ratio:
+ self.effective_loss_ratio = float(effective_loss_ratio)
+ self.receive_ratio = (
+ float(self.receive_count) / self.transmit_count
+ if self.transmit_count > 0 else 0.0
+ )
+ self.approximated_duration = (
+ float(approximated_duration) if approximated_duration
+ else self.duration
+ )
+ self.approximated_receive_rate = (
+ self.receive_count / self.approximated_duration
+ if self.approximated_duration > 0.0 else 0.0
+ )
+ # If the traffic generator is unreliable and sends less packets,
+ # the absolute receive rate might be too low for next target.
+ self.partial_transmit_count = (
+ int(partial_transmit_count) if partial_transmit_count
+ else self.transmit_count
+ )
+ self.partial_receive_ratio = (
+ float(self.receive_count) / self.partial_transmit_count
+ if self.partial_transmit_count > 0 else 0.0
+ )
+ self.partial_receive_rate = (
+ self.target_tr * self.partial_receive_ratio
+ )
+ # We use relative packet ratios in order to support cases
+ # where target_tr is in transactions per second,
+ # but there are multiple packets per transaction.
+ self.relative_receive_rate = (
+ self.target_tr * self.receive_count / self.transmit_count
+ )