VirtualBox

Changeset 2005 in kBuild for trunk


Ignore:
Timestamp:
Oct 30, 2008 1:45:47 AM (16 years ago)
Author:
bird
Message:

more variable modification stats.

Location:
trunk/src/kmk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk/variable.c

    r2004 r2005  
    297297          v->origin = origin;
    298298          v->recursive = recursive;
     299          MAKE_STATS_2(v->changes++);
    299300        }
    300301      return v;
     
    16391640  if (v->value_alloc_len <= new_value_len + 1)
    16401641    {
    1641       v->value_alloc_len *= 2;
     1642      if (v->value_alloc_len < 256)
     1643        v->value_alloc_len = 256;
     1644      else
     1645        v->value_alloc_len *= 2;
    16421646      if (v->value_alloc_len < new_value_len + 1)
    1643           v->value_alloc_len = VAR_ALIGN_VALUE_ALLOC (new_value_len + 1 + value_len + 1);
     1647        v->value_alloc_len = VAR_ALIGN_VALUE_ALLOC (new_value_len + 1 + value_len); /* extra for future */
    16441648# ifdef CONFIG_WITH_RDONLY_VARIABLE_VALUE
    16451649      if ((append || !v->value_length) && !v->rdonly_val)
     
    20842088#endif
    20852089
    2086   MAKE_STATS_2(v->changes++);
    20872090  return v->special ? set_special_var (v) : v;
    20882091}
     
    22752278
    22762279
     2280#ifdef CONFIG_WITH_MAKE_STATS
     2281static unsigned long var_stats_changes, var_stats_changed;
     2282static unsigned long var_stats_reallocs, var_stats_realloced;
     2283#endif
     2284
    22772285/* Print information for variable V, prefixing it with PREFIX.  */
    22782286
     
    23212329    printf (_(" (from `%s', line %lu)"),
    23222330            v->fileinfo.filenm, v->fileinfo.lineno);
    2323   MAKE_STATS_2(if (v->changes != 1) printf(_(", %u changes"), v->changes));
    2324   MAKE_STATS_2(if (v->reallocs != 0) printf(_(", %u reallocs"), v->reallocs));
     2331#ifdef CONFIG_WITH_MAKE_STATS
     2332  if (v->changes != 0)
     2333      printf(_(", %u changes"), v->changes);
     2334  var_stats_changes += v->changes;
     2335  var_stats_changed += (v->changes != 0);
     2336  if (v->reallocs != 0)
     2337      printf(_(", %u reallocs"), v->reallocs);
     2338  var_stats_reallocs += v->reallocs;
     2339  var_stats_realloced += (v->reallocs != 0);
     2340#endif /* CONFIG_WITH_MAKE_STATS */
    23252341  putchar ('\n');
    23262342  fputs (prefix, stdout);
     
    23612377print_variable_set (struct variable_set *set, char *prefix)
    23622378{
     2379#ifdef CONFIG_WITH_MAKE_STATS
     2380  var_stats_changes = var_stats_changed = var_stats_reallocs
     2381      = var_stats_realloced = 0;
     2382
    23632383  hash_map_arg (&set->table, print_variable, prefix);
     2384
     2385  if (var_stats_changed || var_stats_realloced)
     2386    printf(_("# variable set modification stats:\n"));
     2387  if (var_stats_changed)
     2388    printf(_("#     changed %5lu (%2u%%),        changes %6lu\n"),
     2389           var_stats_changed,
     2390           (unsigned int)((100.0 * var_stats_changed) / set->table.ht_fill),
     2391           var_stats_changes);
     2392  if (var_stats_realloced)
     2393    printf(_("# reallocated %5lu (%2u%%),  reallocations %6lu\n"),
     2394           var_stats_realloced,
     2395           (unsigned int)((100.0 * var_stats_realloced) / set->table.ht_fill),
     2396           var_stats_reallocs);
     2397#else
     2398  hash_map_arg (&set->table, print_variable, prefix);
     2399#endif
    23642400
    23652401  fputs (_("# variable set hash-table stats:\n"), stdout);
  • trunk/src/kmk/variable.h

    r2004 r2005  
    5555#define EXP_COUNT_MAX   ((1<<EXP_COUNT_BITS)-1)
    5656#ifdef CONFIG_WITH_VALUE_LENGTH
    57 #define VAR_ALIGN_VALUE_ALLOC(len)  ( ((len) + (unsigned int)31) & ~(unsigned int)31 )
     57#define VAR_ALIGN_VALUE_ALLOC(len)  ( ((len) + (unsigned int)15) & ~(unsigned int)15 )
    5858#endif
    5959
Note: See TracChangeset for help on using the changeset viewer.

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