python: limit tooltip string length to 16384

Pydot limits the maximum line length to this value

JIRA:https://gem5.atlassian.net/browse/GEM5-1200

Change-Id: I0e6423b79f014695496dad279322304ae10a3978
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/61009
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
This commit is contained in:
Gabriel Busnot
2021-06-22 12:44:46 +02:00
committed by Gabriel B.
parent 131f5f033a
commit 1f32846874

View File

@@ -149,7 +149,13 @@ def dot_create_cluster(simNode, full_path, label):
ini_strings.append(str(param) + "&#61;" +
simNode._values[param].ini_str())
# join all the parameters with an HTML newline
# Pydot limit line length to 16384.
# Account for the quotes added later around the tooltip string
tooltip = "&#10;\\".join(ini_strings)
max_tooltip_length = 16384 - 2
if len(tooltip) > max_tooltip_length:
truncated = '... (truncated)'
tooltip = tooltip[:max_tooltip_length-len(truncated)] + truncated
return pydot.Cluster( \
full_path, \