diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2003-07-06 14:51:48 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2003-07-06 14:51:48 +0000 |
commit | dd486eb27ce3fc75e02311d3e36d9e10a9f56eee (patch) | |
tree | a94f984308aa02ce879de7afc0672f6a1d92a100 /gcc/gcov-io.h | |
parent | c07e547752171cafffdbae0c46f90251d266141b (diff) | |
download | gcc-dd486eb27ce3fc75e02311d3e36d9e10a9f56eee.zip gcc-dd486eb27ce3fc75e02311d3e36d9e10a9f56eee.tar.gz gcc-dd486eb27ce3fc75e02311d3e36d9e10a9f56eee.tar.bz2 |
gcov-io.h: Add a local time stamp.
* gcov-io.h: Add a local time stamp.
(struct gcov_info): Add stamp field.
(gcov_truncate): New.
* coverage.c (read_counts_file): Skip the stamp.
(coverage_begin_output): Write the stamp.
(build_gcov_info): Declare and init the stamp.
(coverage_finish): Only unlink data file, if stamp is zero.
* gcov-dump.c (dump_file): Dump the stamp.
* gcov.c (bbg_stamp): New.
(release_structures): Clear bbg_stamp.
(read_graph_file): Read stamp.
(read_count_file): Check stamp.
* libgcov.c (gcov_exit): Check stamp and truncate if needed.
From-SVN: r69006
Diffstat (limited to 'gcc/gcov-io.h')
-rw-r--r-- | gcc/gcov-io.h | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/gcc/gcov-io.h b/gcc/gcov-io.h index 5d0b716..999d07e 100644 --- a/gcc/gcov-io.h +++ b/gcc/gcov-io.h @@ -52,11 +52,17 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA The basic format of the files is - file : int32:magic int32:version record* + file : int32:magic int32:version int32:stamp record* The magic ident is different for the bbg and the counter files. The version is the same for both files and is derived from gcc's - version number. Although the ident and version are formally 32 bit + version number. The stamp value is used to synchronize bbg and + counter files and to synchronize merging within a counter file. It + need not be an absolute time stamp, merely a ticker that increments + fast enough and cycles slow enough to distinguish different + compile/run/compile cycles. + + Although the ident and version are formally 32 bit numbers, they are derived from 4 character ASCII strings. The version number consists of the single character major version number, a two character minor version number (leading zero for @@ -370,8 +376,9 @@ struct gcov_info gcov_unsigned_t version; /* expected version number */ struct gcov_info *next; /* link to next, used by libgcc */ + gcov_unsigned_t stamp; /* uniquifying time stamp */ const char *filename; /* output file name */ - + unsigned n_functions; /* number of functions */ const struct gcov_fn_info *functions; /* table of functions */ @@ -453,6 +460,7 @@ GCOV_LINKAGE void gcov_write_counter (gcov_type); GCOV_LINKAGE void gcov_write_tag_length (gcov_unsigned_t, gcov_unsigned_t); GCOV_LINKAGE void gcov_write_summary (gcov_unsigned_t /*tag*/, const struct gcov_summary *); +static void gcov_truncate (void); static void gcov_rewrite (void); GCOV_LINKAGE void gcov_seek (gcov_position_t /*position*/); #else @@ -525,6 +533,12 @@ gcov_rewrite (void) gcov_var.offset = 0; fseek (gcov_var.file, 0L, SEEK_SET); } + +static inline void +gcov_truncate (void) +{ + ftruncate (fileno (gcov_var.file), 0L); +} #endif #endif /* IN_LIBGCOV >= 0 */ |