• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

SpiNNakerManchester / SpiNNMan / 6574804013

19 Oct 2023 12:47PM UTC coverage: 51.937% (+1.2%) from 50.777%
6574804013

Pull #327

github

Christian-B
typing changes
Pull Request #327: Type Annotations and Checking

105 of 1288 branches covered (0.0%)

Branch coverage included in aggregate %.

2375 of 2375 new or added lines in 180 files covered. (100.0%)

4775 of 8108 relevant lines covered (58.89%)

0.59 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

45.71
/spinnman/processes/get_cpu_info_process.py
1
# Copyright (c) 2015 The University of Manchester
2
#
3
# Licensed under the Apache License, Version 2.0 (the "License");
4
# you may not use this file except in compliance with the License.
5
# You may obtain a copy of the License at
6
#
7
#     https://www.apache.org/licenses/LICENSE-2.0
8
#
9
# Unless required by applicable law or agreed to in writing, software
10
# distributed under the License is distributed on an "AS IS" BASIS,
11
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
# See the License for the specific language governing permissions and
13
# limitations under the License.
14

15
import functools
1✔
16
from typing import cast
1✔
17
from spinn_machine import CoreSubsets
1✔
18
from spinnman.model import CPUInfos
1✔
19
from spinnman.model.cpu_info import CPUInfo, _vcpu_t, _VCPU_PATTERN
1✔
20
from spinnman.constants import CPU_INFO_BYTES
1✔
21
from spinnman.utilities.utility_functions import get_vcpu_address
1✔
22
from spinnman.messages.scp.impl.read_memory import ReadMemory, Response
1✔
23
from .abstract_multi_connection_process import AbstractMultiConnectionProcess
1✔
24
from .abstract_multi_connection_process_connection_selector import (
1✔
25
    ConnectionSelector)
26

27

28
class GetCPUInfoProcess(AbstractMultiConnectionProcess[Response]):
1✔
29
    __slots__ = ("__cpu_infos", )
1✔
30

31
    def __init__(self, connection_selector: ConnectionSelector):
1✔
32
        """
33
        :param ConnectionSelector connection_selector:
34
        """
35
        super().__init__(connection_selector)
×
36
        self.__cpu_infos = CPUInfos()
×
37

38
    def _is_desired(self, cpu_info: CPUInfo) -> bool:
1✔
39
        # pylint: disable=unused-argument
40
        return True
×
41

42
    def __handle_response(self, x: int, y: int, p: int, response: Response):
1✔
43
        cpu_data = cast(_vcpu_t, _VCPU_PATTERN.unpack_from(
×
44
            response.data, response.offset))
45
        cpu_info = CPUInfo(x, y, p, cpu_data)
×
46
        if self._is_desired(cpu_info):
×
47
            self.__cpu_infos.add_info(cpu_info)
×
48

49
    def get_cpu_info(self, core_subsets: CoreSubsets) -> CPUInfos:
1✔
50
        """
51
        :param ~spinn_machine.CoreSubsets core_subsets:
52
        :rtype: CPUInfos
53
        """
54
        with self._collect_responses():
×
55
            for core_subset in core_subsets:
×
56
                x, y = core_subset.x, core_subset.y
×
57
                for p in core_subset.processor_ids:
×
58
                    self._send_request(
×
59
                        ReadMemory((x, y, 0), get_vcpu_address(p),
60
                                   CPU_INFO_BYTES),
61
                        functools.partial(self.__handle_response, x, y, p))
62

63
        return self.__cpu_infos
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc