This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Google/4_9] A couple gcov-tool fixes


On Thu, Aug 14, 2014 at 11:36 AM, Xinliang David Li <davidxl@google.com> wrote:
> Ok.
>
> The interfaces of counter reading/getting now becomes confusing. Should it
> be better documented somewhere so that developer knows what is the right one
> to use in a certain context?

I think it is documented in libgcov.h and accesses should be through
the new gcov_get_counter interface,
but these just got missed when it was ported from trunk.

Teresa

>
> David
>
>
>
> On Thu, Aug 14, 2014 at 11:27 AM, Teresa Johnson <tejohnson@google.com>
> wrote:
>>
>> Fix a couple problems found during testing.
>>
>> Backport from trunk (r212694) failed to fixup gcov_read_counter
>> invocations in google-specific code. Also, forward port
>> r211800 from google/4_8 to tolerate differences after COMDAT
>> fixup.
>>
>> Passes manual testing, ok if passes regression tests?
>>
>> Thanks,
>> Teresa
>>
>> 2014-08-14  Teresa Johnson  <tejohnson@google.com>
>>
>>         * libgcov-merge.c (__gcov_merge_dc): Use gcov_get_counter,
>>         Relax the check after COMDAT fixup.
>>         (__gcov_merge_icall_topn): Use gcov_get_counter.
>>
>> Index: libgcov-merge.c
>> ===================================================================
>> --- libgcov-merge.c     (revision 213975)
>> +++ libgcov-merge.c     (working copy)
>> @@ -95,8 +95,8 @@ __gcov_merge_dc (gcov_type *counters, unsigned n_c
>>    gcc_assert (!(n_counters % 2));
>>    for (i = 0; i < n_counters; i += 2)
>>      {
>> -      gcov_type global_id = gcov_read_counter ();
>> -      gcov_type call_count = gcov_read_counter ();
>> +      gcov_type global_id = gcov_get_counter_target ();
>> +      gcov_type call_count = gcov_get_counter ();
>>
>>        /* Note that global id counter may never have been set if no calls
>> were
>>          made from this call-site.  */
>> @@ -108,7 +108,10 @@ __gcov_merge_dc (gcov_type *counters, unsigned n_c
>>            else if (__gcov_is_gid_insane (global_id))
>>              global_id = counters[i];
>>
>> -          gcc_assert (counters[i] == global_id);
>> +          /* In the case of inconsistency, use the src's target.  */
>> +          if (counters[i] != global_id)
>> +            fprintf (stderr, "Warning: Inconsistent call targets in"
>> +                     " direct-call profile.\n");
>>          }
>>        else if (global_id)
>>         counters[i] = global_id;
>> @@ -158,12 +161,12 @@ __gcov_merge_icall_topn (gcov_type *counters, unsi
>>          }
>>
>>        /* Skip the number_of_eviction entry.  */
>> -      gcov_read_counter ();
>> +      gcov_get_counter ();
>>        for (k = 0; k < GCOV_ICALL_TOPN_NCOUNTS - 1; k += 2)
>>          {
>>            int found = 0;
>> -          gcov_type global_id = gcov_read_counter ();
>> -          gcov_type call_count = gcov_read_counter ();
>> +          gcov_type global_id = gcov_get_counter_target ();
>> +          gcov_type call_count = gcov_get_counter ();
>>            for (m = 0; m < j; m += 2)
>>              {
>>                if (tmp_array[m] == global_id)
>>
>>
>> --
>> Teresa Johnson | Software Engineer | tejohnson@google.com | 408-460-2413
>
>



-- 
Teresa Johnson | Software Engineer | tejohnson@google.com | 408-460-2413


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]