diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2018-07-12 14:27:26 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2018-07-12 12:53:23 +0000 |
commit | d7733bafe102208c6f9b7b0fc0b44dd2280790ab (patch) | |
tree | c9a1f3f2b0b17eabab1d3425f28903b17418d242 | |
parent | 3a4592609c510dd18041cf3635d4c14477c585a6 (diff) |
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 <christian.kandeler@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
-rw-r--r-- | src/libs/tracing/flamegraph.cpp | 12 |
1 files 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); |