[gem5-dev] Change in gem5/gem5[master]: misc: Added dot_writer for Ruby's network topology
Tiago Mück has submitted this change and it was merged. ( https://gem5-review.googlesource.com/c/public/gem5/+/17548 ) Change subject: misc: Added dot_writer for Ruby's network topology .. misc: Added dot_writer for Ruby's network topology Change-Id: Ic71ca7bc2eb4174d70afa368bc9cc987f3df89e9 Signed-off-by: Tiago Muck Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/17548 Reviewed-by: Jason Lowe-Power Maintainer: Jason Lowe-Power Tested-by: kokoro --- M src/python/SConscript M src/python/m5/simulate.py A src/python/m5/util/dot_writer_ruby.py 3 files changed, 140 insertions(+), 1 deletion(-) Approvals: Jason Lowe-Power: Looks good to me, approved; Looks good to me, approved kokoro: Regressions pass diff --git a/src/python/SConscript b/src/python/SConscript index fb1666c..758ab3d 100644 --- a/src/python/SConscript +++ b/src/python/SConscript @@ -52,6 +52,7 @@ PySource('m5.util', 'm5/util/code_formatter.py') PySource('m5.util', 'm5/util/convert.py') PySource('m5.util', 'm5/util/dot_writer.py') +PySource('m5.util', 'm5/util/dot_writer_ruby.py') PySource('m5.util', 'm5/util/grammar.py') PySource('m5.util', 'm5/util/jobfile.py') PySource('m5.util', 'm5/util/multidict.py') diff --git a/src/python/m5/simulate.py b/src/python/m5/simulate.py index 6f02327..f8da1fb 100644 --- a/src/python/m5/simulate.py +++ b/src/python/m5/simulate.py @@ -1,4 +1,4 @@ -# Copyright (c) 2012 ARM Limited +# Copyright (c) 2012,2019 ARM Limited # All rights reserved. # # The license below extends only to copyright in the software and shall @@ -56,6 +56,7 @@ from . import ticks from . import objects from m5.util.dot_writer import do_dot, do_dvfs_dot +from m5.util.dot_writer_ruby import do_ruby_dot from .util import fatal from .util import attrdict @@ -110,6 +111,7 @@ pass do_dot(root, options.outdir, options.dot_config) +do_ruby_dot(root, options.outdir, options.dot_config) # Initialize the global statistics stats.initSimStats() diff --git a/src/python/m5/util/dot_writer_ruby.py b/src/python/m5/util/dot_writer_ruby.py new file mode 100644 index 000..db115f5 --- /dev/null +++ b/src/python/m5/util/dot_writer_ruby.py @@ -0,0 +1,136 @@ +# Copyright (c) 2019 ARM Limited +# All rights reserved. +# +# The license below extends only to copyright in the software and shall +# not be construed as granting a license to any other intellectual +# property including but not limited to intellectual property relating +# to a hardware implementation of the functionality of the software +# licensed hereunder. You may use the software subject to the license +# terms below provided that you ensure that this notice is replicated +# unmodified and in its entirety in all distributions of the software, +# modified or unmodified, in source code or in binary form. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer; +# redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution; +# neither the name of the copyright holders nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# Authors: Tiago Muck + +# Creates a visual representation of a Ruby network topology + +import os +import m5 +from m5.util import warn +try: +import pydot +except: +pydot = False + + +def _dot_rgb_to_html(r, g, b): +return "#%.2x%.2x%.2x" % (r, g, b) + +def _dot_create_router_node(full_path, label): +return pydot.Node( \ + full_path, \ + shape = "Mrecord", \ + label = label, \ + style = "\"rounded, filled\"", \ + color = "#00", \ +
[gem5-dev] Change in gem5/gem5[master]: misc: Added dot_writer for Ruby's network topology
Tiago Mück has uploaded a new patch set (#3) to the change originally created by Giacomo Travaglini. ( https://gem5-review.googlesource.com/c/public/gem5/+/17548 ) Change subject: misc: Added dot_writer for Ruby's network topology .. misc: Added dot_writer for Ruby's network topology Change-Id: Ic71ca7bc2eb4174d70afa368bc9cc987f3df89e9 Signed-off-by: Tiago Muck --- M src/python/SConscript M src/python/m5/simulate.py A src/python/m5/util/dot_writer_ruby.py 3 files changed, 140 insertions(+), 1 deletion(-) -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/17548 To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings Gerrit-Project: public/gem5 Gerrit-Branch: master Gerrit-Change-Id: Ic71ca7bc2eb4174d70afa368bc9cc987f3df89e9 Gerrit-Change-Number: 17548 Gerrit-PatchSet: 3 Gerrit-Owner: Giacomo Travaglini Gerrit-Reviewer: Giacomo Travaglini Gerrit-Reviewer: Jason Lowe-Power Gerrit-Reviewer: Nikos Nikoleris Gerrit-Reviewer: Pouya Fotouhi Gerrit-Reviewer: Tiago Mück Gerrit-MessageType: newpatchset ___ gem5-dev mailing list gem5-dev@gem5.org http://m5sim.org/mailman/listinfo/gem5-dev
[gem5-dev] Change in gem5/gem5[master]: misc: Added dot_writer for Ruby's network topology
Tiago Mück has uploaded a new patch set (#2) to the change originally created by Giacomo Travaglini. ( https://gem5-review.googlesource.com/c/public/gem5/+/17548 ) Change subject: misc: Added dot_writer for Ruby's network topology .. misc: Added dot_writer for Ruby's network topology Change-Id: Ic71ca7bc2eb4174d70afa368bc9cc987f3df89e9 --- M src/python/SConscript M src/python/m5/simulate.py A src/python/m5/util/dot_writer_ruby.py 3 files changed, 137 insertions(+), 1 deletion(-) -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/17548 To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings Gerrit-Project: public/gem5 Gerrit-Branch: master Gerrit-Change-Id: Ic71ca7bc2eb4174d70afa368bc9cc987f3df89e9 Gerrit-Change-Number: 17548 Gerrit-PatchSet: 2 Gerrit-Owner: Giacomo Travaglini Gerrit-Reviewer: Daniel Carvalho Gerrit-Reviewer: Giacomo Travaglini Gerrit-Reviewer: Jason Lowe-Power Gerrit-Reviewer: Nikos Nikoleris Gerrit-Reviewer: Pouya Fotouhi Gerrit-Reviewer: Tiago Mück Gerrit-MessageType: newpatchset ___ gem5-dev mailing list gem5-dev@gem5.org http://m5sim.org/mailman/listinfo/gem5-dev
[gem5-dev] Change in gem5/gem5[master]: misc: Added dot_writer for Ruby's network topology
Hello Tiago Mück, I'd like you to do a code review. Please visit https://gem5-review.googlesource.com/c/public/gem5/+/17548 to review the following change. Change subject: misc: Added dot_writer for Ruby's network topology .. misc: Added dot_writer for Ruby's network topology Change-Id: Ic71ca7bc2eb4174d70afa368bc9cc987f3df89e9 --- M src/python/SConscript M src/python/m5/simulate.py A src/python/m5/util/dot_writer_ruby.py 3 files changed, 130 insertions(+), 1 deletion(-) diff --git a/src/python/SConscript b/src/python/SConscript index fb1666c..758ab3d 100644 --- a/src/python/SConscript +++ b/src/python/SConscript @@ -52,6 +52,7 @@ PySource('m5.util', 'm5/util/code_formatter.py') PySource('m5.util', 'm5/util/convert.py') PySource('m5.util', 'm5/util/dot_writer.py') +PySource('m5.util', 'm5/util/dot_writer_ruby.py') PySource('m5.util', 'm5/util/grammar.py') PySource('m5.util', 'm5/util/jobfile.py') PySource('m5.util', 'm5/util/multidict.py') diff --git a/src/python/m5/simulate.py b/src/python/m5/simulate.py index 6f02327..1add414 100644 --- a/src/python/m5/simulate.py +++ b/src/python/m5/simulate.py @@ -1,4 +1,4 @@ -# Copyright (c) 2012 ARM Limited +# Copyright (c) 2012,2019 ARM Limited # All rights reserved. # # The license below extends only to copyright in the software and shall @@ -56,6 +56,7 @@ from . import ticks from . import objects from m5.util.dot_writer import do_dot, do_dvfs_dot +import m5.util.dot_writer_ruby as dot_writer_ruby from .util import fatal from .util import attrdict @@ -111,6 +112,10 @@ do_dot(root, options.outdir, options.dot_config) +if hasattr(root.system,'ruby'): +dot_writer_ruby.do_dot(root.system.ruby.network, +options.outdir, options.dot_config + '.ruby') + # Initialize the global statistics stats.initSimStats() diff --git a/src/python/m5/util/dot_writer_ruby.py b/src/python/m5/util/dot_writer_ruby.py new file mode 100644 index 000..408d9c0 --- /dev/null +++ b/src/python/m5/util/dot_writer_ruby.py @@ -0,0 +1,123 @@ +# Copyright (c) 2019 ARM Limited +# All rights reserved. +# +# The license below extends only to copyright in the software and shall +# not be construed as granting a license to any other intellectual +# property including but not limited to intellectual property relating +# to a hardware implementation of the functionality of the software +# licensed hereunder. You may use the software subject to the license +# terms below provided that you ensure that this notice is replicated +# unmodified and in its entirety in all distributions of the software, +# modified or unmodified, in source code or in binary form. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer; +# redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution; +# neither the name of the copyright holders nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# Authors: Tiago Muck + +# Creates a visual representation of a Ruby network topology + +import m5, os, re +from m5.SimObject import isRoot, isSimObjectVector +from m5.params import PortRef, isNullPointer +from m5.util import warn +try: +import pydot +except: +pydot = False + + +def dot_rgb_to_html(r, g, b): +return "#%.2x%.2x%.2x" % (r, g, b) + +def dot_create_router_node(full_path, label): +return pydot.Node( \ + full_path, \ + shape = "Mrecord", \ + label = label, \ + style = "\"rounded, filled\"", \ + color = "#00", \ + fillcolor = dot_rgb_to_html(204, 230, 252), \ +