- Timestamp:
- Oct 23, 2008 9:27:11 PM (17 years ago)
- Location:
- trunk/src/kmk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/Makefile.am
r1915 r1918 138 138 -DCONFIG_WITH_COMMANDS_FUNC \ 139 139 -DCONFIG_PRETTY_COMMAND_PRINTING \ 140 -DCONFIG_WITH_PRINT_STATS_SWITCH \ 140 141 \ 141 142 -DKBUILD_HOST=\"$(BUILD_TARGET)\" \ -
trunk/src/kmk/Makefile.kmk
r1915 r1918 168 168 CONFIG_WITH_COMMANDS_FUNC \ 169 169 CONFIG_PRETTY_COMMAND_PRINTING \ 170 CONFIG_WITH_PRINT_STATS_SWITCH \ 170 171 \ 171 172 KBUILD_HOST=\"$(KBUILD_TARGET)\" \ -
trunk/src/kmk/file.c
r1915 r1918 1259 1259 } 1260 1260 1261 #ifdef CONFIG_WITH_PRINT_STATS_SWITCH 1262 void 1263 print_file_stats (void) 1264 { 1265 fputs (_("\n# files hash-table stats:\n# "), stdout); 1266 hash_print_stats (&files, stdout); 1267 fputs ("\n", stdout); 1268 } 1269 #endif 1270 1261 1271 1262 1272 /* Verify the integrity of the data base of files. */ -
trunk/src/kmk/main.c
r1915 r1918 83 83 void verify_file_data_base (void); 84 84 85 #ifdef CONFIG_WITH_PRINT_STATS_SWITCH 86 void print_variable_stats (void); 87 void print_file_stats (void); 88 #endif 89 85 90 #if defined HAVE_WAITPID || defined HAVE_WAIT3 86 91 # define HAVE_WAIT_NOHANG … … 172 177 173 178 int pretty_command_printing; 179 #endif 180 181 #ifdef CONFIG_WITH_PRINT_STATS_SWITCH 182 /* Nonzero means to print internal statistics before exiting. */ 183 184 int print_stats_flag; 174 185 #endif 175 186 … … 476 487 "pretty-command-printing" }, 477 488 #endif 489 #ifdef CONFIG_WITH_PRINT_STATS_SWITCH 490 { CHAR_MAX+11, flag, (char *) &print_stats_flag, 1, 1, 1, 0, 0, 491 "print-stats" }, 492 #endif 478 493 #ifdef KMK 479 { CHAR_MAX+1 1, positive_int, (char *) &process_priority, 1, 1, 0,494 { CHAR_MAX+12, positive_int, (char *) &process_priority, 1, 1, 0, 480 495 (char *) &process_priority, (char *) &process_priority, "priority" }, 481 { CHAR_MAX+1 2, positive_int, (char *) &process_affinity, 1, 1, 0,496 { CHAR_MAX+14, positive_int, (char *) &process_affinity, 1, 1, 0, 482 497 (char *) &process_affinity, (char *) &process_affinity, "affinity" }, 483 498 #endif … … 490 505 "no-keep-going" }, 491 506 #if defined (CONFIG_WITH_MAKE_STATS) || defined (CONFIG_WITH_MINIMAL_STATS) 492 { CHAR_MAX+1 4, flag, (char *) &make_expensive_statistics, 1, 1, 1, 0, 0,507 { CHAR_MAX+15, flag, (char *) &make_expensive_statistics, 1, 1, 1, 0, 0, 493 508 "statistics" }, 494 509 #endif … … 3653 3668 printf (_("\n# Finished Make data base on %s\n"), ctime (&when)); 3654 3669 } 3670 #ifdef CONFIG_WITH_PRINT_STATS_SWITCH 3671 3672 static void 3673 print_stats () 3674 { 3675 time_t when; 3676 3677 when = time ((time_t *) 0); 3678 printf (_("\n# Make statistics, printed on %s"), ctime (&when)); 3679 3680 print_variable_stats (); 3681 print_file_stats (); 3682 # ifndef CONFIG_WITH_STRCACHE2 3683 strcache_print_stats ("#"); 3684 # else 3685 strcache2_print_stats_all ("#"); 3686 # endif 3687 # ifdef CONFIG_WITH_ALLOC_CACHES 3688 alloccache_print_all (); 3689 # endif 3690 print_heap_stats (); 3691 3692 when = time ((time_t *) 0); 3693 printf (_("\n# Finished Make statistics on %s\n"), ctime (&when)); 3694 } 3695 #endif 3655 3696 3656 3697 static void … … 3734 3775 if (print_data_base_flag) 3735 3776 print_data_base (); 3777 3778 #ifdef CONFIG_WITH_PRINT_STATS_SWITCH 3779 if (print_stats_flag) 3780 print_stats (); 3781 #endif 3736 3782 3737 3783 #ifdef NDEBUG /* bird: Don't waste time on debug sanity checks. */ -
trunk/src/kmk/make.h
r1915 r1918 433 433 void *xrealloc (void *, unsigned int); 434 434 char *xstrdup (const char *); 435 #ifdef CONFIG_WITH_PRINT_STATS_SWITCH 436 void print_heap_stats (void); 437 #endif 435 438 char *find_next_token (const char **, unsigned int *); 436 439 char *next_token (const char *); -
trunk/src/kmk/misc.c
r1876 r1918 22 22 #ifdef CONFIG_WITH_VALUE_LENGTH 23 23 # include <assert.h> 24 #endif 25 #ifdef CONFIG_WITH_PRINT_STATS_SWITCH 26 # ifdef __APPLE__ 27 # include <malloc/malloc.h> 28 # endif 24 29 #endif 25 30 … … 1326 1331 1327 1332 #endif /* CONFIG_WITH_ALLOC_CACHES */ 1333 1334 #ifdef CONFIG_WITH_PRINT_STATS_SWITCH 1335 /* Print heap statistics if supported by the platform. */ 1336 void print_heap_stats (void) 1337 { 1338 /* Darwin / Mac OS X */ 1339 # ifdef __APPLE__ 1340 malloc_statistics_t s; 1341 1342 malloc_zone_statistics (NULL, &s); 1343 printf (_("\n# CRT Heap: %zu bytes in use, in %u block, avg %zu bytes/block\n"), 1344 s.size_in_use, s.blocks_in_use, s.size_in_use / s.blocks_in_use); 1345 printf (_("# %zu bytes max in use (high water mark)\n"), 1346 s.max_size_in_use); 1347 printf (_("# %zu bytes reserved, %zu bytes free (estimate)\n"), 1348 s.size_allocated, s.size_allocated - s.size_in_use); 1349 # endif /* __APPLE__ */ 1350 1351 /* Darwin Libc sources indicates that something like this may be 1352 found in GLIBC, however, it's not in any current one... */ 1353 # if 0 /* ??? */ 1354 struct mstats m; 1355 1356 m = mstats(); 1357 printf (_("\n# CRT Heap: %zu blocks / %zu bytes in use, %zu blocks / %zu bytes free\n"), 1358 m.chunks_used, m.bytes_used, m.chunks_free, m.bytes_free); 1359 printf (_("# %zu bytes reserved\n"), 1360 m.bytes_total); 1361 # endif /* ??? */ 1362 1363 /* XVID2/XPG mallinfo (displayed per GLIBC documentation). */ 1364 # if 0 && defined(__GLIBC__) /* XXX: finish on linux, check older glibc versions. */ 1365 struct mallinfo m; 1366 1367 m = mallinfo(); 1368 printf (_("\n# CRT Heap: %d bytes in use, %d bytes free\n"), 1369 m.uordblks, s.fordblks); 1370 1371 printf (_("# # free chunks=%d, # fastbin blocks=%d\n"), 1372 m.ordblks, m.smblks); 1373 printf (_("# # mapped regions=%d, space in mapped regions=%d\n"), 1374 m.hblks, m.hblkhd); 1375 printf (_("# non-mapped space allocated from system=%d\n"), 1376 m.arena); 1377 printf (_("# maximum total allocated space=%d\n"), 1378 m.usmblks); 1379 printf (_("# top-most releasable space=%d\n"), 1380 m.keepcost); 1381 # endif /* __GLIBC__ */ 1382 1383 /* XXX: windows */ 1384 } 1385 #endif /* CONFIG_WITH_PRINT_STATS_SWITCH */ 1386 -
trunk/src/kmk/variable.c
r1915 r1918 2293 2293 } 2294 2294 2295 #ifdef CONFIG_WITH_PRINT_STATS_SWITCH 2296 void 2297 print_variable_stats (void) 2298 { 2299 fputs (_("\n# Global variable hash-table stats:\n# "), stdout); 2300 hash_print_stats (&global_variable_set.table, stdout); 2301 fputs ("\n", stdout); 2302 } 2303 #endif 2295 2304 2296 2305 /* Print all the local variables of FILE. */
Note:
See TracChangeset
for help on using the changeset viewer.