From d7733bafe102208c6f9b7b0fc0b44dd2280790ab Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Thu, 12 Jul 2018 14:27:26 +0200 Subject: Tracing: Don't rebuild flame graph if there is nothing to see If the root size is 0, none of the nodes will be visible. Don't create them in the first place. Task-number: QTCREATORBUG-20772 Change-Id: I9595daece2d17fe8202b322ffafd361d6fa422fa Reviewed-by: Christian Kandeler Reviewed-by: Eike Ziller --- src/libs/tracing/flamegraph.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/libs/tracing/flamegraph.cpp b/src/libs/tracing/flamegraph.cpp index 9d7df037f5..0e454cdbb7 100644 --- a/src/libs/tracing/flamegraph.cpp +++ b/src/libs/tracing/flamegraph.cpp @@ -185,11 +185,13 @@ void FlameGraph::rebuild() return; } - if (m_root.isValid()) { - QObject *parentObject = appendChild(this, this, qmlContext(this), m_root, 0, 1); - m_depth = buildNode(m_root, parentObject, 1, m_maximumDepth); - } else { - m_depth = buildNode(m_root, this, 0, m_maximumDepth); + if (m_model->data(m_root, m_sizeRole).toReal() > 0) { + if (m_root.isValid()) { + QObject *parentObject = appendChild(this, this, qmlContext(this), m_root, 0, 1); + m_depth = buildNode(m_root, parentObject, 1, m_maximumDepth); + } else { + m_depth = buildNode(m_root, this, 0, m_maximumDepth); + } } emit depthChanged(m_depth); -- cgit v1.2.3