aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2012-05-08 21:22:28 +0000
committerTeresa Johnson <tejohnson@gcc.gnu.org>2012-05-08 21:22:28 +0000
commit4e8ee9cbf7895df0147627c88a682d3e4d789779 (patch)
treee8169275509aad912d8d4b57d59a52610ef8bcc8 /gcc
parent564fe867d8a1abfaa30303b3eca98e9b782fcdc9 (diff)
downloadgcc-4e8ee9cbf7895df0147627c88a682d3e4d789779.zip
gcc-4e8ee9cbf7895df0147627c88a682d3e4d789779.tar.gz
gcc-4e8ee9cbf7895df0147627c88a682d3e4d789779.tar.bz2
This patch adds functionality to libgcov to enable user applications to collect...
This patch adds functionality to libgcov to enable user applications to collect profile data only in regions of interest. This is useful, for example, to collect profile data from a long-running server only during the time when it is serving requests. Specifically, the new routines __gcov_reset will clear all profile counters to zero and __gcov_dump will write out the profile information collected so far. A global variable is used to prevent writing out the profile a second time during exit. 2012-05-08 Teresa Johnson <tejohnson@google.com> * libgcc/libgcov.c (gcov_clear, __gcov_reset): New functions. (__gcov_dump): Ditto. (gcov_dump_complete): New global variable. (gcov_exit): Export hidden to enable use in L_gcov_dump. (__gcov_flush): Outline functionality now in gcov_clear. * libgcc/Makefile.in (L_gcov_reset, L_gcov_dump): Define. * gcc/gcov-io.h (__gcov_reset, __gcov_dump): Declare. * gcc/doc/gcov.texi: Add note on using __gcov_reset and __gcov_dump. From-SVN: r187297
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/doc/gcov.texi6
-rw-r--r--gcc/gcov-io.h6
3 files changed, 17 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 27072e6..a3f5a8f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2012-05-08 Teresa Johnson <tejohnson@google.com>
+
+ * gcov-io.h (__gcov_reset, __gcov_dump): Declare.
+ * doc/gcov.texi: Add note on using __gcov_reset and __gcov_dump.
+
2012-05-08 Jan Hubicka <jh@suse.cz>
* cgraph.c (cgraph_call_edge_duplication_hooks): Export.
diff --git a/gcc/doc/gcov.texi b/gcc/doc/gcov.texi
index e771f72..7256664 100644
--- a/gcc/doc/gcov.texi
+++ b/gcc/doc/gcov.texi
@@ -538,6 +538,12 @@ now be calculable at compile time in some instances. Because the
coverage of all the uses of the inline function will be shown for the
same source lines, the line counts themselves might seem inconsistent.
+Long-running applications can use the @code{_gcov_reset} and @code{_gcov_dump}
+facilities to restrict profile collection to the program region of
+interest. Calling @code{_gcov_reset(void)} will clear all profile counters
+to zero, and calling @code{_gcov_dump(void)} will cause the profile information
+collected at that point to be dumped to @file{.gcda} output files.
+
@c man end
@node Gcov Data Files
diff --git a/gcc/gcov-io.h b/gcc/gcov-io.h
index b80f706..c15e64b 100644
--- a/gcc/gcov-io.h
+++ b/gcc/gcov-io.h
@@ -458,6 +458,12 @@ extern void __gcov_init (struct gcov_info *) ATTRIBUTE_HIDDEN;
/* Called before fork, to avoid double counting. */
extern void __gcov_flush (void) ATTRIBUTE_HIDDEN;
+/* Function to reset all counters to 0. */
+extern void __gcov_reset (void);
+
+/* Function to enable early write of profile information so far. */
+extern void __gcov_dump (void);
+
/* The merge function that just sums the counters. */
extern void __gcov_merge_add (gcov_type *, unsigned) ATTRIBUTE_HIDDEN;