I want to setup an environment where I can check latency of different publisher and subscriber scenarios in different architectures.How can I do it??
Here is a recent 2018 paper from Robotics and Autonomous Systems that touches on this topic:
In order to reproduce the network scenarios described before (localhost, Gigabit ethernet and WiFi networks), we take advantage from Linux NetEm . This module allows the simulation of network delays. Moreover, we are able to simulate bandwidth and packet loss.
 S. Hemminger, Network Emulation with NetEm, in: Linux Conf Au, 2005. URL http://developer.osdl.org/shemminger/netem/LCA2005_paper.pdf.
Looks like they’ve also released there code for the experiments here: