def _create_random_traffic( self, duration: str, rate: str, block_size: int, min_addr: int, max_addr: int, rd_perc: int, data_limit: int, ) -> None: """ This function yields (creates) a random traffic based on the input params. Then it will yield (create) an exit traffic (exit traffic is used to exit the simulation). :param duration: The number of ticks for the generator core to generate traffic. :param rate: The rate at which the synthetic data is read/written. :param block_size: The number of bytes to be read/written with each request. :param min_addr: The lower bound of the address range the generator will read/write from/to. :param max_addr: The upper bound of the address range the generator will read/write from/to. :param rd_perc: The percentage of read requests among all the generated requests. The write percentage would be equal to 100 - rd_perc. :param data_limit: The amount of data in bytes to read/write by the generator before stopping generation. """ duration = fromSeconds(toLatency(duration)) rate = toMemoryBandwidth(rate) period = fromSeconds(block_size / rate) min_period = period max_period = period yield self.generator.createRandom( duration, min_addr, max_addr, block_size, min_period, max_period, rd_perc, data_limit, ) yield self.generator.createExit(0)
def _create_traffic(self) -> Iterator[BaseTrafficGen]: """ A python generator that yields (creates) a linear traffic with the specified params in the generator core and then yields (creates) an exit traffic. :rtype: Iterator[BaseTrafficGen] """ duration = fromSeconds(toLatency(self._duration)) rate = toMemoryBandwidth(self._rate) period = fromSeconds(self._block_size / rate) min_period = period max_period = period yield self.generator.createLinear( duration, self._min_addr, self._max_addr, self._block_size, min_period, max_period, self._rd_perc, self._data_limit, ) yield self.generator.createExit(0)