GCC Middle and Back End API Reference
gcov-io.h File Reference

Go to the source code of this file.

Data Structures

struct  gcov_bucket_type
struct  gcov_ctr_summary
struct  gcov_summary
struct  gcov_ctr_info
struct  gcov_fn_info
struct  gcov_info
struct  gcov_var
struct  gcov_working_set_info

Typedefs

typedef unsigned gcov_unsigned_t __attribute__ ((mode(SI)))
typedef unsigned gcov_unsigned_t
typedef unsigned gcov_position_t
typedef HOST_WIDEST_INT gcov_type
typedef unsigned HOST_WIDEST_INT gcov_type_unsigned
typedef void(* gcov_merge_fn )(gcov_type *, gcov_unsigned_t)
typedef struct
gcov_working_set_info 
gcov_working_set_t

Functions

void __gcov_init (struct gcov_info *) ATTRIBUTE_HIDDEN
void __gcov_flush (void) ATTRIBUTE_HIDDEN
void __gcov_reset (void)
void __gcov_dump (void)
void __gcov_merge_add (gcov_type *, unsigned) ATTRIBUTE_HIDDEN
void __gcov_merge_single (gcov_type *, unsigned) ATTRIBUTE_HIDDEN
void __gcov_merge_delta (gcov_type *, unsigned) ATTRIBUTE_HIDDEN
void __gcov_merge_ior (gcov_type *, unsigned) ATTRIBUTE_HIDDEN
void __gcov_interval_profiler (gcov_type *, gcov_type, int, unsigned)
void __gcov_pow2_profiler (gcov_type *, gcov_type)
void __gcov_one_value_profiler (gcov_type *, gcov_type)
void __gcov_indirect_call_profiler_v2 (gcov_type, void *)
void __gcov_average_profiler (gcov_type *, gcov_type)
void __gcov_ior_profiler (gcov_type *, gcov_type)
pid_t __gcov_fork (void) ATTRIBUTE_HIDDEN
int __gcov_execl (const char *, char *,...) ATTRIBUTE_HIDDEN
int __gcov_execlp (const char *, char *,...) ATTRIBUTE_HIDDEN
int __gcov_execle (const char *, char *,...) ATTRIBUTE_HIDDEN
int __gcov_execv (const char *, char *const []) ATTRIBUTE_HIDDEN
int __gcov_execvp (const char *, char *const []) ATTRIBUTE_HIDDEN
int __gcov_execve (const char *, char *const [], char *const []) ATTRIBUTE_HIDDEN
GCOV_LINKAGE int gcov_open (const char @endverbatim *) ATTRIBUTE_HIDDEN
GCOV_LINKAGE int gcov_open (const char @endverbatim *, int)
GCOV_LINKAGE int gcov_magic (gcov_unsigned_t, gcov_unsigned_t)
GCOV_LINKAGE int gcov_close (void) ATTRIBUTE_HIDDEN
static gcov_position_t gcov_position (void)
static int gcov_is_error (void)
GCOV_LINKAGE gcov_unsigned_t gcov_read_unsigned (void) ATTRIBUTE_HIDDEN
GCOV_LINKAGE gcov_type gcov_read_counter (void) ATTRIBUTE_HIDDEN
GCOV_LINKAGE void gcov_read_summary (struct gcov_summary *) ATTRIBUTE_HIDDEN
GCOV_LINKAGE void gcov_write_counter (gcov_type) ATTRIBUTE_HIDDEN
GCOV_LINKAGE void gcov_write_tag_length (gcov_unsigned_t, gcov_unsigned_t) ATTRIBUTE_HIDDEN
GCOV_LINKAGE void gcov_write_summary (gcov_unsigned_t, const struct gcov_summary *) ATTRIBUTE_HIDDEN
static void gcov_rewrite (void)
GCOV_LINKAGE void gcov_seek (gcov_position_t) ATTRIBUTE_HIDDEN
GCOV_LINKAGE const char * gcov_read_string (void)
GCOV_LINKAGE void gcov_sync (gcov_position_t, gcov_unsigned_t)
GCOV_LINKAGE void gcov_write_unsigned (gcov_unsigned_t) ATTRIBUTE_HIDDEN
GCOV_LINKAGE unsigned gcov_histo_index (gcov_type value)
GCOV_LINKAGE void gcov_write_string (const char *)
GCOV_LINKAGE gcov_position_t gcov_write_tag (gcov_unsigned_t)
GCOV_LINKAGE void gcov_write_length (gcov_position_t)
GCOV_LINKAGE void compute_working_sets (const struct gcov_ctr_summary *summary, gcov_working_set_t *gcov_working_sets)
GCOV_LINKAGE time_t gcov_time (void)

Variables

GCOV_LINKAGE struct gcov_var ATTRIBUTE_HIDDEN

Typedef Documentation

static void __attribute__
   About the target 
   Die when sys call fails. CMSGID is the error message.  
typedef void(* gcov_merge_fn)(gcov_type *, gcov_unsigned_t)
   Type of function used to merge counters.  
typedef unsigned gcov_position_t
typedef unsigned gcov_unsigned_t
   About the host 
   Working set size statistics for a given percentage of the entire
   profile (sum_all from the counter summary).  

Function Documentation

void __gcov_average_profiler ( gcov_type ,
gcov_type   
)
void __gcov_dump ( void  )
   Function to enable early write of profile information so far.  
int __gcov_execl ( const char *  ,
char *  ,
  ... 
)
int __gcov_execle ( const char *  ,
char *  ,
  ... 
)
int __gcov_execlp ( const char *  ,
char *  ,
  ... 
)
int __gcov_execv ( const char *  ,
char *  const[] 
)
int __gcov_execve ( const char *  ,
char *  const[],
char *  const[] 
)
int __gcov_execvp ( const char *  ,
char *  const[] 
)
void __gcov_flush ( void  )
   Called before fork, to avoid double counting.  
pid_t __gcov_fork ( void  )
   The wrappers around some library functions..  
void __gcov_indirect_call_profiler_v2 ( gcov_type  ,
void *   
)
void __gcov_init ( struct gcov_info )
   Register a new object file module.  
void __gcov_interval_profiler ( gcov_type ,
gcov_type  ,
int  ,
unsigned   
)
   The profiler functions.  
void __gcov_ior_profiler ( gcov_type ,
gcov_type   
)
void __gcov_merge_add ( gcov_type ,
unsigned   
)
   The merge function that just sums the counters.  
void __gcov_merge_delta ( gcov_type ,
unsigned   
)
   The merge function to choose the most common difference between
   consecutive values.  
void __gcov_merge_ior ( gcov_type ,
unsigned   
)
   The merge function that just ors the counters together.  
void __gcov_merge_single ( gcov_type ,
unsigned   
)
   The merge function to choose the most common value.  
void __gcov_one_value_profiler ( gcov_type ,
gcov_type   
)
void __gcov_pow2_profiler ( gcov_type ,
gcov_type   
)
void __gcov_reset ( void  )
   Function to reset all counters to 0.  
GCOV_LINKAGE void compute_working_sets ( const struct gcov_ctr_summary summary,
gcov_working_set_t gcov_working_sets 
)
   This is used by gcov-dump (IN_GCOV == -1) and in the compiler
   (!IN_GCOV && !IN_LIBGCOV).  
   Compute the working set information from the counter histogram in
   the profile summary. This is an array of information corresponding to a
   range of percentages of the total execution count (sum_all), and includes
   the number of counters required to cover that working set percentage and
   the minimum counter value in that working set.  
     Compute the amount of sum_all that the cumulative hotness grows
     by in each successive working set entry, which depends on the
     number of working set entries.  
     Next fill in an array of the cumulative hotness values corresponding
     to each working set summary entry we are going to compute below.
     Skip 0% statistics, which can be extrapolated from the
     rest of the summary data.  
     The last summary entry is reserved for (roughly) 99.9% of the
     working set. Divide by 1024 so it becomes a shift, which gives
     almost exactly 99.9%.  
     Next, walk through the histogram in decending order of hotness
     and compute the statistics for the working set summary array.
     As histogram entries are accumulated, we check to see which
     working set entries have had their expected cum_value reached
     and fill them in, walking the working set entries in increasing
     size of cum_value.  
         If we haven't reached the required cumulative counter value for
         the current working set percentage, simply accumulate this histogram
         entry into the running sums and continue to the next histogram
         entry.  
         If adding the current histogram entry's cumulative counter value
         causes us to exceed the current working set size, then estimate
         how many of this histogram entry's counter values are required to
         reach the working set size, and fill in working set entries
         as we reach their expected cumulative value.  
             If we haven't reached the last histogram entry counter, add
             in the minimum value again. This will underestimate the
             cumulative sum so far, because many of the counter values in this
             entry may have been larger than the minimum. We could add in the
             average value every time, but that would require an expensive
             divide operation.  
             If we have reached the last histogram entry counter, then add
             in the entire cumulative value.  
             Next walk through successive working set entries and fill in
             the statistics for any whose size we have reached by accumulating
             this histogram counter.  
         Finally, update the running cumulative value since we were
         using a temporary above.  

