aboutsummaryrefslogtreecommitdiff
path: root/libgcc/libgcov-profiler.c
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2019-06-07 08:41:58 +0200
committerMartin Liska <marxin@gcc.gnu.org>2019-06-07 06:41:58 +0000
commite37333bad7b7df7fd9d2e5165f61c2a68b57a30d (patch)
tree11122c7c389797b0e1f14c47c37b5607faff8a47 /libgcc/libgcov-profiler.c
parentcc261f66c268107b120add99942d729b3a489452 (diff)
downloadgcc-e37333bad7b7df7fd9d2e5165f61c2a68b57a30d.zip
gcc-e37333bad7b7df7fd9d2e5165f61c2a68b57a30d.tar.gz
gcc-e37333bad7b7df7fd9d2e5165f61c2a68b57a30d.tar.bz2
Remove indirect call top N counter type.
2019-06-07 Martin Liska <mliska@suse.cz> * doc/invoke.texi: Remove param. * gcov-counter.def (GCOV_COUNTER_ICALL_TOPNV): Remove. * gcov-io.h (GCOV_ICALL_TOPN_VAL): Likewise. (GCOV_ICALL_TOPN_NCOUNTS): Likewise. * params.def (PARAM_INDIR_CALL_TOPN_PROFILE): Likewise. * profile.c (instrument_values): Remove HIST_TYPE_INDIR_CALL_TOPN. * tree-profile.c (init_ic_make_global_vars): Always build __gcov_indirect_call only. (gimple_init_gcov_profiler): Remove usage of PARAM_INDIR_CALL_TOPN_PROFILE. (gimple_gen_ic_profiler): Likewise. * value-prof.c (dump_histogram_value): Likewise. (stream_in_histogram_value): Likewise. (gimple_indirect_call_to_profile): Likewise. (gimple_find_values_to_profile): Likewise. * value-prof.h (enum hist_type): Likewise. 2019-06-07 Martin Liska <mliska@suse.cz> * Makefile.in: Remove usage of _gcov_merge_icall_topn. * libgcov-driver.c (gcov_sort_n_vals): Remove. (gcov_sort_icall_topn_counter): Likewise. (gcov_sort_topn_counter_arrays): Likewise. (dump_one_gcov): Remove call to gcov_sort_topn_counter_arrays. * libgcov-merge.c (__gcov_merge_icall_topn): Remove. * libgcov-profiler.c (__gcov_topn_value_profiler_body): Likewise. (GCOV_ICALL_COUNTER_CLEAR_THRESHOLD): Remove. (struct indirect_call_tuple): Remove. (__gcov_indirect_call_topn_profiler): Remove. * libgcov-util.c (__gcov_icall_topn_counter_op): Remove. * libgcov.h (gcov_sort_n_vals): Remove. (L_gcov_merge_icall_topn): Likewise. (__gcov_merge_icall_topn): Likewise. (__gcov_indirect_call_topn_profiler): Likewise. From-SVN: r272030
Diffstat (limited to 'libgcc/libgcov-profiler.c')
-rw-r--r--libgcc/libgcov-profiler.c133
1 files changed, 0 insertions, 133 deletions
diff --git a/libgcc/libgcov-profiler.c b/libgcc/libgcov-profiler.c
index 7116330..40f0858 100644
--- a/libgcc/libgcov-profiler.c
+++ b/libgcc/libgcov-profiler.c
@@ -163,139 +163,6 @@ __gcov_one_value_profiler_atomic (gcov_type *counters, gcov_type value)
}
#endif
-#ifdef L_gcov_indirect_call_topn_profiler
-/* Tries to keep track the most frequent N values in the counters where
- N is specified by parameter TOPN_VAL. To track top N values, 2*N counter
- entries are used.
- counter[0] --- the accumative count of the number of times one entry in
- in the counters gets evicted/replaced due to limited capacity.
- When this value reaches a threshold, the bottom N values are
- cleared.
- counter[1] through counter[2*N] records the top 2*N values collected so far.
- Each value is represented by two entries: count[2*i+1] is the ith value, and
- count[2*i+2] is the number of times the value is seen. */
-
-static void
-__gcov_topn_value_profiler_body (gcov_type *counters, gcov_type value)
-{
- unsigned i, found = 0, have_zero_count = 0;
- gcov_type *entry;
- gcov_type *lfu_entry = &counters[1];
- gcov_type *value_array = &counters[1];
- gcov_type *num_eviction = &counters[0];
- gcov_unsigned_t topn_val = GCOV_ICALL_TOPN_VAL;
-
- /* There are 2*topn_val values tracked, each value takes two slots in the
- counter array. */
- for (i = 0; i < (topn_val << 2); i += 2)
- {
- entry = &value_array[i];
- if (entry[0] == value)
- {
- entry[1]++ ;
- found = 1;
- break;
- }
- else if (entry[1] == 0)
- {
- lfu_entry = entry;
- have_zero_count = 1;
- }
- else if (entry[1] < lfu_entry[1])
- lfu_entry = entry;
- }
-
- if (found)
- return;
-
- /* lfu_entry is either an empty entry or an entry
- with lowest count, which will be evicted. */
- lfu_entry[0] = value;
- lfu_entry[1] = 1;
-
-#define GCOV_ICALL_COUNTER_CLEAR_THRESHOLD 3000
-
- /* Too many evictions -- time to clear bottom entries to
- avoid hot values bumping each other out. */
- if (!have_zero_count
- && ++*num_eviction >= GCOV_ICALL_COUNTER_CLEAR_THRESHOLD)
- {
- unsigned i, j;
- gcov_type *p, minv;
- gcov_type* tmp_cnts
- = (gcov_type *)alloca (topn_val * sizeof (gcov_type));
-
- *num_eviction = 0;
-
- for (i = 0; i < topn_val; i++)
- tmp_cnts[i] = 0;
-
- /* Find the largest topn_val values from the group of
- 2*topn_val values and put them into tmp_cnts. */
-
- for (i = 0; i < 2 * topn_val; i += 2)
- {
- p = 0;
- for (j = 0; j < topn_val; j++)
- {
- if (!p || tmp_cnts[j] < *p)
- p = &tmp_cnts[j];
- }
- if (value_array[i + 1] > *p)
- *p = value_array[i + 1];
- }
-
- minv = tmp_cnts[0];
- for (j = 1; j < topn_val; j++)
- {
- if (tmp_cnts[j] < minv)
- minv = tmp_cnts[j];
- }
- /* Zero out low value entries. */
- for (i = 0; i < 2 * topn_val; i += 2)
- {
- if (value_array[i + 1] < minv)
- {
- value_array[i] = 0;
- value_array[i + 1] = 0;
- }
- }
- }
-}
-
-/* These two variables are used to actually track caller and callee. Keep
- them in TLS memory so races are not common (they are written to often).
- The variables are set directly by GCC instrumented code, so declaration
- here must match one in tree-profile.c. */
-
-#if defined(HAVE_CC_TLS) && !defined (USE_EMUTLS)
-__thread
-#endif
-struct indirect_call_tuple __gcov_indirect_call_topn;
-
-#ifdef TARGET_VTABLE_USES_DESCRIPTORS
-#define VTABLE_USES_DESCRIPTORS 1
-#else
-#define VTABLE_USES_DESCRIPTORS 0
-#endif
-
-/* This fucntion is instrumented at function entry to track topn indirect
- calls to CUR_FUNC. */
-
-void
-__gcov_indirect_call_topn_profiler (gcov_type value, void* cur_func)
-{
- void *callee_func = __gcov_indirect_call_topn.callee;
- /* If the C++ virtual tables contain function descriptors then one
- function may have multiple descriptors and we need to dereference
- the descriptors to see if they point to the same function. */
- if (cur_func == callee_func
- || (VTABLE_USES_DESCRIPTORS && callee_func
- && *(void **) cur_func == *(void **) callee_func))
- __gcov_topn_value_profiler_body (__gcov_indirect_call_topn.counters, value);
-}
-#endif
-
#ifdef L_gcov_indirect_call_profiler_v3
/* These two variables are used to actually track caller and callee. Keep