Changeset 1438 for trunk/src/kmk/function.c
- Timestamp:
- Mar 29, 2008, 2:49:27 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/function.c
r1409 r1438 116 116 117 117 static struct hash_table function_table; 118 119 #ifdef CONFIG_WITH_MAKE_STATS 120 unsigned long make_stats_allocations = 0; 121 unsigned long make_stats_allocated = 0; 122 unsigned long make_stats_allocated_sum = 0; 123 unsigned long make_stats_ht_lookups = 0; 124 unsigned long make_stats_ht_collisions = 0; 125 #endif 118 126 119 127 … … 3460 3468 #endif /* CONFIG_WITH_OS2_LIBPATH */ 3461 3469 3470 #ifdef CONFIG_WITH_MAKE_STATS 3471 /* Retrieve make statistics. */ 3472 static char * 3473 func_make_stats (char *o, char **argv, const char *funcname) 3474 { 3475 char buf[512]; 3476 int len; 3477 3478 if (!argv[0] || (!argv[0][0] && !argv[1])) 3479 { 3480 len = sprintf (buf, "alloc-cur: %5lu %6luKB (/%3luMB) hash: %5lu %2lu%%", 3481 make_stats_allocations, 3482 make_stats_allocated / 1024, 3483 make_stats_allocated_sum / (1024*1024), 3484 make_stats_ht_lookups, 3485 (make_stats_ht_collisions * 100) / make_stats_ht_lookups); 3486 o = variable_buffer_output (o, buf, len); 3487 } 3488 else 3489 { 3490 /* selective */ 3491 int i; 3492 for (i = 0; argv[i]; i++) 3493 { 3494 unsigned long val; 3495 if (i != 0) 3496 o = variable_buffer_output (o, " ", 1); 3497 if (!strcmp(argv[i], "allocations")) 3498 val = make_stats_allocations; 3499 else if (!strcmp(argv[i], "allocated")) 3500 val = make_stats_allocated; 3501 else if (!strcmp(argv[i], "allocated_sum")) 3502 val = make_stats_allocated_sum; 3503 else if (!strcmp(argv[i], "ht_lookups")) 3504 val = make_stats_ht_lookups; 3505 else if (!strcmp(argv[i], "ht_collisions")) 3506 val = make_stats_ht_collisions; 3507 else if (!strcmp(argv[i], "ht_collisions_pct")) 3508 val = (make_stats_ht_collisions * 100) / make_stats_ht_lookups; 3509 else 3510 { 3511 o = variable_buffer_output (o, argv[i], strlen (argv[i])); 3512 continue; 3513 } 3514 3515 len = sprintf (buf, "%ld", val); 3516 o = variable_buffer_output (o, buf, len); 3517 } 3518 } 3519 return o; 3520 } 3521 #endif 3522 3462 3523 /* Lookup table for builtin functions. 3463 3524 … … 3576 3637 { STRING_SIZE_TUPLE("libpath"), 1, 2, 1, func_os2_libpath}, 3577 3638 #endif 3639 #ifdef CONFIG_WITH_MAKE_STATS 3640 { STRING_SIZE_TUPLE("make-stats"), 0, ~0, 0, func_make_stats}, 3641 #endif 3578 3642 #ifdef KMK_HELPERS 3579 3643 { STRING_SIZE_TUPLE("kb-src-tool"), 1, 1, 0, func_kbuild_source_tool},
Note:
See TracChangeset
for help on using the changeset viewer.