- Timestamp:
- Oct 30, 2008 1:45:47 AM (16 years ago)
- Location:
- trunk/src/kmk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/variable.c
r2004 r2005 297 297 v->origin = origin; 298 298 v->recursive = recursive; 299 MAKE_STATS_2(v->changes++); 299 300 } 300 301 return v; … … 1639 1640 if (v->value_alloc_len <= new_value_len + 1) 1640 1641 { 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; 1642 1646 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 */ 1644 1648 # ifdef CONFIG_WITH_RDONLY_VARIABLE_VALUE 1645 1649 if ((append || !v->value_length) && !v->rdonly_val) … … 2084 2088 #endif 2085 2089 2086 MAKE_STATS_2(v->changes++);2087 2090 return v->special ? set_special_var (v) : v; 2088 2091 } … … 2275 2278 2276 2279 2280 #ifdef CONFIG_WITH_MAKE_STATS 2281 static unsigned long var_stats_changes, var_stats_changed; 2282 static unsigned long var_stats_reallocs, var_stats_realloced; 2283 #endif 2284 2277 2285 /* Print information for variable V, prefixing it with PREFIX. */ 2278 2286 … … 2321 2329 printf (_(" (from `%s', line %lu)"), 2322 2330 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 */ 2325 2341 putchar ('\n'); 2326 2342 fputs (prefix, stdout); … … 2361 2377 print_variable_set (struct variable_set *set, char *prefix) 2362 2378 { 2379 #ifdef CONFIG_WITH_MAKE_STATS 2380 var_stats_changes = var_stats_changed = var_stats_reallocs 2381 = var_stats_realloced = 0; 2382 2363 2383 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 2364 2400 2365 2401 fputs (_("# variable set hash-table stats:\n"), stdout); -
trunk/src/kmk/variable.h
r2004 r2005 55 55 #define EXP_COUNT_MAX ((1<<EXP_COUNT_BITS)-1) 56 56 #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 ) 58 58 #endif 59 59
Note:
See TracChangeset
for help on using the changeset viewer.