From 269a7d6f730cda803f9dd375095347371e35c8d3 Mon Sep 17 00:00:00 2001
From: Christiaan Janssen <christiaan.janssen@nokia.com>
Date: Wed, 20 Jul 2011 09:31:03 +0200
Subject: [PATCH] QmlProfiler: skip anonymous events when computing percentages

Change-Id: I23acc59937622c4426c02a613434eb443a155b29
Reviewed-on: http://codereview.qt.nokia.com/1864
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Aurindam Jana <aurindam.jana@nokia.com>
---
 src/plugins/qmlprofiler/qmlprofilereventview.cpp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/plugins/qmlprofiler/qmlprofilereventview.cpp b/src/plugins/qmlprofiler/qmlprofilereventview.cpp
index c1ead786352..7bfa178fd73 100644
--- a/src/plugins/qmlprofiler/qmlprofilereventview.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilereventview.cpp
@@ -233,10 +233,15 @@ void QmlProfilerEventStatistics::QmlProfilerEventStatisticsPrivate::postProcess(
 {
     double totalTime = 0;
 
-    foreach (QmlEventData *binding, m_rootHash.values())
+    foreach (QmlEventData *binding, m_rootHash.values()) {
+        if (binding->filename->isEmpty())
+            continue;
         totalTime += binding->duration;
+    }
 
     foreach (QmlEventData *binding, m_rootHash.values()) {
+        if (binding->filename->isEmpty())
+            continue;
         binding->percentOfTime = binding->duration * 100.0 / totalTime;
         binding->timePerCall = binding->calls > 0 ? double(binding->duration) / binding->calls : 0;
     }
-- 
GitLab