Commit 7f3577f5 by Martin Liska Committed by Martin Liska

Simplify gcov_histogram as it's used only for ARCS counters.

2018-06-05  Martin Liska  <mliska@suse.cz>

	* auto-profile.c (read_autofdo_file): Do not use
	gcov_ctr_summary struct.
	(afdo_callsite_hot_enough_for_early_inline): Likewise.
	* coverage.c (struct counts_entry): Likewise.
	(read_counts_file): Read just single summary entry.
	(get_coverage_counts): Use gcov_summary struct.
	* coverage.h (get_coverage_counts): Likewise.
	* gcov-dump.c (dump_working_sets): Likewise.
	(tag_summary): Dump just single summary.
	* gcov-io.c (gcov_write_summary): Write just histogram
	summary.
	(gcov_read_summary): Read just single summary.
	(compute_working_sets): Use gcov_summary struct.
	* gcov-io.h (GCOV_TAG_SUMMARY_LENGTH): Remove usage
	of GCOV_COUNTERS_SUMMABLE.
	(GCOV_COUNTERS_SUMMABLE): Remove.
	(GCOV_FIRST_VALUE_COUNTER): Replace with
	GCOV_COUNTER_V_INTERVAL.
	(struct gcov_ctr_summary): Remove.
	(struct gcov_summary): Directly use fields of former
	gcov_ctr_summary.
	(compute_working_sets): Use gcov_summary struct.
	* gcov.c (read_count_file): Do not use ctrs fields.
	* lto-cgraph.c (merge_profile_summaries): Use gcov_summary
	struct.
	* lto-streamer.h (struct GTY): Make profile_info gcov_summary
	struct.
	* profile.c: Likewise.
	* profile.h: Likewise.
2018-06-05  Martin Liska  <mliska@suse.cz>

	* libgcov-driver.c (gcov_compute_histogram): Remove usage
	of gcov_ctr_summary.
	(compute_summary): Do it just for a single summary.
	(merge_one_data): Likewise.
	(merge_summary): Simplify as we read just single summary.
	(dump_one_gcov): Pass proper argument.
	* libgcov-util.c (compute_one_gcov): Simplify as we have just
	single summary.
	(gcov_info_count_all_cold): Likewise.
	(calculate_overlap): Likewise.

