42 _firstPercentage = 1.0;
57 double maxP = _inclHisto[0];
60 if (_inclHisto[i]>maxP) {
70 double maxP = _selfHisto[0];
73 if (_selfHisto[i]>maxP) {
96 c->addCallerCoverage(l, 1.0, 0);
98 c->addCallingCoverage(l, 1.0, 1.0, 0);
106 if (_inRecursion)
return;
112 #ifdef DEBUG_COVERAGE
113 qDebug(
"CallerCov: D %d, %s (was active, incl %f, self %f): newP %f", d,
124 _firstPercentage = pBack;
126 if (_minDistance > d) _minDistance = d;
127 if (_maxDistance < d) _maxDistance = d;
129 _inclHisto[d] += pBack;
135 #ifdef DEBUG_COVERAGE
136 qDebug(
"CallerCov: D %d, %s (now active, new incl %f): newP %f",
141 double callVal, pBackNew;
144 if (call->
inCycle()>0)
continue;
147 if (call->
subCost(_costType)>0) {
163 callVal = (double) call->
subCost(_costType);
164 pBackNew = pBack * (callVal / incl);
181 if (pBackNew > 0.0001)
182 c->addCallerCoverage(fList, pBackNew, d+1);
187 _inRecursion =
false;
197 double pForward,
double pBack,
int d)
199 if (_inRecursion)
return;
201 #ifdef DEBUG_COVERAGE
202 static const char* spaces =
" ";
208 #ifdef DEBUG_COVERAGE
209 qDebug(
"CngCov:%s - %s (incl %f, self %f): forward %f, back %f",
210 spaces+strlen(spaces)-d,
218 #ifdef DEBUG_COVERAGE
219 qDebug(
"CngCov:%s < %s: STOP (is active)",
220 spaces+strlen(spaces)-d,
232 _firstPercentage = pForward;
234 if (_minDistance > d) _minDistance = d;
235 if (_maxDistance < d) _maxDistance = d;
237 _inclHisto[d] += pForward;
238 _selfHisto[d] +=
self;
245 #ifdef DEBUG_COVERAGE
246 qDebug(
"CngCov:%s < %s (incl %f, self %f)",
247 spaces+strlen(spaces)-d,
252 double callVal, pForwardNew, pBackNew;
255 if (call->
inCycle()>0)
continue;
258 if (call->
subCost(_costType)>0) {
274 callVal = (double) call->
subCost(_costType);
275 pForwardNew = pForward * (callVal / incl);
276 pBackNew = pBack * (callVal /
282 #ifdef DEBUG_COVERAGE
283 qDebug(
"CngCov:%s > %s: forward %f, back %f, calls %f -> %f, now %f",
284 spaces+strlen(spaces)-d,
286 pForwardNew, pBackNew,
288 pBack * call->callCount(),
296 double bFactor = 1.0 / (1.0 - pBackNew);
297 #ifdef DEBUG_COVERAGE
298 qDebug(
"CngCov:%s Recursion - origP %f, actP %f => factor %f, newP %f",
299 spaces+strlen(spaces)-d,
301 fFactor, pForwardNew * fFactor);
303 pForwardNew *= fFactor;
309 if (pForwardNew > 0.0001)
310 c->addCallingCoverage(fList, pForwardNew, pBackNew, d+1);
315 _inRecursion =
false;
SubCost subCost(EventType *)
Returns a sub cost.
static TraceFunctionList coverage(TraceFunction *f, CoverageMode m, EventType *ct)
Calculate coverage of all functions based on function f.
const TraceCallList & callings(bool skipCycle=false) const
TraceFunction * caller(bool skipCycle=false) const
static const int maxHistogramDepth
TraceCallList callers(bool skipCycle=false) const
TraceAssociation * association(int rtti)
void append(const T &value)
#define maxHistogramDepthValue
QString prettyName() const
Similar to name, but prettyfied = more descriptive to humans.
virtual TraceData * data()
bool setFunction(TraceFunction *)
reset function to associate this object to.
TraceFunction * called(bool skipCycle=false) const
A call from one to another function.
TraceFunction * _function
ProfileCostArray * inclusive()