diff options
author | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-07-06 14:51:48 +0000 |
---|---|---|
committer | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-07-06 14:51:48 +0000 |
commit | 42fa384f7f1d12e02987b17d2650e2136b38fa00 (patch) | |
tree | a94f984308aa02ce879de7afc0672f6a1d92a100 /gcc/gcov-io.h | |
parent | b80f1d67f4ed212faa54034bed77dec05afdad97 (diff) | |
download | gcc-42fa384f7f1d12e02987b17d2650e2136b38fa00.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@69006 138bc75d-0d04-0410-961f-82ee72b054a4
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 5d0b716c7f1..999d07eea08 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 */ |