From-SVN: r261189
parent 632b10e1
2018-06-05 Martin Liska <mliska@suse.cz> 2018-06-05 Martin Liska <mliska@suse.cz>
* auto-profile.c (read_autofdo_file): Do not use
gcov_ctr_summary struct.
(afdo_callsite_hot_enough_for_early_inline): Likewise.
* coverage.c (struct counts_entry): Likewise.
(read_counts_file): Read just single summary entry.
(get_coverage_counts): Use gcov_summary struct.
* coverage.h (get_coverage_counts): Likewise.
* gcov-dump.c (dump_working_sets): Likewise.
(tag_summary): Dump just single summary.
* gcov-io.c (gcov_write_summary): Write just histogram
summary.
(gcov_read_summary): Read just single summary.
(compute_working_sets): Use gcov_summary struct.
* gcov-io.h (GCOV_TAG_SUMMARY_LENGTH): Remove usage
of GCOV_COUNTERS_SUMMABLE.
(GCOV_COUNTERS_SUMMABLE): Remove.
(GCOV_FIRST_VALUE_COUNTER): Replace with
GCOV_COUNTER_V_INTERVAL.
(struct gcov_ctr_summary): Remove.
(struct gcov_summary): Directly use fields of former
gcov_ctr_summary.
(compute_working_sets): Use gcov_summary struct.
* gcov.c (read_count_file): Do not use ctrs fields.
* lto-cgraph.c (merge_profile_summaries): Use gcov_summary
struct.
* lto-streamer.h (struct GTY): Make profile_info gcov_summary
struct.
* profile.c: Likewise.
* profile.h: Likewise.
2018-06-05 Martin Liska <mliska@suse.cz>
PR gcov-profile/84846 PR gcov-profile/84846
* gcov.c (output_lines): Print working directory only * gcov.c (output_lines): Print working directory only
in intermediate format. in intermediate format.
......
...@@ -318,8 +318,8 @@ static string_table *afdo_string_table; ...@@ -318,8 +318,8 @@ static string_table *afdo_string_table;
/* Store the AutoFDO source profile. */ /* Store the AutoFDO source profile. */
static autofdo_source_profile *afdo_source_profile; static autofdo_source_profile *afdo_source_profile;
/* gcov_ctr_summary structure to store the profile_info. */ /* gcov_summary structure to store the profile_info. */
static struct gcov_ctr_summary *afdo_profile_info; static gcov_summary *afdo_profile_info;
/* Helper functions. */ /* Helper functions. */
...@@ -1682,8 +1682,7 @@ read_autofdo_file (void) ...@@ -1682,8 +1682,7 @@ read_autofdo_file (void)
if (auto_profile_file == NULL) if (auto_profile_file == NULL)
auto_profile_file = DEFAULT_AUTO_PROFILE_FILE; auto_profile_file = DEFAULT_AUTO_PROFILE_FILE;
autofdo::afdo_profile_info = (struct gcov_ctr_summary *)xcalloc ( autofdo::afdo_profile_info = XNEW (gcov_summary);
1, sizeof (struct gcov_ctr_summary));
autofdo::afdo_profile_info->runs = 1; autofdo::afdo_profile_info->runs = 1;
autofdo::afdo_profile_info->sum_max = 0; autofdo::afdo_profile_info->sum_max = 0;
autofdo::afdo_profile_info->sum_all = 0; autofdo::afdo_profile_info->sum_all = 0;
...@@ -1713,7 +1712,7 @@ afdo_callsite_hot_enough_for_early_inline (struct cgraph_edge *edge) ...@@ -1713,7 +1712,7 @@ afdo_callsite_hot_enough_for_early_inline (struct cgraph_edge *edge)
if (count > 0) if (count > 0)
{ {
bool is_hot; bool is_hot;
const struct gcov_ctr_summary *saved_profile_info = profile_info; const gcov_summary *saved_profile_info = profile_info;
/* At early inline stage, profile_info is not set yet. We need to /* At early inline stage, profile_info is not set yet. We need to
temporarily set it to afdo_profile_info to calculate hotness. */ temporarily set it to afdo_profile_info to calculate hotness. */
profile_info = autofdo::afdo_profile_info; profile_info = autofdo::afdo_profile_info;
......
...@@ -73,7 +73,7 @@ struct counts_entry : pointer_hash <counts_entry> ...@@ -73,7 +73,7 @@ struct counts_entry : pointer_hash <counts_entry>
unsigned lineno_checksum; unsigned lineno_checksum;
unsigned cfg_checksum; unsigned cfg_checksum;
gcov_type *counts; gcov_type *counts;
struct gcov_ctr_summary summary; gcov_summary summary;
/* hash_table support. */ /* hash_table support. */
static inline hashval_t hash (const counts_entry *); static inline hashval_t hash (const counts_entry *);
...@@ -185,7 +185,7 @@ static void ...@@ -185,7 +185,7 @@ static void
read_counts_file (void) read_counts_file (void)
{ {
gcov_unsigned_t fn_ident = 0; gcov_unsigned_t fn_ident = 0;
struct gcov_summary summary; gcov_summary summary;
unsigned new_summary = 1; unsigned new_summary = 1;
gcov_unsigned_t tag; gcov_unsigned_t tag;
int is_error = 0; int is_error = 0;
...@@ -241,27 +241,21 @@ read_counts_file (void) ...@@ -241,27 +241,21 @@ read_counts_file (void)
else if (tag == GCOV_TAG_PROGRAM_SUMMARY) else if (tag == GCOV_TAG_PROGRAM_SUMMARY)
{ {
struct gcov_summary sum; struct gcov_summary sum;
unsigned ix;
if (new_summary) if (new_summary)
memset (&summary, 0, sizeof (summary)); memset (&summary, 0, sizeof (summary));
gcov_read_summary (&sum); gcov_read_summary (&sum);
for (ix = 0; ix != GCOV_COUNTERS_SUMMABLE; ix++) summary.runs += sum.runs;
{ summary.sum_all += sum.sum_all;
summary.ctrs[ix].runs += sum.ctrs[ix].runs; if (summary.run_max < sum.run_max)
summary.ctrs[ix].sum_all += sum.ctrs[ix].sum_all; summary.run_max = sum.run_max;
if (summary.ctrs[ix].run_max < sum.ctrs[ix].run_max) summary.sum_max += sum.sum_max;
summary.ctrs[ix].run_max = sum.ctrs[ix].run_max;
summary.ctrs[ix].sum_max += sum.ctrs[ix].sum_max;
}
if (new_summary) if (new_summary)
memcpy (summary.ctrs[GCOV_COUNTER_ARCS].histogram, memcpy (summary.histogram, sum.histogram,
sum.ctrs[GCOV_COUNTER_ARCS].histogram,
sizeof (gcov_bucket_type) * GCOV_HISTOGRAM_SIZE); sizeof (gcov_bucket_type) * GCOV_HISTOGRAM_SIZE);
else else
gcov_histogram_merge (summary.ctrs[GCOV_COUNTER_ARCS].histogram, gcov_histogram_merge (summary.histogram, sum.histogram);
sum.ctrs[GCOV_COUNTER_ARCS].histogram);
new_summary = 0; new_summary = 0;
} }
else if (GCOV_TAG_IS_COUNTER (tag) && fn_ident) else if (GCOV_TAG_IS_COUNTER (tag) && fn_ident)
...@@ -282,8 +276,8 @@ read_counts_file (void) ...@@ -282,8 +276,8 @@ read_counts_file (void)
entry->ctr = elt.ctr; entry->ctr = elt.ctr;
entry->lineno_checksum = lineno_checksum; entry->lineno_checksum = lineno_checksum;
entry->cfg_checksum = cfg_checksum; entry->cfg_checksum = cfg_checksum;
if (elt.ctr < GCOV_COUNTERS_SUMMABLE) if (elt.ctr == GCOV_COUNTER_ARCS)
entry->summary = summary.ctrs[elt.ctr]; entry->summary = summary;
entry->summary.num = n_counts; entry->summary.num = n_counts;
entry->counts = XCNEWVEC (gcov_type, n_counts); entry->counts = XCNEWVEC (gcov_type, n_counts);
} }
...@@ -306,23 +300,16 @@ read_counts_file (void) ...@@ -306,23 +300,16 @@ read_counts_file (void)
counts_hash = NULL; counts_hash = NULL;
break; break;
} }
else if (elt.ctr >= GCOV_COUNTERS_SUMMABLE)
{
error ("cannot merge separate %s counters for function %u",
ctr_names[elt.ctr], fn_ident);
goto skip_merge;
}
else else
{ {
entry->summary.runs += summary.ctrs[elt.ctr].runs; entry->summary.runs += summary.runs;
entry->summary.sum_all += summary.ctrs[elt.ctr].sum_all; entry->summary.sum_all += summary.sum_all;
if (entry->summary.run_max < summary.ctrs[elt.ctr].run_max) if (entry->summary.run_max < summary.run_max)
entry->summary.run_max = summary.ctrs[elt.ctr].run_max; entry->summary.run_max = summary.run_max;
entry->summary.sum_max += summary.ctrs[elt.ctr].sum_max; entry->summary.sum_max += summary.sum_max;
} }
for (ix = 0; ix != n_counts; ix++) for (ix = 0; ix != n_counts; ix++)
entry->counts[ix] += gcov_read_counter (); entry->counts[ix] += gcov_read_counter ();
skip_merge:;
} }
gcov_sync (offset, length); gcov_sync (offset, length);
if ((is_error = gcov_is_error ())) if ((is_error = gcov_is_error ()))
...@@ -345,7 +332,7 @@ read_counts_file (void) ...@@ -345,7 +332,7 @@ read_counts_file (void)
gcov_type * gcov_type *
get_coverage_counts (unsigned counter, unsigned expected, get_coverage_counts (unsigned counter, unsigned expected,
unsigned cfg_checksum, unsigned lineno_checksum, unsigned cfg_checksum, unsigned lineno_checksum,
const struct gcov_ctr_summary **summary) const gcov_summary **summary)
{ {
counts_entry *entry, elt; counts_entry *entry, elt;
......
...@@ -54,7 +54,7 @@ extern gcov_type *get_coverage_counts (unsigned /*counter*/, ...@@ -54,7 +54,7 @@ extern gcov_type *get_coverage_counts (unsigned /*counter*/,
unsigned /*expected*/, unsigned /*expected*/,
unsigned /*cfg_checksum*/, unsigned /*cfg_checksum*/,
unsigned /*lineno_checksum*/, unsigned /*lineno_checksum*/,
const struct gcov_ctr_summary **); const gcov_summary **);
extern tree get_gcov_type (void); extern tree get_gcov_type (void);
extern bool coverage_node_map_initialized_p (void); extern bool coverage_node_map_initialized_p (void);
......
...@@ -39,7 +39,7 @@ static void tag_lines (const char *, unsigned, unsigned, unsigned); ...@@ -39,7 +39,7 @@ static void tag_lines (const char *, unsigned, unsigned, unsigned);
static void tag_counters (const char *, unsigned, unsigned, unsigned); static void tag_counters (const char *, unsigned, unsigned, unsigned);
static void tag_summary (const char *, unsigned, unsigned, unsigned); static void tag_summary (const char *, unsigned, unsigned, unsigned);
static void dump_working_sets (const char *filename ATTRIBUTE_UNUSED, static void dump_working_sets (const char *filename ATTRIBUTE_UNUSED,
const struct gcov_ctr_summary *summary, const gcov_summary *summary,
unsigned depth); unsigned depth);
extern int main (int, char **); extern int main (int, char **);
...@@ -467,34 +467,30 @@ tag_summary (const char *filename ATTRIBUTE_UNUSED, ...@@ -467,34 +467,30 @@ tag_summary (const char *filename ATTRIBUTE_UNUSED,
unsigned tag ATTRIBUTE_UNUSED, unsigned length ATTRIBUTE_UNUSED, unsigned tag ATTRIBUTE_UNUSED, unsigned length ATTRIBUTE_UNUSED,
unsigned depth) unsigned depth)
{ {
struct gcov_summary summary; gcov_summary summary;
unsigned ix, h_ix; unsigned h_ix;
gcov_bucket_type *histo_bucket; gcov_bucket_type *histo_bucket;
gcov_read_summary (&summary); gcov_read_summary (&summary);
printf (" checksum=0x%08x", summary.checksum); printf (" checksum=0x%08x", summary.checksum);
for (ix = 0; ix != GCOV_COUNTERS_SUMMABLE; ix++)
{
printf ("\n"); printf ("\n");
print_prefix (filename, depth, 0); print_prefix (filename, depth, 0);
printf (VALUE_PADDING_PREFIX "counts=%u, runs=%u", printf (VALUE_PADDING_PREFIX "counts=%u, runs=%u",
summary.ctrs[ix].num, summary.ctrs[ix].runs); summary.num, summary.runs);
printf (", sum_all=%" PRId64, printf (", sum_all=%" PRId64,
(int64_t)summary.ctrs[ix].sum_all); (int64_t)summary.sum_all);
printf (", run_max=%" PRId64, printf (", run_max=%" PRId64,
(int64_t)summary.ctrs[ix].run_max); (int64_t)summary.run_max);
printf (", sum_max=%" PRId64, printf (", sum_max=%" PRId64,
(int64_t)summary.ctrs[ix].sum_max); (int64_t)summary.sum_max);
if (ix != GCOV_COUNTER_ARCS)
continue;
printf ("\n"); printf ("\n");
print_prefix (filename, depth, 0); print_prefix (filename, depth, 0);
printf (VALUE_PADDING_PREFIX "counter histogram:"); printf (VALUE_PADDING_PREFIX "counter histogram:");
for (h_ix = 0; h_ix < GCOV_HISTOGRAM_SIZE; h_ix++) for (h_ix = 0; h_ix < GCOV_HISTOGRAM_SIZE; h_ix++)
{ {
histo_bucket = &summary.ctrs[ix].histogram[h_ix]; histo_bucket = &summary.histogram[h_ix];
if (!histo_bucket->num_counters) if (!histo_bucket->num_counters)
continue; continue;
printf ("\n"); printf ("\n");
...@@ -506,13 +502,12 @@ tag_summary (const char *filename ATTRIBUTE_UNUSED, ...@@ -506,13 +502,12 @@ tag_summary (const char *filename ATTRIBUTE_UNUSED,
(int64_t)histo_bucket->cum_value); (int64_t)histo_bucket->cum_value);
} }
if (flag_dump_working_sets) if (flag_dump_working_sets)
dump_working_sets (filename, &summary.ctrs[ix], depth); dump_working_sets (filename, &summary, depth);
}
} }
static void static void
dump_working_sets (const char *filename ATTRIBUTE_UNUSED, dump_working_sets (const char *filename ATTRIBUTE_UNUSED,
const struct gcov_ctr_summary *summary, const gcov_summary *summary,
unsigned depth) unsigned depth)
{ {
gcov_working_set_t gcov_working_sets[NUM_GCOV_WORKING_SETS]; gcov_working_set_t gcov_working_sets[NUM_GCOV_WORKING_SETS];
......
...@@ -446,8 +446,7 @@ gcov_write_tag_length (gcov_unsigned_t tag, gcov_unsigned_t length) ...@@ -446,8 +446,7 @@ gcov_write_tag_length (gcov_unsigned_t tag, gcov_unsigned_t length)
GCOV_LINKAGE void GCOV_LINKAGE void
gcov_write_summary (gcov_unsigned_t tag, const struct gcov_summary *summary) gcov_write_summary (gcov_unsigned_t tag, const struct gcov_summary *summary)
{ {
unsigned ix, h_ix, bv_ix, h_cnt = 0; unsigned h_ix, bv_ix, h_cnt = 0;
const struct gcov_ctr_summary *csum;
unsigned histo_bitvector[GCOV_HISTOGRAM_BITVECTOR_SIZE]; unsigned histo_bitvector[GCOV_HISTOGRAM_BITVECTOR_SIZE];
/* Count number of non-zero histogram entries, and fill in a bit vector /* Count number of non-zero histogram entries, and fill in a bit vector
...@@ -455,38 +454,29 @@ gcov_write_summary (gcov_unsigned_t tag, const struct gcov_summary *summary) ...@@ -455,38 +454,29 @@ gcov_write_summary (gcov_unsigned_t tag, const struct gcov_summary *summary)
counters. */ counters. */
for (bv_ix = 0; bv_ix < GCOV_HISTOGRAM_BITVECTOR_SIZE; bv_ix++) for (bv_ix = 0; bv_ix < GCOV_HISTOGRAM_BITVECTOR_SIZE; bv_ix++)
histo_bitvector[bv_ix] = 0; histo_bitvector[bv_ix] = 0;
csum = &summary->ctrs[GCOV_COUNTER_ARCS];
for (h_ix = 0; h_ix < GCOV_HISTOGRAM_SIZE; h_ix++) for (h_ix = 0; h_ix < GCOV_HISTOGRAM_SIZE; h_ix++)
if (csum->histogram[h_ix].num_counters) if (summary->histogram[h_ix].num_counters)
{ {
histo_bitvector[h_ix / 32] |= 1 << (h_ix % 32); histo_bitvector[h_ix / 32] |= 1 << (h_ix % 32);
h_cnt++; h_cnt++;
} }
gcov_write_tag_length (tag, GCOV_TAG_SUMMARY_LENGTH (h_cnt)); gcov_write_tag_length (tag, GCOV_TAG_SUMMARY_LENGTH (h_cnt));
gcov_write_unsigned (summary->checksum); gcov_write_unsigned (summary->checksum);
for (csum = summary->ctrs, ix = GCOV_COUNTERS_SUMMABLE; ix--; csum++)
{ gcov_write_unsigned (summary->num);
gcov_write_unsigned (csum->num); gcov_write_unsigned (summary->runs);
gcov_write_unsigned (csum->runs); gcov_write_counter (summary->sum_all);
gcov_write_counter (csum->sum_all); gcov_write_counter (summary->run_max);
gcov_write_counter (csum->run_max); gcov_write_counter (summary->sum_max);
gcov_write_counter (csum->sum_max);
if (ix != GCOV_COUNTER_ARCS)
{
for (bv_ix = 0; bv_ix < GCOV_HISTOGRAM_BITVECTOR_SIZE; bv_ix++)
gcov_write_unsigned (0);
continue;
}
for (bv_ix = 0; bv_ix < GCOV_HISTOGRAM_BITVECTOR_SIZE; bv_ix++) for (bv_ix = 0; bv_ix < GCOV_HISTOGRAM_BITVECTOR_SIZE; bv_ix++)
gcov_write_unsigned (histo_bitvector[bv_ix]); gcov_write_unsigned (histo_bitvector[bv_ix]);
for (h_ix = 0; h_ix < GCOV_HISTOGRAM_SIZE; h_ix++) for (h_ix = 0; h_ix < GCOV_HISTOGRAM_SIZE; h_ix++)
{ {
if (!csum->histogram[h_ix].num_counters) if (!summary->histogram[h_ix].num_counters)
continue; continue;
gcov_write_unsigned (csum->histogram[h_ix].num_counters); gcov_write_unsigned (summary->histogram[h_ix].num_counters);
gcov_write_counter (csum->histogram[h_ix].min_value); gcov_write_counter (summary->histogram[h_ix].min_value);
gcov_write_counter (csum->histogram[h_ix].cum_value); gcov_write_counter (summary->histogram[h_ix].cum_value);
}
} }
} }
#endif /* IN_LIBGCOV */ #endif /* IN_LIBGCOV */
...@@ -598,20 +588,17 @@ gcov_read_string (void) ...@@ -598,20 +588,17 @@ gcov_read_string (void)
GCOV_LINKAGE void GCOV_LINKAGE void
gcov_read_summary (struct gcov_summary *summary) gcov_read_summary (struct gcov_summary *summary)
{ {
unsigned ix, h_ix, bv_ix, h_cnt = 0; unsigned h_ix, bv_ix, h_cnt = 0;
struct gcov_ctr_summary *csum;
unsigned histo_bitvector[GCOV_HISTOGRAM_BITVECTOR_SIZE]; unsigned histo_bitvector[GCOV_HISTOGRAM_BITVECTOR_SIZE];
unsigned cur_bitvector; unsigned cur_bitvector;
summary->checksum = gcov_read_unsigned (); summary->checksum = gcov_read_unsigned ();
for (csum = summary->ctrs, ix = GCOV_COUNTERS_SUMMABLE; ix--; csum++) summary->num = gcov_read_unsigned ();
{ summary->runs = gcov_read_unsigned ();
csum->num = gcov_read_unsigned (); summary->sum_all = gcov_read_counter ();
csum->runs = gcov_read_unsigned (); summary->run_max = gcov_read_counter ();
csum->sum_all = gcov_read_counter (); summary->sum_max = gcov_read_counter ();
csum->run_max = gcov_read_counter (); memset (summary->histogram, 0,
csum->sum_max = gcov_read_counter ();
memset (csum->histogram, 0,
sizeof (gcov_bucket_type) * GCOV_HISTOGRAM_SIZE); sizeof (gcov_bucket_type) * GCOV_HISTOGRAM_SIZE);
for (bv_ix = 0; bv_ix < GCOV_HISTOGRAM_BITVECTOR_SIZE; bv_ix++) for (bv_ix = 0; bv_ix < GCOV_HISTOGRAM_BITVECTOR_SIZE; bv_ix++)
{ {
...@@ -652,15 +639,14 @@ gcov_read_summary (struct gcov_summary *summary) ...@@ -652,15 +639,14 @@ gcov_read_summary (struct gcov_summary *summary)
gcov_error ("corrupted profile info: summary histogram " gcov_error ("corrupted profile info: summary histogram "
"index is corrupt"); "index is corrupt");
csum->histogram[h_ix].num_counters = gcov_read_unsigned (); summary->histogram[h_ix].num_counters = gcov_read_unsigned ();
csum->histogram[h_ix].min_value = gcov_read_counter (); summary->histogram[h_ix].min_value = gcov_read_counter ();
csum->histogram[h_ix].cum_value = gcov_read_counter (); summary->histogram[h_ix].cum_value = gcov_read_counter ();
/* Shift off the index we are done with and increment to the /* Shift off the index we are done with and increment to the
corresponding next histogram entry. */ corresponding next histogram entry. */
cur_bitvector >>= 1; cur_bitvector >>= 1;
h_ix++; h_ix++;
} }
}
} }
/* We need to expose the below function when compiling for gcov-tool. */ /* We need to expose the below function when compiling for gcov-tool. */
...@@ -921,7 +907,7 @@ static void gcov_histogram_merge (gcov_bucket_type *tgt_histo, ...@@ -921,7 +907,7 @@ static void gcov_histogram_merge (gcov_bucket_type *tgt_histo,
the minimum counter value in that working set. */ the minimum counter value in that working set. */
GCOV_LINKAGE void GCOV_LINKAGE void
compute_working_sets (const struct gcov_ctr_summary *summary, compute_working_sets (const gcov_summary *summary,
gcov_working_set_t *gcov_working_sets) gcov_working_set_t *gcov_working_sets)
{ {
gcov_type working_set_cum_values[NUM_GCOV_WORKING_SETS]; gcov_type working_set_cum_values[NUM_GCOV_WORKING_SETS];
......
...@@ -140,8 +140,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see ...@@ -140,8 +140,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
int32:lineno_checksum int32:cfg_checksum int32:lineno_checksum int32:cfg_checksum
present: header int32:present present: header int32:present
counts: header int64:count* counts: header int64:count*
summary: int32:checksum {count-summary}GCOV_COUNTERS_SUMMABLE summary: int32:checksum int32:num int32:runs int64:sum
count-summary: int32:num int32:runs int64:sum
int64:max int64:sum_max histogram int64:max int64:sum_max histogram
histogram: {int32:bitvector}8 histogram-buckets* histogram: {int32:bitvector}8 histogram-buckets*
histogram-buckets: int32:num int64:min int64:sum histogram-buckets: int32:num int64:min int64:sum
...@@ -243,8 +242,7 @@ typedef uint64_t gcov_type_unsigned; ...@@ -243,8 +242,7 @@ typedef uint64_t gcov_type_unsigned;
#define GCOV_TAG_COUNTER_NUM(LENGTH) ((LENGTH) / 2) #define GCOV_TAG_COUNTER_NUM(LENGTH) ((LENGTH) / 2)
#define GCOV_TAG_OBJECT_SUMMARY ((gcov_unsigned_t)0xa1000000) /* Obsolete */ #define GCOV_TAG_OBJECT_SUMMARY ((gcov_unsigned_t)0xa1000000) /* Obsolete */
#define GCOV_TAG_PROGRAM_SUMMARY ((gcov_unsigned_t)0xa3000000) #define GCOV_TAG_PROGRAM_SUMMARY ((gcov_unsigned_t)0xa3000000)
#define GCOV_TAG_SUMMARY_LENGTH(NUM) \ #define GCOV_TAG_SUMMARY_LENGTH(NUM) (1 + (10 + 3 * 2) + (NUM) * 5)
(1 + GCOV_COUNTERS_SUMMABLE * (10 + 3 * 2) + (NUM) * 5)
#define GCOV_TAG_AFDO_FILE_NAMES ((gcov_unsigned_t)0xaa000000) #define GCOV_TAG_AFDO_FILE_NAMES ((gcov_unsigned_t)0xaa000000)
#define GCOV_TAG_AFDO_FUNCTION ((gcov_unsigned_t)0xac000000) #define GCOV_TAG_AFDO_FUNCTION ((gcov_unsigned_t)0xac000000)
#define GCOV_TAG_AFDO_WORKING_SET ((gcov_unsigned_t)0xaf000000) #define GCOV_TAG_AFDO_WORKING_SET ((gcov_unsigned_t)0xaf000000)
...@@ -259,13 +257,10 @@ GCOV_COUNTERS ...@@ -259,13 +257,10 @@ GCOV_COUNTERS
}; };
#undef DEF_GCOV_COUNTER #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 /* The first of counters used for value profiling. They must form a
consecutive interval and their order must match the order of consecutive interval and their order must match the order of
HIST_TYPEs in value-prof.h. */ HIST_TYPEs in value-prof.h. */
#define GCOV_FIRST_VALUE_COUNTER GCOV_COUNTERS_SUMMABLE #define GCOV_FIRST_VALUE_COUNTER GCOV_COUNTER_V_INTERVAL
/* The last of counters used for value profiling. */ /* The last of counters used for value profiling. */
#define GCOV_LAST_VALUE_COUNTER (GCOV_COUNTERS - 1) #define GCOV_LAST_VALUE_COUNTER (GCOV_COUNTERS - 1)
...@@ -337,23 +332,18 @@ typedef struct ...@@ -337,23 +332,18 @@ typedef struct
This is essentially a ceiling divide by 32 bits. */ This is essentially a ceiling divide by 32 bits. */
#define GCOV_HISTOGRAM_BITVECTOR_SIZE (GCOV_HISTOGRAM_SIZE + 31) / 32 #define GCOV_HISTOGRAM_BITVECTOR_SIZE (GCOV_HISTOGRAM_SIZE + 31) / 32
/* Cumulative counter data. */
struct gcov_ctr_summary
{
gcov_unsigned_t num; /* number of counters. */
gcov_unsigned_t runs; /* number of program runs */
gcov_type sum_all; /* sum of all counters accumulated. */
gcov_type run_max; /* maximum value on a single run. */
gcov_type sum_max; /* sum of individual run max values. */
gcov_bucket_type histogram[GCOV_HISTOGRAM_SIZE]; /* histogram of
counter values. */
};
/* Object & program summary record. */ /* Object & program summary record. */
struct gcov_summary struct gcov_summary
{ {
gcov_unsigned_t checksum; /* checksum of program */ gcov_unsigned_t checksum; /* Checksum of program. */
struct gcov_ctr_summary ctrs[GCOV_COUNTERS_SUMMABLE]; gcov_unsigned_t num; /* Number of counters. */
gcov_unsigned_t runs; /* Number of program runs. */
gcov_type sum_all; /* Sum of all counters accumulated. */
gcov_type run_max; /* Maximum value on a single run. */
gcov_type sum_max; /* Sum of individual run max values. */
gcov_bucket_type histogram[GCOV_HISTOGRAM_SIZE]; /* Histogram of
counter values. */
}; };
#if !defined(inhibit_libc) #if !defined(inhibit_libc)
...@@ -414,7 +404,7 @@ typedef struct gcov_working_set_info ...@@ -414,7 +404,7 @@ typedef struct gcov_working_set_info
gcov_type min_counter; gcov_type min_counter;
} gcov_working_set_t; } gcov_working_set_t;
GCOV_LINKAGE void compute_working_sets (const struct gcov_ctr_summary *summary, GCOV_LINKAGE void compute_working_sets (const gcov_summary *summary,
gcov_working_set_t *gcov_working_sets); gcov_working_set_t *gcov_working_sets);
#endif #endif
......
...@@ -1801,7 +1801,7 @@ read_count_file (void) ...@@ -1801,7 +1801,7 @@ read_count_file (void)
{ {
struct gcov_summary summary; struct gcov_summary summary;
gcov_read_summary (&summary); gcov_read_summary (&summary);
object_runs += summary.ctrs[GCOV_COUNTER_ARCS].runs; object_runs += summary.runs;
program_count++; program_count++;
} }
else if (tag == GCOV_TAG_FUNCTION && !length) else if (tag == GCOV_TAG_FUNCTION && !length)
......
...@@ -1657,7 +1657,7 @@ input_refs (struct lto_input_block *ib, ...@@ -1657,7 +1657,7 @@ input_refs (struct lto_input_block *ib,
} }
static struct gcov_ctr_summary lto_gcov_summary; static gcov_summary lto_gcov_summary;
/* Input profile_info from IB. */ /* Input profile_info from IB. */
static void static void
...@@ -1715,7 +1715,7 @@ merge_profile_summaries (struct lto_file_decl_data **file_data_vec) ...@@ -1715,7 +1715,7 @@ merge_profile_summaries (struct lto_file_decl_data **file_data_vec)
struct cgraph_node *node; struct cgraph_node *node;
struct cgraph_edge *edge; struct cgraph_edge *edge;
gcov_type saved_sum_all = 0; gcov_type saved_sum_all = 0;
gcov_ctr_summary *saved_profile_info = 0; gcov_summary *saved_profile_info = 0;
int saved_scale = 0; int saved_scale = 0;
/* Find unit with maximal number of runs. If we ever get serious about /* Find unit with maximal number of runs. If we ever get serious about
......
...@@ -582,7 +582,7 @@ struct GTY(()) lto_file_decl_data ...@@ -582,7 +582,7 @@ struct GTY(()) lto_file_decl_data
vec<res_pair> GTY((skip)) respairs; vec<res_pair> GTY((skip)) respairs;
unsigned max_index; unsigned max_index;
struct gcov_ctr_summary GTY((skip)) profile_info; gcov_summary GTY((skip)) profile_info;
/* Map assigning declarations their resolutions. */ /* Map assigning declarations their resolutions. */
hash_map<tree, ld_plugin_symbol_resolution> * GTY((skip)) resolution_map; hash_map<tree, ld_plugin_symbol_resolution> * GTY((skip)) resolution_map;
......
...@@ -84,7 +84,7 @@ struct bb_profile_info { ...@@ -84,7 +84,7 @@ struct bb_profile_info {
/* Counter summary from the last set of coverage counts read. */ /* Counter summary from the last set of coverage counts read. */
const struct gcov_ctr_summary *profile_info; const gcov_summary *profile_info;
/* Counter working set information computed from the current counter /* Counter working set information computed from the current counter
summary. Not initialized unless profile_info summary is non-NULL. */ summary. Not initialized unless profile_info summary is non-NULL. */
......
...@@ -75,6 +75,6 @@ extern void get_working_sets (void); ...@@ -75,6 +75,6 @@ extern void get_working_sets (void);
/* Counter summary from the last set of coverage counts read by /* Counter summary from the last set of coverage counts read by
profile.c. */ profile.c. */
extern const struct gcov_ctr_summary *profile_info; extern const struct gcov_summary *profile_info;
#endif /* PROFILE_H */ #endif /* PROFILE_H */
2018-06-05 Martin Liska <mliska@suse.cz>
* libgcov-driver.c (gcov_compute_histogram): Remove usage
of gcov_ctr_summary.
(compute_summary): Do it just for a single summary.
(merge_one_data): Likewise.
(merge_summary): Simplify as we read just single summary.
(dump_one_gcov): Pass proper argument.
* libgcov-util.c (compute_one_gcov): Simplify as we have just
single summary.
(gcov_info_count_all_cold): Likewise.
(calculate_overlap): Likewise.
2018-06-02 Chung-Ju Wu <jasonwucj@gmail.com> 2018-06-02 Chung-Ju Wu <jasonwucj@gmail.com>
Monk Chiang <sh.chiang04@gmail.com> Monk Chiang <sh.chiang04@gmail.com>
......
...@@ -221,40 +221,24 @@ gcov_compute_histogram (struct gcov_info *list, struct gcov_summary *sum) ...@@ -221,40 +221,24 @@ gcov_compute_histogram (struct gcov_info *list, struct gcov_summary *sum)
struct gcov_info *gi_ptr; struct gcov_info *gi_ptr;
const struct gcov_fn_info *gfi_ptr; const struct gcov_fn_info *gfi_ptr;
const struct gcov_ctr_info *ci_ptr; const struct gcov_ctr_info *ci_ptr;
struct gcov_ctr_summary *cs_ptr; unsigned f_ix, ix;
unsigned t_ix, f_ix, ctr_info_ix, ix;
int h_ix; int h_ix;
/* This currently only applies to arc counters. */
t_ix = GCOV_COUNTER_ARCS;
/* First check if there are any counts recorded for this counter. */ /* First check if there are any counts recorded for this counter. */
cs_ptr = &(sum->ctrs[t_ix]); if (!sum->num)
if (!cs_ptr->num)
return; return;
for (h_ix = 0; h_ix < GCOV_HISTOGRAM_SIZE; h_ix++) for (h_ix = 0; h_ix < GCOV_HISTOGRAM_SIZE; h_ix++)
{ {
cs_ptr->histogram[h_ix].num_counters = 0; sum->histogram[h_ix].num_counters = 0;
cs_ptr->histogram[h_ix].min_value = cs_ptr->run_max; sum->histogram[h_ix].min_value = sum->run_max;
cs_ptr->histogram[h_ix].cum_value = 0; sum->histogram[h_ix].cum_value = 0;
} }
/* Walk through all the per-object structures and record each of /* Walk through all the per-object structures and record each of
the count values in histogram. */ the count values in histogram. */
for (gi_ptr = list; gi_ptr; gi_ptr = gi_ptr->next) for (gi_ptr = list; gi_ptr; gi_ptr = gi_ptr->next)
{ {
if (!gi_ptr->merge[t_ix])
continue;
/* Find the appropriate index into the gcov_ctr_info array
for the counter we are currently working on based on the
existence of the merge function pointer for this object. */
for (ix = 0, ctr_info_ix = 0; ix < t_ix; ix++)
{
if (gi_ptr->merge[ix])
ctr_info_ix++;
}
for (f_ix = 0; f_ix != gi_ptr->n_functions; f_ix++) for (f_ix = 0; f_ix != gi_ptr->n_functions; f_ix++)
{ {
gfi_ptr = gi_ptr->functions[f_ix]; gfi_ptr = gi_ptr->functions[f_ix];
...@@ -262,9 +246,9 @@ gcov_compute_histogram (struct gcov_info *list, struct gcov_summary *sum) ...@@ -262,9 +246,9 @@ gcov_compute_histogram (struct gcov_info *list, struct gcov_summary *sum)
if (!gfi_ptr || gfi_ptr->key != gi_ptr) if (!gfi_ptr || gfi_ptr->key != gi_ptr)
continue; continue;
ci_ptr = &gfi_ptr->ctrs[ctr_info_ix]; ci_ptr = &gfi_ptr->ctrs[0];
for (ix = 0; ix < ci_ptr->num; ix++) for (ix = 0; ix < ci_ptr->num; ix++)
gcov_histogram_insert (cs_ptr->histogram, ci_ptr->values[ix]); gcov_histogram_insert (sum->histogram, ci_ptr->values[ix]);
} }
} }
} }
...@@ -287,10 +271,8 @@ compute_summary (struct gcov_info *list, struct gcov_summary *this_prg, ...@@ -287,10 +271,8 @@ compute_summary (struct gcov_info *list, struct gcov_summary *this_prg,
{ {
struct gcov_info *gi_ptr; struct gcov_info *gi_ptr;
const struct gcov_fn_info *gfi_ptr; const struct gcov_fn_info *gfi_ptr;
struct gcov_ctr_summary *cs_ptr;
const struct gcov_ctr_info *ci_ptr; const struct gcov_ctr_info *ci_ptr;
int f_ix; int f_ix;
unsigned t_ix;
gcov_unsigned_t c_num; gcov_unsigned_t c_num;
gcov_unsigned_t crc32 = 0; gcov_unsigned_t crc32 = 0;
...@@ -320,25 +302,18 @@ compute_summary (struct gcov_info *list, struct gcov_summary *this_prg, ...@@ -320,25 +302,18 @@ compute_summary (struct gcov_info *list, struct gcov_summary *this_prg,
continue; continue;
ci_ptr = gfi_ptr->ctrs; ci_ptr = gfi_ptr->ctrs;
for (t_ix = 0; t_ix != GCOV_COUNTERS_SUMMABLE; t_ix++) this_prg->num += ci_ptr->num;
{
if (!gi_ptr->merge[t_ix])
continue;
cs_ptr = &(this_prg->ctrs[t_ix]);
cs_ptr->num += ci_ptr->num;
crc32 = crc32_unsigned (crc32, ci_ptr->num); crc32 = crc32_unsigned (crc32, ci_ptr->num);
for (c_num = 0; c_num < ci_ptr->num; c_num++) for (c_num = 0; c_num < ci_ptr->num; c_num++)
{ {
cs_ptr->sum_all += ci_ptr->values[c_num]; this_prg->sum_all += ci_ptr->values[c_num];
if (cs_ptr->run_max < ci_ptr->values[c_num]) if (this_prg->run_max < ci_ptr->values[c_num])
cs_ptr->run_max = ci_ptr->values[c_num]; this_prg->run_max = ci_ptr->values[c_num];
} }
ci_ptr++; ci_ptr++;
} }
} }
}
gcov_compute_histogram (list, this_prg); gcov_compute_histogram (list, this_prg);
return crc32; return crc32;
} }
...@@ -411,8 +386,7 @@ merge_one_data (const char *filename, ...@@ -411,8 +386,7 @@ merge_one_data (const char *filename,
if (tmp.checksum != crc32) if (tmp.checksum != crc32)
goto next_summary; goto next_summary;
for (t_ix = 0; t_ix != GCOV_COUNTERS_SUMMABLE; t_ix++) if (tmp.num != this_prg->num)
if (tmp.ctrs[t_ix].num != this_prg->ctrs[t_ix].num)
goto next_summary; goto next_summary;
*prg_p = tmp; *prg_p = tmp;
*summary_pos_p = *eof_pos_p; *summary_pos_p = *eof_pos_p;
...@@ -600,68 +574,52 @@ write_one_data (const struct gcov_info *gi_ptr, ...@@ -600,68 +574,52 @@ write_one_data (const struct gcov_info *gi_ptr,
Return -1 on error. Return 0 on success. */ Return -1 on error. Return 0 on success. */
static int static int
merge_summary (const char *filename, int run_counted, merge_summary (const char *filename __attribute__ ((unused)), int run_counted,
const struct gcov_info *gi_ptr, struct gcov_summary *prg, struct gcov_summary *prg,
struct gcov_summary *this_prg, gcov_unsigned_t crc32, struct gcov_summary *this_prg, gcov_unsigned_t crc32,
struct gcov_summary *all_prg __attribute__ ((unused))) struct gcov_summary *all_prg __attribute__ ((unused)))
{ {
struct gcov_ctr_summary *cs_prg, *cs_tprg;
unsigned t_ix;
#if !GCOV_LOCKED #if !GCOV_LOCKED
/* summary for all instances of program. */ /* summary for all instances of program. */
struct gcov_ctr_summary *cs_all; struct gcov_summary *cs_all;
#endif #endif
/* Merge the summaries. */ /* Merge the summary. */
for (t_ix = 0; t_ix < GCOV_COUNTERS_SUMMABLE; t_ix++) int first = !prg->runs;
{
cs_prg = &(prg->ctrs[t_ix]);
cs_tprg = &(this_prg->ctrs[t_ix]);
if (gi_ptr->merge[t_ix])
{
int first = !cs_prg->runs;
if (!run_counted) if (!run_counted)
cs_prg->runs++; prg->runs++;
if (first) if (first)
cs_prg->num = cs_tprg->num; prg->num = this_prg->num;
cs_prg->sum_all += cs_tprg->sum_all; prg->sum_all += this_prg->sum_all;
if (cs_prg->run_max < cs_tprg->run_max) if (prg->run_max < this_prg->run_max)
cs_prg->run_max = cs_tprg->run_max; prg->run_max = this_prg->run_max;
cs_prg->sum_max += cs_tprg->run_max; prg->sum_max += this_prg->run_max;
if (first) if (first)
memcpy (cs_prg->histogram, cs_tprg->histogram, memcpy (prg->histogram, this_prg->histogram,
sizeof (gcov_bucket_type) * GCOV_HISTOGRAM_SIZE); sizeof (gcov_bucket_type) * GCOV_HISTOGRAM_SIZE);
else else
gcov_histogram_merge (cs_prg->histogram, cs_tprg->histogram); gcov_histogram_merge (prg->histogram, this_prg->histogram);
}
else if (cs_prg->runs)
{
gcov_error ("profiling:%s:Merge mismatch for summary.\n",
filename);
return -1;
}
#if !GCOV_LOCKED #if !GCOV_LOCKED
cs_all = &all_prg->ctrs[t_ix]; all = &all_prg->ctrs[t_ix];
if (!cs_all->runs && cs_prg->runs) if (!all->runs && prg->runs)
{ {
cs_all->num = cs_prg->num; all->num = prg->num;
cs_all->runs = cs_prg->runs; all->runs = prg->runs;
cs_all->sum_all = cs_prg->sum_all; all->sum_all = prg->sum_all;
cs_all->run_max = cs_prg->run_max; all->run_max = prg->run_max;
cs_all->sum_max = cs_prg->sum_max; all->sum_max = prg->sum_max;
} }
else if (!all_prg->checksum else if (!all_prg->checksum
/* Don't compare the histograms, which may have slight /* Don't compare the histograms, which may have slight
variations depending on the order they were updated variations depending on the order they were updated
due to the truncating integer divides used in the due to the truncating integer divides used in the
merge. */ merge. */
&& (cs_all->num != cs_prg->num && (all->num != prg->num
|| cs_all->runs != cs_prg->runs || all->runs != prg->runs
|| cs_all->sum_all != cs_prg->sum_all || all->sum_all != prg->sum_all
|| cs_all->run_max != cs_prg->run_max || all->run_max != prg->run_max
|| cs_all->sum_max != cs_prg->sum_max)) || all->sum_max != prg->sum_max))
{ {
gcov_error ("profiling:%s:Data file mismatch - some " gcov_error ("profiling:%s:Data file mismatch - some "
"data files may have been concurrently " "data files may have been concurrently "
...@@ -669,7 +627,6 @@ merge_summary (const char *filename, int run_counted, ...@@ -669,7 +627,6 @@ merge_summary (const char *filename, int run_counted,
all_prg->checksum = ~0u; all_prg->checksum = ~0u;
} }
#endif #endif
}
prg->checksum = crc32; prg->checksum = crc32;
...@@ -806,7 +763,7 @@ dump_one_gcov (struct gcov_info *gi_ptr, struct gcov_filename *gf, ...@@ -806,7 +763,7 @@ dump_one_gcov (struct gcov_info *gi_ptr, struct gcov_filename *gf,
summary_pos = eof_pos; summary_pos = eof_pos;
} }
error = merge_summary (gf->filename, run_counted, gi_ptr, &prg, this_prg, error = merge_summary (gf->filename, run_counted, &prg, this_prg,
crc32, all_prg); crc32, all_prg);
if (error == -1) if (error == -1)
goto read_fatal; goto read_fatal;
......
...@@ -930,32 +930,20 @@ compute_one_gcov (const struct gcov_info *gcov_info1, ...@@ -930,32 +930,20 @@ compute_one_gcov (const struct gcov_info *gcov_info1,
{ {
for (f_ix = 0; f_ix < gcov_info->n_functions; f_ix++) for (f_ix = 0; f_ix < gcov_info->n_functions; f_ix++)
{ {
unsigned t_ix;
const struct gcov_fn_info *gfi_ptr = gcov_info->functions[f_ix]; const struct gcov_fn_info *gfi_ptr = gcov_info->functions[f_ix];
if (!gfi_ptr || gfi_ptr->key != gcov_info) if (!gfi_ptr || gfi_ptr->key != gcov_info)
continue; continue;
const struct gcov_ctr_info *ci_ptr = gfi_ptr->ctrs; const struct gcov_ctr_info *ci_ptr = gfi_ptr->ctrs;
for (t_ix = 0; t_ix < GCOV_COUNTERS_SUMMABLE; t_ix++)
{
unsigned c_num; unsigned c_num;
if (!gcov_info->merge[t_ix])
continue;
for (c_num = 0; c_num < ci_ptr->num; c_num++) for (c_num = 0; c_num < ci_ptr->num; c_num++)
{
cum_1 += ci_ptr->values[c_num] / sum; cum_1 += ci_ptr->values[c_num] / sum;
} }
ci_ptr++;
}
}
*cum_p = cum_1; *cum_p = cum_1;
return 0.0; return 0.0;
} }
for (f_ix = 0; f_ix < gcov_info1->n_functions; f_ix++) for (f_ix = 0; f_ix < gcov_info1->n_functions; f_ix++)
{ {
unsigned t_ix;
double func_cum_1 = 0.0; double func_cum_1 = 0.0;
double func_cum_2 = 0.0; double func_cum_2 = 0.0;
double func_val = 0.0; double func_val = 0.0;
...@@ -971,13 +959,7 @@ compute_one_gcov (const struct gcov_info *gcov_info1, ...@@ -971,13 +959,7 @@ compute_one_gcov (const struct gcov_info *gcov_info1,
const struct gcov_ctr_info *ci_ptr1 = gfi_ptr1->ctrs; const struct gcov_ctr_info *ci_ptr1 = gfi_ptr1->ctrs;
const struct gcov_ctr_info *ci_ptr2 = gfi_ptr2->ctrs; const struct gcov_ctr_info *ci_ptr2 = gfi_ptr2->ctrs;
for (t_ix = 0; t_ix < GCOV_COUNTERS_SUMMABLE; t_ix++)
{
unsigned c_num; unsigned c_num;
if (!gcov_info1->merge[t_ix])
continue;
for (c_num = 0; c_num < ci_ptr1->num; c_num++) for (c_num = 0; c_num < ci_ptr1->num; c_num++)
{ {
if (ci_ptr1->values[c_num] | ci_ptr2->values[c_num]) if (ci_ptr1->values[c_num] | ci_ptr2->values[c_num])
...@@ -989,14 +971,12 @@ compute_one_gcov (const struct gcov_info *gcov_info1, ...@@ -989,14 +971,12 @@ compute_one_gcov (const struct gcov_info *gcov_info1,
func_cum_1 += ci_ptr1->values[c_num] / sum_1; func_cum_1 += ci_ptr1->values[c_num] / sum_1;
func_cum_2 += ci_ptr2->values[c_num] / sum_2; func_cum_2 += ci_ptr2->values[c_num] / sum_2;
nonzero = 1; nonzero = 1;
if (ci_ptr1->values[c_num] / sum_1 >= overlap_hot_threshold || if (ci_ptr1->values[c_num] / sum_1 >= overlap_hot_threshold
ci_ptr2->values[c_num] / sum_2 >= overlap_hot_threshold) || ci_ptr2->values[c_num] / sum_2 >= overlap_hot_threshold)
hot = 1; hot = 1;
} }
} }
ci_ptr1++;
ci_ptr2++;
}
ret += func_val; ret += func_val;
cum_1 += func_cum_1; cum_1 += func_cum_1;
cum_2 += func_cum_2; cum_2 += func_cum_2;
...@@ -1023,27 +1003,15 @@ gcov_info_count_all_cold (const struct gcov_info *gcov_info, ...@@ -1023,27 +1003,15 @@ gcov_info_count_all_cold (const struct gcov_info *gcov_info,
for (f_ix = 0; f_ix < gcov_info->n_functions; f_ix++) for (f_ix = 0; f_ix < gcov_info->n_functions; f_ix++)
{ {
unsigned t_ix;
const struct gcov_fn_info *gfi_ptr = gcov_info->functions[f_ix]; const struct gcov_fn_info *gfi_ptr = gcov_info->functions[f_ix];
if (!gfi_ptr || gfi_ptr->key != gcov_info) if (!gfi_ptr || gfi_ptr->key != gcov_info)
continue; continue;
const struct gcov_ctr_info *ci_ptr = gfi_ptr->ctrs; const struct gcov_ctr_info *ci_ptr = gfi_ptr->ctrs;
for (t_ix = 0; t_ix < GCOV_COUNTERS_SUMMABLE; t_ix++) for (unsigned c_num = 0; c_num < ci_ptr->num; c_num++)
{
unsigned c_num;
if (!gcov_info->merge[t_ix])
continue;
for (c_num = 0; c_num < ci_ptr->num; c_num++)
{
if (ci_ptr->values[c_num] > threshold) if (ci_ptr->values[c_num] > threshold)
return false; return false;
} }
ci_ptr++;
}
}
return true; return true;
} }
...@@ -1252,13 +1220,13 @@ calculate_overlap (struct gcov_info *gcov_list1, ...@@ -1252,13 +1220,13 @@ calculate_overlap (struct gcov_info *gcov_list1,
struct overlap_t *all_infos; struct overlap_t *all_infos;
compute_summary (gcov_list1, &this_prg, &max_length); compute_summary (gcov_list1, &this_prg, &max_length);
overlap_sum_1 = (double) (this_prg.ctrs[0].sum_all); overlap_sum_1 = (double) (this_prg.sum_all);
p1_sum_all = this_prg.ctrs[0].sum_all; p1_sum_all = this_prg.sum_all;
p1_run_max = this_prg.ctrs[0].run_max; p1_run_max = this_prg.run_max;
compute_summary (gcov_list2, &this_prg, &max_length); compute_summary (gcov_list2, &this_prg, &max_length);
overlap_sum_2 = (double) (this_prg.ctrs[0].sum_all); overlap_sum_2 = (double) (this_prg.sum_all);
p2_sum_all = this_prg.ctrs[0].sum_all; p2_sum_all = this_prg.sum_all;
p2_run_max = this_prg.ctrs[0].run_max; p2_run_max = this_prg.run_max;
for (gi_ptr = gcov_list1; gi_ptr; gi_ptr = gi_ptr->next) for (gi_ptr = gcov_list1; gi_ptr; gi_ptr = gi_ptr->next)
list1_cnt++; list1_cnt++;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment