stat.h File Reference

Contains functions for handling coverage statistics. More...

#include "defines.h"

Go to the source code of this file.

Functions

void statistic_create (statistic **stat)
 Creates and initializes a new statistic structure.
bool statistic_is_empty (statistic *stat)
 Returns TRUE if the given statistic structure contains no coverage information.
void statistic_dealloc (statistic *stat)
 Deallocates memory for a statistic structure.

Detailed Description

Contains functions for handling coverage statistics.

Author:
Trevor Williams (phase1geo@gmail.com)
Date:
4/4/2002

Function Documentation

void statistic_create ( statistic **  stat  ) 

Creates and initializes a new statistic structure.

Allocates new memory for a coverage statistic structure and initializes its values.

Parameters:
stat Pointer to newly create/initialized statistic structure

References FALSE, malloc_safe, PROFILE, PROFILE_END, and TRUE.

Referenced by report_gather_funit_stats(), and report_gather_instance_stats().

00033   { PROFILE(STATISTIC_CREATE);
00034 
00035   if( *stat == NULL ) {
00036     *stat = (statistic*)malloc_safe( sizeof( statistic ) );
00037   }
00038 
00039   (*stat)->line_hit        = 0;
00040   (*stat)->line_excluded   = 0;
00041   (*stat)->line_total      = 0;
00042   (*stat)->tog01_hit       = 0;
00043   (*stat)->tog10_hit       = 0;
00044   (*stat)->tog_excluded    = 0;
00045   (*stat)->tog_total       = 0;
00046   (*stat)->tog_cov_found   = FALSE;
00047   (*stat)->comb_hit        = 0;
00048   (*stat)->comb_excluded   = 0;
00049   (*stat)->comb_total      = 0;
00050   (*stat)->state_total     = 0;
00051   (*stat)->state_hit       = 0;
00052   (*stat)->arc_total       = 0;
00053   (*stat)->arc_hit         = 0;
00054   (*stat)->arc_excluded    = 0;
00055   (*stat)->assert_hit      = 0;
00056   (*stat)->assert_excluded = 0;
00057   (*stat)->assert_total    = 0;
00058   (*stat)->mem_wr_hit      = 0;
00059   (*stat)->mem_rd_hit      = 0;
00060   (*stat)->mem_ae_total    = 0;
00061   (*stat)->mem_tog01_hit   = 0;
00062   (*stat)->mem_tog10_hit   = 0;
00063   (*stat)->mem_tog_total   = 0;
00064   (*stat)->mem_cov_found   = FALSE;
00065   (*stat)->mem_excluded    = 0;
00066   (*stat)->show            = TRUE;
00067 
00068   PROFILE_END;
00069 
00070 }

void statistic_dealloc ( statistic stat  ) 

Deallocates memory for a statistic structure.

Destroys the specified statistic structure from heap memory.

Parameters:
stat Pointer to statistic structure to deallocate from heap

References free_safe, PROFILE, and PROFILE_END.

Referenced by funit_clean().

00104   { PROFILE(STATISTIC_DEALLOC);
00105 
00106   if( stat != NULL ) {
00107    
00108     /* Free up memory for entire structure */
00109     free_safe( stat, sizeof( statistic ) );
00110 
00111   }
00112 
00113   PROFILE_END;
00114 
00115 }

bool statistic_is_empty ( statistic stat  ) 

Returns TRUE if the given statistic structure contains no coverage information.

Returns:
Returns TRUE if the given statistic structure contains values of 0 for all of its metrics.
Parameters:
stat Pointer to statistic structure to check

References statistic_s::arc_total, statistic_s::assert_total, statistic_s::comb_total, statistic_s::line_total, statistic_s::mem_ae_total, statistic_s::mem_tog_total, PROFILE, PROFILE_END, statistic_s::state_total, and statistic_s::tog_total.

Referenced by report_gather_funit_stats(), and report_gather_instance_stats().

00078   { PROFILE(STATISTIC_IS_EMPTY);
00079 
00080   bool retval;  /* Return value for this function */
00081 
00082   assert( stat != NULL );
00083 
00084   retval = (stat->line_total    == 0) &&
00085            (stat->tog_total     == 0) &&
00086            (stat->comb_total    == 0) &&
00087            (stat->state_total   == 0) &&
00088            (stat->arc_total     == 0) &&
00089            (stat->assert_total  == 0) &&
00090            (stat->mem_ae_total  == 0) &&
00091            (stat->mem_tog_total == 0);
00092 
00093   PROFILE_END;
00094 
00095   return( retval );
00096 
00097 }

Generated on Sun Nov 21 00:55:41 2010 for Covered by  doxygen 1.6.3