References count, gcov_bucket_type::cum_value, gcov_working_set_info::min_counter, gcov_bucket_type::min_value, gcov_bucket_type::num_counters, and gcov_working_set_info::num_counters.

GCOV_LINKAGE int gcov_close ( void  )
   Close the current gcov file. Flushes data to disk. Returns nonzero
   on failure or error flag set.  
GCOV_LINKAGE unsigned gcov_histo_index ( gcov_type  value)
   Available only in compiler 
static int gcov_is_error ( )
inlinestatic
   Return nonzero if the error flag is set.  
GCOV_LINKAGE int gcov_magic ( gcov_unsigned_t  ,
gcov_unsigned_t   
)
GCOV_LINKAGE int gcov_open ( const char @endverbatim *  )
   Functions for reading and writing gcov files. In libgcov you can
   open the file for reading then writing. Elsewhere you can open the
   file either for reading or for writing. When reading a file you may
   use the gcov_read_* functions, gcov_sync, gcov_position, &
   gcov_error. When writing a file you may use the gcov_write
   functions, gcov_seek & gcov_error. When a file is to be rewritten
   you use the functions for reading, then gcov_rewrite then the
   functions for writing.  Your file may become corrupted if you break
   these invariants.  
GCOV_LINKAGE int gcov_open ( const char @endverbatim *  ,
int   
)
static gcov_position_t gcov_position ( void  )
inlinestatic
   Available everywhere.  
   Save the current position in the gcov file.  

Referenced by tag_lines().

GCOV_LINKAGE gcov_type gcov_read_counter ( void  )
   Read counter value from a coverage file. Sets error flag on file
   error, overflow flag on overflow 

References gcov_read_unsigned(), and gcov_read_words().

GCOV_LINKAGE const char* gcov_read_string ( void  )
   Available outside libgcov 
   Read string from coverage file. Returns a pointer to a static
   buffer, or NULL on empty string. You must copy the string before
   calling another gcov function.  

Referenced by tag_lines().

GCOV_LINKAGE void gcov_read_summary ( struct gcov_summary )
GCOV_LINKAGE gcov_unsigned_t gcov_read_unsigned ( void  )
   Read unsigned value from a coverage file. Sets error flag on file
   error, overflow flag on overflow 

Referenced by gcov_read_counter(), read_graph_file(), and tag_lines().

static void gcov_rewrite ( )
inlinestatic
   Move to beginning of file and initialize for writing.  
GCOV_LINKAGE void gcov_seek ( gcov_position_t  )
GCOV_LINKAGE void gcov_sync ( gcov_position_t  ,
gcov_unsigned_t   
)
GCOV_LINKAGE time_t gcov_time ( void  )
   Available in gcov 
   Return the modification time of the current gcov file.  

References floor_log2(), HOST_BITS_PER_WIDE_INT, and HOST_WIDE_INT.

GCOV_LINKAGE void gcov_write_counter ( gcov_type  )
   Available only in libgcov 
GCOV_LINKAGE void gcov_write_length ( gcov_position_t  )
GCOV_LINKAGE void gcov_write_string ( const char *  )
GCOV_LINKAGE void gcov_write_summary ( gcov_unsigned_t  ,
const struct gcov_summary  
)
GCOV_LINKAGE gcov_position_t gcov_write_tag ( gcov_unsigned_t  )
GCOV_LINKAGE void gcov_write_tag_length ( gcov_unsigned_t  ,
gcov_unsigned_t   
)
GCOV_LINKAGE void gcov_write_unsigned ( gcov_unsigned_t  )
   Available outside gcov 

Variable Documentation

GCOV_LINKAGE struct gcov_var ATTRIBUTE_HIDDEN