Skip to content

Commit

Permalink
Add sender and receiver information in watchdog logs (lava-nc#796)
Browse files Browse the repository at this point in the history
  • Loading branch information
joyeshmishra authored Oct 16, 2023
1 parent 2181b66 commit cfa4817
Showing 1 changed file with 34 additions and 8 deletions.
42 changes: 34 additions & 8 deletions src/lava/magma/compiler/builders/channel_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,29 @@


class WatchdogEnabledMixin:
SEND = "send"
RECV = "recv"
JOIN = "join"

@staticmethod
def watch(watchdog_manager: WatchdogManager,
queue: Queue,
process: "AbstractProcess",
other_process: "AbstractProcess",
pi: PortInitializer,
other_pi: PortInitializer,
method_type: str) -> Watchdog:
process_cls: str = process.__class__.__name__
port_name: str = pi.name
name: str = f"{process_cls}.{port_name}"
if other_process and other_pi:
other_process_cls: str = other_process.__class__.__name__
other_port_name: str = other_pi.name
other_name: str = f"{other_process_cls}.{other_port_name}"
if method_type is WatchdogEnabledMixin.SEND:
name += f"->{other_name}"
elif method_type is WatchdogEnabledMixin.RECV:
name = f"{other_name}->{name}"
w: Watchdog = watchdog_manager.create_watchdog(queue=queue,
channel_name=name,
method_type=method_type)
Expand All @@ -49,21 +63,33 @@ def create_watchdogs(self,
queues: Queues,
port_initializers: PortInitializers) -> Watchdogs:
src_send_watchdog: Watchdog = self.watch(watchdog_manager,
queues[0], self.src_process,
queues[0],
self.src_process,
self.dst_process,
port_initializers[0],
"send")
port_initializers[1],
WatchdogEnabledMixin.SEND)
src_join_watchdog: Watchdog = self.watch(watchdog_manager,
queues[1], self.src_process,
queues[1],
self.src_process,
self.dst_process,
port_initializers[0],
"join")
port_initializers[1],
WatchdogEnabledMixin.JOIN)
dst_recv_watchdog: Watchdog = self.watch(watchdog_manager,
queues[2], self.dst_process,
queues[2],
self.dst_process,
self.src_process,
port_initializers[1],
"recv")
port_initializers[0],
WatchdogEnabledMixin.RECV)
dst_join_watchdog: Watchdog = self.watch(watchdog_manager,
queues[3], self.dst_process,
queues[3],
self.dst_process,
self.src_process,
port_initializers[1],
"join")
port_initializers[0],
WatchdogEnabledMixin.JOIN)
return (src_send_watchdog, src_join_watchdog,
dst_recv_watchdog, dst_join_watchdog)

Expand Down

0 comments on commit cfa4817

Please sign in to comment.