wperf-cmn-visualizer 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. wperf_cmn_visualizer-0.1.0/LICENSE +29 -0
  2. wperf_cmn_visualizer-0.1.0/PKG-INFO +48 -0
  3. wperf_cmn_visualizer-0.1.0/README.md +35 -0
  4. wperf_cmn_visualizer-0.1.0/pyproject.toml +23 -0
  5. wperf_cmn_visualizer-0.1.0/setup.cfg +4 -0
  6. wperf_cmn_visualizer-0.1.0/tests/test_canvas.py +145 -0
  7. wperf_cmn_visualizer-0.1.0/tests/test_cli_args.py +50 -0
  8. wperf_cmn_visualizer-0.1.0/tests/test_cmn.py +463 -0
  9. wperf_cmn_visualizer-0.1.0/tests/test_cmn_metrics.py +516 -0
  10. wperf_cmn_visualizer-0.1.0/tests/test_renderer.py +264 -0
  11. wperf_cmn_visualizer-0.1.0/tests/test_telemetry_loader.py +92 -0
  12. wperf_cmn_visualizer-0.1.0/tests/test_topology_loader.py +77 -0
  13. wperf_cmn_visualizer-0.1.0/tests/test_version.py +65 -0
  14. wperf_cmn_visualizer-0.1.0/tests/test_wperf_cmn_visualizer_window.py +55 -0
  15. wperf_cmn_visualizer-0.1.0/wperf_cmn_visualizer/__init__.py +34 -0
  16. wperf_cmn_visualizer-0.1.0/wperf_cmn_visualizer/__main__.py +76 -0
  17. wperf_cmn_visualizer-0.1.0/wperf_cmn_visualizer/canvas.py +305 -0
  18. wperf_cmn_visualizer-0.1.0/wperf_cmn_visualizer/cmn.py +219 -0
  19. wperf_cmn_visualizer-0.1.0/wperf_cmn_visualizer/cmn_metrics.py +290 -0
  20. wperf_cmn_visualizer-0.1.0/wperf_cmn_visualizer/config.py +68 -0
  21. wperf_cmn_visualizer-0.1.0/wperf_cmn_visualizer/renderer.py +617 -0
  22. wperf_cmn_visualizer-0.1.0/wperf_cmn_visualizer/telemetry_loader.py +67 -0
  23. wperf_cmn_visualizer-0.1.0/wperf_cmn_visualizer/time_scrubber.py +294 -0
  24. wperf_cmn_visualizer-0.1.0/wperf_cmn_visualizer/topology_loader.py +61 -0
  25. wperf_cmn_visualizer-0.1.0/wperf_cmn_visualizer/wperf_cmn_visualizer.py +125 -0
  26. wperf_cmn_visualizer-0.1.0/wperf_cmn_visualizer.egg-info/PKG-INFO +48 -0
  27. wperf_cmn_visualizer-0.1.0/wperf_cmn_visualizer.egg-info/SOURCES.txt +29 -0
  28. wperf_cmn_visualizer-0.1.0/wperf_cmn_visualizer.egg-info/dependency_links.txt +1 -0
  29. wperf_cmn_visualizer-0.1.0/wperf_cmn_visualizer.egg-info/entry_points.txt +2 -0
  30. wperf_cmn_visualizer-0.1.0/wperf_cmn_visualizer.egg-info/requires.txt +3 -0
  31. wperf_cmn_visualizer-0.1.0/wperf_cmn_visualizer.egg-info/top_level.txt +1 -0
@@ -0,0 +1,29 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2025, Arm Limited
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ 1. Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ 3. Neither the name of the copyright holder nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,48 @@
1
+ Metadata-Version: 2.4
2
+ Name: wperf-cmn-visualizer
3
+ Version: 0.1.0
4
+ Summary: A GUI-based visualizer for Arm CMN (Coherent Mesh Network) systems using WindowsPerf backend
5
+ License: BSD-3-Clause
6
+ Requires-Python: >=3.12.4
7
+ Description-Content-Type: text/markdown
8
+ License-File: LICENSE
9
+ Requires-Dist: ttkbootstrap
10
+ Requires-Dist: numpy
11
+ Requires-Dist: pandas
12
+ Dynamic: license-file
13
+
14
+ # CMN Mesh Visualizer
15
+
16
+ This is a Python project that uses WindowsPerf as a backend to provide a GUI-based visualiser for Arm CMN (Coherent Mesh Network) systems. It enables visual analysis of topology, traffic, and performance metrics using PMU data from XPs, DTCs, and related components—helping engineers identify bottlenecks and understand system behaviour across complex SoCs.
17
+
18
+ ## Installation
19
+
20
+ To install the project locally:
21
+
22
+ ```bash
23
+ pip install .
24
+ ```
25
+ For development mode installation:
26
+
27
+ ```bash
28
+ pip install -e .
29
+ ```
30
+
31
+ ## Project Structure
32
+
33
+ ```bash
34
+ cmn-mesh-visualizer/
35
+ ├── wperf-cmn-visualizer/ # Main Python module containing *.py implementation files
36
+ │ └── *.py
37
+ ├── tests/ # Test suite containing *.py test files
38
+ │ └── *.py
39
+ └── pyproject.toml # Project build and dependency metadata
40
+ ```
41
+
42
+ ## Contributing
43
+
44
+ To contribute to the project follow our [Contributing Guidelines](CONTRIBUTING.md).
45
+
46
+ ## License
47
+
48
+ All code in this repository is licensed under the [BSD 3-Clause License](LICENSE)
@@ -0,0 +1,35 @@
1
+ # CMN Mesh Visualizer
2
+
3
+ This is a Python project that uses WindowsPerf as a backend to provide a GUI-based visualiser for Arm CMN (Coherent Mesh Network) systems. It enables visual analysis of topology, traffic, and performance metrics using PMU data from XPs, DTCs, and related components—helping engineers identify bottlenecks and understand system behaviour across complex SoCs.
4
+
5
+ ## Installation
6
+
7
+ To install the project locally:
8
+
9
+ ```bash
10
+ pip install .
11
+ ```
12
+ For development mode installation:
13
+
14
+ ```bash
15
+ pip install -e .
16
+ ```
17
+
18
+ ## Project Structure
19
+
20
+ ```bash
21
+ cmn-mesh-visualizer/
22
+ ├── wperf-cmn-visualizer/ # Main Python module containing *.py implementation files
23
+ │ └── *.py
24
+ ├── tests/ # Test suite containing *.py test files
25
+ │ └── *.py
26
+ └── pyproject.toml # Project build and dependency metadata
27
+ ```
28
+
29
+ ## Contributing
30
+
31
+ To contribute to the project follow our [Contributing Guidelines](CONTRIBUTING.md).
32
+
33
+ ## License
34
+
35
+ All code in this repository is licensed under the [BSD 3-Clause License](LICENSE)
@@ -0,0 +1,23 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "wperf-cmn-visualizer"
7
+ version = "0.1.0"
8
+ description = "A GUI-based visualizer for Arm CMN (Coherent Mesh Network) systems using WindowsPerf backend"
9
+ readme = "README.md"
10
+ license = {text = "BSD-3-Clause"}
11
+ requires-python = ">=3.12.4"
12
+ dependencies = [
13
+ "ttkbootstrap",
14
+ "numpy",
15
+ "pandas",
16
+ ]
17
+
18
+ [project.scripts]
19
+ wperf-cmn-visualizer = "wperf_cmn_visualizer.__main__:main"
20
+
21
+ [tool.setuptools.packages.find]
22
+ where = ["."]
23
+ include = ["wperf_cmn_visualizer*"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,145 @@
1
+ # BSD 3-Clause License
2
+ #
3
+ # Copyright (c) 2025, Arm Limited
4
+ # All rights reserved.
5
+ #
6
+ # Redistribution and use in source and binary forms, with or without
7
+ # modification, are permitted provided that the following conditions are met:
8
+ #
9
+ # 1. Redistributions of source code must retain the above copyright notice, this
10
+ # list of conditions and the following disclaimer.
11
+ #
12
+ # 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ # this list of conditions and the following disclaimer in the documentation
14
+ # and/or other materials provided with the distribution.
15
+ #
16
+ # 3. Neither the name of the copyright holder nor the names of its
17
+ # contributors may be used to endorse or promote products derived from
18
+ # this software without specific prior written permission.
19
+ #
20
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ import tkinter as tk
32
+ import ttkbootstrap as tb
33
+ from unittest.mock import Mock
34
+ from wperf_cmn_visualizer.canvas import ZoomPanCanvas
35
+ from wperf_cmn_visualizer.config import Config
36
+
37
+
38
+ class TestZoomPanCanvas:
39
+ """Tests for ZoomPanCanvas to ensure basic callbacks work"""
40
+ def setup_method(self):
41
+ """
42
+ Constructor Hook to set up tests. Pytest Provided
43
+ """
44
+ self.root = tb.Window()
45
+ self.root.withdraw()
46
+ self.root.update()
47
+ # mock redraw function and mouse hover callback function
48
+ self.redraw_mock = Mock()
49
+ self.mock_hover = Mock()
50
+ self.canvas = ZoomPanCanvas(self.root, redraw_callback=self.redraw_mock, width=100, height=100)
51
+ self.canvas.hover_callback = self.mock_hover
52
+
53
+ def teardown_method(self):
54
+ """
55
+ Destructor Hook to clean up. Pytest provided
56
+ """
57
+ self.canvas.destroy()
58
+ self.root.destroy()
59
+
60
+ def test_initial_state(self):
61
+ """
62
+ Test to ensure proper initialisation
63
+ """
64
+ assert self.canvas.offset_x == 0.0
65
+ assert self.canvas.offset_y == 0.0
66
+ assert self.canvas.zoom_scale == Config.DEFAULT_ZOOM
67
+
68
+ def test_pan_updates_offsets(self):
69
+ """
70
+ Test to ensure panning works.
71
+ Ensure redraw is called.
72
+ """
73
+ event_press = Mock(x=10, y=10)
74
+ self.canvas._start_pan(event_press)
75
+ assert self.canvas._pan_start_x == 10
76
+ assert self.canvas._pan_start_y == 10
77
+
78
+ event_drag = Mock(x=20, y=30)
79
+ self.canvas._do_pan(event_drag)
80
+ # Offsets should be updated by dx=10, dy=20
81
+ assert self.canvas.offset_x == 10
82
+ assert self.canvas.offset_y == 20
83
+ self.redraw_mock.assert_called()
84
+
85
+ def test_hover_callback_invoked(self):
86
+ """
87
+ Ensure house hover callback is called.
88
+ """
89
+ event_move = Mock(x=50, y=60)
90
+ self.canvas._on_mouse_move(event_move)
91
+
92
+ expected_x = (50 - self.canvas.offset_x) / self.canvas.zoom_scale
93
+ expected_y = (60 - self.canvas.offset_y) / self.canvas.zoom_scale
94
+ # redraw is not called. hover call back is responsible for this
95
+ self.mock_hover.assert_called_with(expected_x, expected_y)
96
+
97
+ def test_zoom_in_updates_scale(self):
98
+ """
99
+ Simulate scrolling with Mouse Wheel.
100
+ Check if canvas zoom scale is changed.
101
+ Ensure redraw is called.
102
+ """
103
+ event_zoom_in = Mock()
104
+ event_zoom_in.type = tk.EventType.MouseWheel
105
+ event_zoom_in.delta = 120
106
+ event_zoom_in.x = 50
107
+ event_zoom_in.y = 50
108
+
109
+ old_scale = self.canvas.zoom_scale
110
+
111
+ self.canvas._do_zoom(event_zoom_in)
112
+ assert self.canvas.zoom_scale > old_scale
113
+ self.redraw_mock.assert_called()
114
+
115
+ def test_zoom_out_updates_scale(self):
116
+ """
117
+ Simulate scrolling with Mouse Wheel.
118
+ Check if canvas zoom scale is changed.
119
+ Ensure redraw is called.
120
+ """
121
+ event_zoom_in = Mock()
122
+ event_zoom_in.type = tk.EventType.MouseWheel
123
+ event_zoom_in.delta = -120
124
+ event_zoom_in.x = 50
125
+ event_zoom_in.y = 50
126
+
127
+ old_scale = self.canvas.zoom_scale
128
+
129
+ self.canvas._do_zoom(event_zoom_in)
130
+ assert self.canvas.zoom_scale < old_scale
131
+ self.redraw_mock.assert_called()
132
+
133
+ def test_dynamic_grid_cell_size_scales_with_zoom(self):
134
+ """
135
+ Test that grid cell size increases with zoom scale.
136
+ """
137
+ base_size = Config.GRID_CELL_SIZE
138
+ self.canvas.zoom_scale = 1.0
139
+ size_at_1x = self.canvas.get_dynamic_grid_cell_size()
140
+
141
+ self.canvas.zoom_scale = 2.0
142
+ size_at_2x = self.canvas.get_dynamic_grid_cell_size()
143
+
144
+ assert size_at_1x == base_size
145
+ assert size_at_2x > size_at_1x
@@ -0,0 +1,50 @@
1
+ # BSD 3-Clause License
2
+ #
3
+ # Copyright (c) 2025, Arm Limited
4
+ # All rights reserved.
5
+ #
6
+ # Redistribution and use in source and binary forms, with or without
7
+ # modification, are permitted provided that the following conditions are met:
8
+ #
9
+ # 1. Redistributions of source code must retain the above copyright notice, this
10
+ # list of conditions and the following disclaimer.
11
+ #
12
+ # 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ # this list of conditions and the following disclaimer in the documentation
14
+ # and/or other materials provided with the distribution.
15
+ #
16
+ # 3. Neither the name of the copyright holder nor the names of its
17
+ # contributors may be used to endorse or promote products derived from
18
+ # this software without specific prior written permission.
19
+ #
20
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ from common import patch_argv
32
+
33
+ from wperf_cmn_visualizer.__main__ import parse_args
34
+ from wperf_cmn_visualizer.config import Config
35
+
36
+
37
+ class TestArgParser:
38
+ """Tests for the command-line argument parser."""
39
+
40
+ def test_default_topology_file(self):
41
+ """Verify that the default topology file is set when no argument is provided."""
42
+ with patch_argv(['cmn-visualizer']):
43
+ args = parse_args()
44
+ assert args.topology == Config.DEFAULT_TOPOLOGY_FILE
45
+
46
+ def test_custom_topology_file(self):
47
+ """Verify that a custom topology file is correctly parsed from the CLI."""
48
+ with patch_argv(['cmn-visualizer', '--topology', 'my_topology.json']):
49
+ args = parse_args()
50
+ assert args.topology == 'my_topology.json'