Tiago Mück has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/41093 )
Change subject: python: more readable Ruby dot topology
......................................................................
python: more readable Ruby dot topology
Controllers may have the same name under different parents, thus
the controller full path is used as label. To avoid long and redundant
labels, common prefixes and suffixes are removed from the path.
Change-Id: Id793b59a4c38f3425ae5348138ae1d74c823edd7
---
M src/python/m5/util/dot_writer_ruby.py
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/src/python/m5/util/dot_writer_ruby.py
b/src/python/m5/util/dot_writer_ruby.py
index 9356a94..4123cac 100644
--- a/src/python/m5/util/dot_writer_ruby.py
+++ b/src/python/m5/util/dot_writer_ruby.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2019 ARM Limited
+# Copyright (c) 2019,2021 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
@@ -90,9 +90,24 @@
)
connected[link.dst_node.path()] = link.src_node.path()
+ # Find common prefixes and sufixes to generate names
+ paths = [link.ext_node.path() for link in network.ext_links]
+ rpaths = [link.ext_node.path()[::-1] for link in network.ext_links]
+ preffix = os.path.commonprefix(paths)
+ suffix = os.path.commonprefix(rpaths)[::-1]
+ def strip_right(text, suffix):
+ if not text.endswith(suffix):
+ return text
+ return text[:len(text)-len(suffix)]
+ def strip_left(text, prefix):
+ if not text.startswith(prefix):
+ return text
+ return text[len(prefix):]
+
+
for link in network.ext_links:
ctrl = link.ext_node
- label = ctrl._name
+ label = strip_right(strip_left(ctrl.path(), preffix), suffix)
if hasattr(ctrl, '_node_type'):
label += ' (' + ctrl._node_type + ')'
callgraph.add_node(
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/41093
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Id793b59a4c38f3425ae5348138ae1d74c823edd7
Gerrit-Change-Number: 41093
Gerrit-PatchSet: 1
Gerrit-Owner: Tiago Mück <tiago.m...@arm.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s