Measuring data transfer rate

I would like to do calculate the data transfer rate of 2 bytes via both Modbus and MQTT, is it possible to do such calculations where I get the Mean, Max and Min time of the transfer timing of 2 bytes?