summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosef Weidendorfer <Josef.Weidendorfer@gmx.de>2016-10-24 16:53:15 (GMT)
committerJosef Weidendorfer <Josef.Weidendorfer@gmx.de>2016-10-24 16:57:29 (GMT)
commit1eb4b19556bff1e83e42b81dae8f349683074a1a (patch)
tree488864654a17cf69060926f702e99f972b7b07e1
parentbfc26ad53a90ccd8ba105a113bb3c385699ab89f (diff)
Call graph: be more robust against bogus input
If input data specified that a call between functions had 0 cost, it still was possible that this call arc was drawn, resulting in strange visulizations (huge random costs shown). We need to stop drawing the call graph in these cases.
-rw-r--r--libviews/callgraphview.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/libviews/callgraphview.cpp b/libviews/callgraphview.cpp
index 5b90625..5c0d1f6 100644
--- a/libviews/callgraphview.cpp
+++ b/libviews/callgraphview.cpp
@@ -1073,7 +1073,7 @@ void GraphExporter::buildGraph(TraceFunction* f, int depth, bool toCallees,
// from here with full incl. cost because of previous cutoffs
if ((e.cost >= _realCallLimit) && (oldCost < _realCallLimit))
cost = e.cost;
- if (cost < _realCallLimit) {
+ if ((cost <= 0) || (cost <= _realCallLimit)) {
if (0)
qDebug(" Edge Cutoff, limit not reached");
continue;
@@ -1085,7 +1085,10 @@ void GraphExporter::buildGraph(TraceFunction* f, int depth, bool toCallees,
else
s = f2->inclusive()->subCost(_eventType);
SubCost v = call->subCost(_eventType);
- // FIXME: Can s be 0?
+
+ // Never recurse if s or v is 0 (can happen with bogus input)
+ if ((v == 0) || (s== 0)) continue;
+
buildGraph(f2, depth+1, toCallees, factor * v / s);
}
}