Commit f2ed27e5 authored by Antoine Kaufmann's avatar Antoine Kaufmann Committed by Hejing Li
Browse files

orchestration/simulators.py: add clock drift and offset attr to hosts

Also implements support for passing this through to qemu.
parent 1c2a1c1a
...@@ -298,6 +298,14 @@ class HostSim(Simulator): ...@@ -298,6 +298,14 @@ class HostSim(Simulator):
"""Latency in nanoseconds for sending messages to components connected """Latency in nanoseconds for sending messages to components connected
via Ethernet.""" via Ethernet."""
self.sync_drift: tp.Optional[int] = None
"""Conversion factor from SimBricks' picosecond timestamps to the host's
nanosecond clock. None or 1000 is 1:1, while other values result in
simulated clock drift for a host."""
self.sync_offset: tp.Optional[int] = None
"""Clock offset for this host in picoseconds. None or 0 does not add an
offset."""
self.pcidevs: tp.List[PCIDevSim] = [] self.pcidevs: tp.List[PCIDevSim] = []
self.net_directs: tp.List[NetSim] = [] self.net_directs: tp.List[NetSim] = []
self.memdevs: tp.List[MemDevSim] = [] self.memdevs: tp.List[MemDevSim] = []
...@@ -408,6 +416,10 @@ class QemuHost(HostSim): ...@@ -408,6 +416,10 @@ class QemuHost(HostSim):
cmd += ',sync=on' cmd += ',sync=on'
cmd += f',pci-latency={self.pci_latency}' cmd += f',pci-latency={self.pci_latency}'
cmd += f',sync-period={self.sync_period}' cmd += f',sync-period={self.sync_period}'
if self.sync_drift is not None:
cmd += f',sync-drift={self.sync_drift}'
if self.sync_offset is not None:
cmd += f',sync-offset={self.sync_offset}'
else: else:
cmd += ',sync=off' cmd += ',sync=off'
cmd += ' ' cmd += ' '
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment