Practical Software Measurement

Calculating Mean Time to Defect

MTTD is Mean Time to Defect.  Basically, it means the average time between defects (mean is the statistical term for average).  A related term is MTTF, or Mean Time to Failure.  It is usually meant as the average time between encountering a defect serious enough to cause the system to fail.

Is MTTD hard to compute?  Does it require difficult metrics collection? Some people I have spoken to think so.  Some texts think so, too.  For example:

Gathering data about time between failures is very expensive.  It requires recording the occurrence time of each software failure.  It is sometimes quite difficult to record the time for all the failures observed during testing or operation.  To be useful, time between failures data also requires a high degree of accuracy.  This is perhaps the reason the MTTF metric is not widely used by commercial developers.


But this is not really true.  The MTTD or MTTF can be computed from basic defect metrics.   All you need is:

  • the total number of defects or failures and
  • the total number of months, weeks, days, or hours during which the system was running or being tested and metrics were recorded.  You do not need the exact time of each defect.

Here is an example.  I will compute MTTD and MTTF two ways to demonstrate that the results are identical.  This table contains defect metrics for first three days of operation of a system that runs 24 hours a day, five days a week:

mttd

The metrics were collected over a 3 day period.  There were 4 defects in 3 days, or an average of 0.75 days between defect, or 18 hours between defects.  There were 3 failures in 3 days, for an average of 1 days between failure, or 24 hours between failure.

What if we computed it the more difficult way by summing the times between defects and dividing by the number of defects?  8 + 6 + 19 + 32 = 65 hours plus the 7 hours with no defect = 72 hours.  Divided by 4 defects = 18 hours.  Failures can be calculated similarly.

In conclusion, you do not need to record the exact time each defect or failure is encountered in order to compute MTTD or MTTF.  You just need the total number of defects or failures encountered and the total amount of time the system was running or tested.

The SLIM Datamanager tool Help function provides the following text to explain the calculation of MTTD:

The average time in days between discovery of new software defects during the first month of Phase 4.  To calculate this value, take the reciprocal of the number of defects during this month and multiply by 4.333 (weeks per month) and the days per week for the operational environment.  For example, if there were 5 errors during the first month of operation and the system runs 7 days per week, the average MTTD value would be (1/5) * 4.333 * 7 = 6.07 days between defects.  (If there are no defects in the first month, the MTTD in the first month cannot be calculated.  In this case, you should probably leave this field blank, or you may want to enter the maximum number of days the system runs in that month.)

Blog Post Categories 
Defects