ok.

David

On Sun, Oct 12, 2014 at 2:59 PM, Teresa Johnson <tejohn...@google.com> wrote:
> Guard the new time profiling under a parameter, off by default for Google
> since it isn't used and the extra instrumentation was adding bloat.
>
> Enabled time profiling for two test cases that explicitly test it.
>
> For func_reorder_gold_plugin_1.C the change in instrumentation had
> an effect on the ordering of the callgraph group in the linker plugin
> dump. The test case already appeared to try to catch different orders,
> but missed the new one, so I added a leading ".*" to catch it (already
> had a trailing ".*").
>
> old: # Callgraph group : main _Z3barv _Z3foov
> new: # Callgraph group : _Z3foov _Z3barv main
>
> Passes regression tests. Ok for google/4_9?
>
> 2014-10-12  Teresa Johnson  <tejohn...@google.com>
>
>         Google ref b/17945455.
> gcc/
>         * params.def (PARAM_PROFILE_VALUES_TIME): New parameter.
>         * value-prof.c (gimple_find_values_to_profile): Use new param.
>
> gcc/testsuite:
>         * gcc.dg/tree-prof/time-profiler-1.c: Use new parameter.
>         * gcc.dg/tree-prof/time-profiler-2.c: Ditto.
>         * g++.dg/tree-prof/func_reorder_gold_plugin_1.C: Fix dumper scan.
>
> Index: params.def
> ===================================================================
> --- params.def  (revision 215830)
> +++ params.def  (working copy)
> @@ -1101,6 +1101,11 @@ DEFPARAM (PARAM_PROFILE_GENERATE_SAMPLING_PERIOD,
>           "sampling rate with -fprofile-generate-sampling",
>           100, 0, 2000000000)
>
> +DEFPARAM (PARAM_PROFILE_VALUES_TIME,
> +         "profile-values-time",
> +         "Enable time profiling when value profiling",
> +         0, 0, 1)
> +
>  DEFPARAM (PARAM_COVERAGE_CALLBACK,
>           "coverage-callback",
>           "callback a user-define function when for arc counter increments.",
> Index: value-prof.c
> ===================================================================
> --- value-prof.c        (revision 215830)
> +++ value-prof.c        (working copy)
> @@ -2355,7 +2355,10 @@ gimple_find_values_to_profile (histogram_values *v
>      for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
>        gimple_values_to_profile (gsi_stmt (gsi), values);
>
> -  values->safe_push (gimple_alloc_histogram_value (cfun,
> HIST_TYPE_TIME_PROFILE, 0, 0));
> +  if (PARAM_VALUE (PARAM_PROFILE_VALUES_TIME))
> +    values->safe_push (gimple_alloc_histogram_value (cfun,
> +                                                     HIST_TYPE_TIME_PROFILE,
> +                                                     0, 0));
>
>    FOR_EACH_VEC_ELT (*values, i, hist)
>      {
> Index: testsuite/gcc.dg/tree-prof/time-profiler-1.c
> ===================================================================
> --- testsuite/gcc.dg/tree-prof/time-profiler-1.c        (revision 215830)
> +++ testsuite/gcc.dg/tree-prof/time-profiler-1.c        (working copy)
> @@ -1,4 +1,4 @@
> -/* { dg-options "-O2 -fdump-ipa-profile" } */
> +/* { dg-options "-O2 -fdump-ipa-profile --param=profile-values-time=1" } */
>
>  __attribute__ ((noinline))
>  int foo()
> Index: testsuite/gcc.dg/tree-prof/time-profiler-2.c
> ===================================================================
> --- testsuite/gcc.dg/tree-prof/time-profiler-2.c        (revision 215830)
> +++ testsuite/gcc.dg/tree-prof/time-profiler-2.c        (working copy)
> @@ -1,4 +1,4 @@
> -/* { dg-options "-O2 -fdump-ipa-profile" } */
> +/* { dg-options "-O2 -fdump-ipa-profile --param=profile-values-time=1" } */
>
>  #include <unistd.h>
>
> Index: testsuite/g++.dg/tree-prof/func_reorder_gold_plugin_1.C
> ===================================================================
> --- testsuite/g++.dg/tree-prof/func_reorder_gold_plugin_1.C
> (revision 215830)
> +++ testsuite/g++.dg/tree-prof/func_reorder_gold_plugin_1.C     (working copy)
> @@ -38,7 +38,7 @@ int main ()
>  /* { dg-final-use { scan-assembler "\.string \"Weight 1000 1000\"" } }  */
>  /* { dg-final-use { scan-assembler "\.string \"Weight 1001 1001\"" } }  */
>  /* Check if main is next to foo or bar  */
> -/* { dg-final-use { scan-file linker.dump "Callgraph group :
> *\(_Z3foov main|main _Z3foov|_Z3barv main|main _Z3barv\).*\n" } }  */
> +/* { dg-final-use { scan-file linker.dump "Callgraph group :
> *\.*(_Z3foov main|main _Z3foov|_Z3barv main|main _Z3barv\).*\n" } }
> */
>  /* { dg-final-use { scan-file linker.dump ".text\..*\._Z9notcalledv
> entry count = 0 computed = 0 max count = 0" } }  */
>  /* { dg-final-use { scan-file linker.dump "Moving .* section\\(s\\)
> to new segment" } }  */
>  /* { dg-final-use { cleanup-saved-temps } }  */
>
> --
> Teresa Johnson | Software Engineer | tejohn...@google.com | 408-460-2413

Reply via email to