Skip to content

Commit

Permalink
Removing unused stuff from the extra monitor
Browse files Browse the repository at this point in the history
  • Loading branch information
dkfellows committed Sep 8, 2023
1 parent f2eda72 commit 74d6d5f
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 138 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import logging
import time
import struct
from enum import IntEnum
from enum import Enum, IntEnum
from typing import (
Any, BinaryIO, Iterable, List, Optional, Set, Tuple, Union, TYPE_CHECKING)
from spinn_utilities.config_holder import get_config_bool
Expand Down Expand Up @@ -134,6 +134,13 @@ class _DATA_REGIONS(IntEnum):
PROVENANCE_REGION = 2


class _PROV_LABELS(str, Enum):
SENT = "Sent_SDP_Packets"
RECEIVED = "Received_SDP_Packets"
IN_STREAMS = "Speed_Up_Input_Streams"
OUT_STREAMS = "Speed_Up_Output_Streams"


class DATA_OUT_COMMANDS(IntEnum):
"""
Command IDs for the SDP packets for data out.
Expand Down Expand Up @@ -168,7 +175,7 @@ class DATA_IN_COMMANDS(IntEnum):
VERIFY_SENT_DATA = False

# provenance data size
_PROVENANCE_DATA_SIZE = 4 * BYTES_PER_WORD
_PROVENANCE_DATA_SIZE = _FOUR_WORDS.size


def ceildiv(dividend, divisor) -> int:
Expand Down Expand Up @@ -906,7 +913,8 @@ def set_router_wait1_timeout(self, timeout: Tuple[int, int]):
Set the wait1 field for a set of routers.
:param tuple(int,int) timeout:
:param ~pacman.model.placements.Placements placements:
The mantissa and exponent of the timeout value, each between
0 and 15
"""
mantissa, exponent = timeout
core_subsets = convert_vertices_to_core_subset([self])
Expand All @@ -924,6 +932,8 @@ def set_router_wait2_timeout(self, timeout: Tuple[int, int]):
Set the wait2 field for a set of routers.
:param tuple(int,int) timeout:
The mantissa and exponent of the timeout value, each between
0 and 15
"""
mantissa, exponent = timeout
core_subsets = convert_vertices_to_core_subset([self])
Expand Down Expand Up @@ -1386,34 +1396,27 @@ def __calculate_max_seq_num(self) -> int:
len(self._output),
WORDS_PER_FULL_PACKET_WITH_SEQUENCE_NUM * BYTES_PER_WORD)

@staticmethod
def __provenance_address(x: int, y: int, p: int) -> int:
txrx = FecDataView.get_transceiver()
region_table = txrx.get_cpu_information_from_core(x, y, p).user[0]

# Get the provenance region base address
prov_region_entry_address = get_region_base_address_offset(
region_table, _DATA_REGIONS.PROVENANCE_REGION)
return txrx.read_word(x, y, prov_region_entry_address)

@overrides(AbstractProvidesProvenanceDataFromMachine
.get_provenance_data_from_machine)
def get_provenance_data_from_machine(self, placement: Placement):
x, y, p = placement.x, placement.y, placement.p
# Get the App Data for the core
transceiver = FecDataView.get_transceiver()
region_table_address = transceiver.get_cpu_information_from_core(
placement.x, placement.y, placement.p).user[0]

# Get the provenance region base address
prov_region_entry_address = get_region_base_address_offset(
region_table_address, _DATA_REGIONS.PROVENANCE_REGION)
provenance_address = transceiver.read_word(
placement.x, placement.y, prov_region_entry_address)
data = transceiver.read_memory(
placement.x, placement.y, provenance_address,
_PROVENANCE_DATA_SIZE)
data = FecDataView.read_memory(
x, y, self.__provenance_address(x, y, p), _PROVENANCE_DATA_SIZE)
n_sdp_sent, n_sdp_recvd, n_in_streams, n_out_streams = (
_FOUR_WORDS.unpack_from(data))
with ProvenanceWriter() as db:
db.insert_core(
placement.x, placement.y, placement.p,
"Sent_SDP_Packets", n_sdp_sent)
db.insert_core(
placement.x, placement.y, placement.p,
"Received_SDP_Packets", n_sdp_recvd)
db.insert_core(
placement.x, placement.y, placement.p,
"Speed_Up_Input_Streams", n_in_streams)
db.insert_core(
placement.x, placement.y, placement.p,
"Speed_Up_Output_Streams", n_out_streams)
db.insert_core(x, y, p, _PROV_LABELS.SENT, n_sdp_sent)
db.insert_core(x, y, p, _PROV_LABELS.RECEIVED, n_sdp_recvd)
db.insert_core(x, y, p, _PROV_LABELS.IN_STREAMS, n_in_streams)
db.insert_core(x, y, p, _PROV_LABELS.OUT_STREAMS, n_out_streams)
Loading

0 comments on commit 74d6d5f

Please sign in to comment.