summaryrefslogtreecommitdiff
path: root/gcc/gcov-io.h
diff options
context:
space:
mode:
authorxur <xur@138bc75d-0d04-0410-961f-82ee72b054a4>2014-07-11 05:48:07 +0000
committerxur <xur@138bc75d-0d04-0410-961f-82ee72b054a4>2014-07-11 05:48:07 +0000
commite76f60400d1f609c364ef4545a2b375546dd100e (patch)
tree99edf70eadd9518774cdee53c167eb9d38580232 /gcc/gcov-io.h
parent8cadac0f1da9af1d51714a7e06c9335ce806d989 (diff)
downloadgcc-e76f60400d1f609c364ef4545a2b375546dd100e.tar.gz
2014-07-10 Rong Xu <xur@google.com>
Add gcov-tool: an offline gcda profile processing tool Support. * gcc/gcov-io.c (gcov_position): Make avaialble to gcov-tool. (gcov_is_error): Ditto. (gcov_read_string): Ditto. (gcov_read_sync): Ditto. * gcc/gcov-io.h: Move counter defines to gcov-counter.def. * gcc/gcov-dump.c (tag_counters): Use gcov-counter.def. * gcc/coverage.c: Ditto. * gcc/gcov-tool.c: Offline gcda profile processing tool. (unlink_gcda_file): Remove one gcda file. (unlink_profile_dir): Remove gcda files from the profile path. (gcov_output_files): Output gcda files to an output dir. (profile_merge): Merge two profiles in directory. (print_merge_usage_message): Print merge usage. (merge_usage): Print merge usage and exit. (do_merge): Driver for profile merge sub-command. (profile_rewrite): Rewrite profile. (print_rewrite_usage_message): Print rewrite usage. (rewrite_usage): Print rewrite usage and exit. (do_rewrite): Driver for profile rewrite sub-command. (print_usage): Print gcov-info usage and exit. (print_version): Print gcov-info version. (process_args): Process arguments. (main): Main routine for gcov-tool. * gcc/Makefile.in: Build and install gcov-tool. * gcc/gcov-counter.def: New file split from gcov-io.h. * libgcc/libgcov-driver.c (gcov_max_filename): Make available to gcov-tool. * libgcc/libgcov-merge.c (__gcov_merge_add): Replace gcov_read_counter() with a Macro. (__gcov_merge_ior): Ditto. (__gcov_merge_time_profile): Ditto. (__gcov_merge_single): Ditto. (__gcov_merge_delta): Ditto. * libgcc/libgcov-util.c (void gcov_set_verbose): Set the verbose flag in the utility functions. (set_fn_ctrs): Utility function for reading gcda files to in-memory gcov_list object link lists. (tag_function): Ditto. (tag_blocks): Ditto. (tag_arcs): Ditto. (tag_lines): Ditto. (tag_counters): Ditto. (tag_summary): Ditto. (read_gcda_finalize): Ditto. (read_gcda_file): Ditto. (ftw_read_file): Ditto. (read_profile_dir_init): Ditto. (gcov_read_profile_dir): Ditto. (gcov_read_counter_mem): Ditto. (gcov_get_merge_weight): Ditto. (merge_wrapper): A wrapper function that calls merging handler. (gcov_merge): Merge two gcov_info objects with weights. (find_match_gcov_info): Find the matched gcov_info in the list. (gcov_profile_merge): Merge two gcov_info object lists. (__gcov_add_counter_op): Process edge profile counter values. (__gcov_ior_counter_op): Process IOR profile counter values. (__gcov_delta_counter_op): Process delta profile counter values. (__gcov_single_counter_op): Process single profile counter values. (fp_scale): Callback function for float-point scaling. (int_scale): Callback function for integer fraction scaling. (gcov_profile_scale): Scaling profile counters. (gcov_profile_normalize): Normalize profile counters. * libgcc/libgcov.h: Add headers and functions for gcov-tool use. (gcov_get_counter): New. (gcov_get_counter_target): Ditto. (struct gcov_info): Make the functions field mutable in gcov-tool compilation. * gcc/doc/gcc.texi: Include gcov-tool.texi. * gcc/doc/gcov-tool.texi: Document for gcov-tool. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@212448 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gcov-io.h')
-rw-r--r--gcc/gcov-io.h57
1 files changed, 18 insertions, 39 deletions
diff --git a/gcc/gcov-io.h b/gcc/gcov-io.h
index 58884dce94d..16e6c71ad79 100644
--- a/gcc/gcov-io.h
+++ b/gcc/gcov-io.h
@@ -247,50 +247,29 @@ typedef uint64_t gcov_type_unsigned;
/* Counters that are collected. */
-#define GCOV_COUNTER_ARCS 0 /* Arc transitions. */
-#define GCOV_COUNTERS_SUMMABLE 1 /* Counters which can be
- summaried. */
-#define GCOV_FIRST_VALUE_COUNTER 1 /* The first of counters used for value
- profiling. They must form a consecutive
- interval and their order must match
- the order of HIST_TYPEs in
- value-prof.h. */
-#define GCOV_COUNTER_V_INTERVAL 1 /* Histogram of value inside an interval. */
-#define GCOV_COUNTER_V_POW2 2 /* Histogram of exact power2 logarithm
- of a value. */
-#define GCOV_COUNTER_V_SINGLE 3 /* The most common value of expression. */
-#define GCOV_COUNTER_V_DELTA 4 /* The most common difference between
- consecutive values of expression. */
-
-#define GCOV_COUNTER_V_INDIR 5 /* The most common indirect address */
-#define GCOV_COUNTER_AVERAGE 6 /* Compute average value passed to the
- counter. */
-#define GCOV_COUNTER_IOR 7 /* IOR of the all values passed to
- counter. */
-#define GCOV_TIME_PROFILER 8 /* Time profile collecting first run of a function */
-#define GCOV_LAST_VALUE_COUNTER 8 /* The last of counters used for value
- profiling. */
-#define GCOV_COUNTERS 9
+
+#define DEF_GCOV_COUNTER(COUNTER, NAME, MERGE_FN) COUNTER,
+enum {
+#include "gcov-counter.def"
+GCOV_COUNTERS
+};
+#undef DEF_GCOV_COUNTER
+
+/* Counters which can be summaried. */
+#define GCOV_COUNTERS_SUMMABLE (GCOV_COUNTER_ARCS + 1)
+
+/* The first of counters used for value profiling. They must form a
+ consecutive interval and their order must match the order of
+ HIST_TYPEs in value-prof.h. */
+#define GCOV_FIRST_VALUE_COUNTER GCOV_COUNTERS_SUMMABLE
+
+/* The last of counters used for value profiling. */
+#define GCOV_LAST_VALUE_COUNTER (GCOV_COUNTERS - 1)
/* Number of counters used for value profiling. */
#define GCOV_N_VALUE_COUNTERS \
(GCOV_LAST_VALUE_COUNTER - GCOV_FIRST_VALUE_COUNTER + 1)
- /* A list of human readable names of the counters */
-#define GCOV_COUNTER_NAMES {"arcs", "interval", "pow2", "single", \
- "delta", "indirect_call", "average", "ior", "time_profiler"}
-
- /* Names of merge functions for counters. */
-#define GCOV_MERGE_FUNCTIONS {"__gcov_merge_add", \
- "__gcov_merge_add", \
- "__gcov_merge_add", \
- "__gcov_merge_single", \
- "__gcov_merge_delta", \
- "__gcov_merge_single", \
- "__gcov_merge_add", \
- "__gcov_merge_ior", \
- "__gcov_merge_time_profile" }
-
/* Convert a counter index to a tag. */
#define GCOV_TAG_FOR_COUNTER(COUNT) \
(GCOV_TAG_COUNTER_BASE + ((gcov_unsigned_t)(COUNT) << 17))