VirtualBox

Changeset 2752 in kBuild for trunk/src/kmk


Ignore:
Timestamp:
Jan 23, 2015 8:38:01 PM (10 years ago)
Author:
bird
Message:

Added another variable statistic under #ifdef CONFIG_WITH_MAKE_STATS and made the makefile check for CONFIG_WITH_MAKE_STATS (instead of only enabling it for debug builds).

Location:
trunk/src/kmk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk/Makefile.kmk

    r2719 r2752  
    201201kmk_DEFS.win = CONFIG_NEW_WIN32_CTRL_EVENT CONFIG_WITH_FAST_IS_SPACE
    202202kmk_DEFS.debug = CONFIG_WITH_MAKE_STATS
     203ifdef CONFIG_WITH_MAKE_STATS
     204 kmk_DEFS += CONFIG_WITH_MAKE_STATS
     205endif
    203206
    204207kmk_SOURCES = \
  • trunk/src/kmk/variable.c

    r2736 r2752  
    447447  MAKE_STATS_2(v->changes = 0);
    448448  MAKE_STATS_2(v->reallocs = 0);
     449  MAKE_STATS_2(v->references = 0);
    449450
    450451  v->exportable = 1;
     
    892893      struct variable *v = lookup_kbuild_object_variable_accessor(name, length);
    893894      if (v != VAR_NOT_KBUILD_ACCESSOR)
    894         return v;
     895        {
     896          MAKE_STATS (v->references++);
     897          return v;
     898        }
    895899    }
    896900# endif
     
    925929          RESOLVE_ALIAS_VARIABLE(v);
    926930# endif
     931         MAKE_STATS (v->references++);
    927932          return v->special ? lookup_special_var (v) : v;
    928933        }
     
    10101015{
    10111016  struct variable var_key;
    1012   struct variable *v;
    10131017#ifndef CONFIG_WITH_STRCACHE2
    10141018  var_key.name = (char *) name;
     
    10181022#else  /* CONFIG_WITH_STRCACHE2 */
    10191023  const char *cached_name;
     1024  struct variable *v;
    10201025
    10211026# ifdef KMK
     
    10271032        {
    10281033          RESOLVE_ALIAS_VARIABLE(v);
     1034          MAKE_STATS (v->references++);
    10291035          return v;
    10301036        }
     
    10541060  RESOLVE_ALIAS_VARIABLE(v);
    10551061# endif
     1062  MAKE_STATS (if (v) v->references++);
    10561063  return v;
    10571064#endif /* CONFIG_WITH_STRCACHE2 */
     
    27562763static unsigned long var_stats_changes, var_stats_changed;
    27572764static unsigned long var_stats_reallocs, var_stats_realloced;
     2765static unsigned long var_stats_references, var_stats_referenced;
    27582766static unsigned long var_stats_val_len, var_stats_val_alloc_len;
    27592767static unsigned long var_stats_val_rdonly_len;
     
    28322840  var_stats_reallocs += v->reallocs;
    28332841  var_stats_realloced += (v->reallocs != 0);
     2842  if (v->references != 0)
     2843      printf (_(", %u references"), v->references);
     2844  var_stats_references += v->references;
     2845  var_stats_referenced += (v->references != 0);
    28342846  var_stats_val_len += v->value_length;
    28352847  if (v->value_alloc_len)
     
    28882900#ifdef CONFIG_WITH_MAKE_STATS
    28892901  var_stats_changes = var_stats_changed = var_stats_reallocs
    2890       = var_stats_realloced = var_stats_val_len = var_stats_val_alloc_len
    2891       = var_stats_val_rdonly_len = 0;
     2902    = var_stats_realloced = var_stats_references = var_stats_referenced
     2903    = var_stats_val_len = var_stats_val_alloc_len
     2904    = var_stats_val_rdonly_len = 0;
    28922905
    28932906  hash_map_arg (&set->table, print_variable, prefix);
     
    29182931               (unsigned int)((100.0 * var_stats_realloced) / set->table.ht_fill),
    29192932               var_stats_reallocs);
     2933
     2934      if (var_stats_referenced)
     2935        printf(_("#  referenced %5lu (%2u%%),       references %6lu\n"),
     2936               var_stats_referenced,
     2937               (unsigned int)((100.0 * var_stats_referenced) / set->table.ht_fill),
     2938               var_stats_references);
    29202939      }
    29212940#else
  • trunk/src/kmk/variable.h

    r2718 r2752  
    110110      } export ENUM_BITFIELD (2);
    111111#ifdef CONFIG_WITH_MAKE_STATS
    112     unsigned int changes;
    113     unsigned int reallocs;
     112    unsigned int changes;      /* Variable modification count.  */
     113    unsigned int reallocs;     /* Realloc on value count.  */
     114    unsigned int references;   /* Lookup count.  */
    114115#endif
    115116  };
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette