Changeset 1535 in kBuild
- Timestamp:
- Apr 20, 2008 10:19:40 PM (17 years ago)
- Location:
- trunk/src/kmk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/main.c
r1526 r1535 311 311 4 = high / nice -10; 312 312 5 = realtime / nice -19; */ 313 313 314 int process_priority = 0; 314 315 315 316 /* Process affinity mask; 0 means any CPU. */ 317 316 318 int process_affinity = 0; 317 319 #endif /* KMK */ 320 321 #ifdef CONFIG_WITH_MAKE_STATS 322 /* When set, we'll gather expensive statistics like for the heap. */ 323 324 int make_expensive_statistics = 0; 325 #endif 318 326 319 327 … … 406 414 --pretty-command-printing Makes the command echo easier to read.\n"), 407 415 #endif 416 #ifdef CONFIG_WITH_MAKE_STATS 417 N_("\ 418 --statistics Gather extra statistics for $(make-stats ).\n"), 419 #endif 408 420 NULL 409 421 }; … … 461 473 { 'S', flag_off, &keep_going_flag, 1, 1, 0, 0, &default_keep_going_flag, 462 474 "no-keep-going" }, 475 #ifdef KMK 476 { CHAR_MAX+14, flag, (char *) &make_expensive_statistics, 1, 1, 1, 0, 0, 477 "statistics" }, 478 #endif 463 479 { 't', flag, &touch_flag, 1, 1, 1, 0, 0, "touch" }, 464 480 { 'v', flag, &print_version_flag, 1, 1, 0, 0, 0, "version" }, … … 3349 3365 char val[32]; 3350 3366 sprintf (val, "%u", job_slots); 3351 define_variable ("KMK_OPTS_JOBS", sizeof("KMK_OPTS_JOBS") - 1, 3367 define_variable ("KMK_OPTS_JOBS", sizeof("KMK_OPTS_JOBS") - 1, 3352 3368 val, o_default, 1); 3353 define_variable ("KMK_OPTS_KEEP_GOING", sizeof("KMK_OPTS_KEEP_GOING") - 1, 3369 define_variable ("KMK_OPTS_KEEP_GOING", sizeof("KMK_OPTS_KEEP_GOING") - 1, 3354 3370 keep_going_flag ? "1" : "0", o_default, 1); 3355 define_variable ("KMK_OPTS_JUST_PRINT", sizeof("KMK_OPTS_JUST_PRINT") - 1, 3371 define_variable ("KMK_OPTS_JUST_PRINT", sizeof("KMK_OPTS_JUST_PRINT") - 1, 3356 3372 just_print_flag ? "1" : "0", o_default, 1); 3357 define_variable ("KMK_OPTS_PRETTY_COMMAND_PRINTING", sizeof("KMK_OPTS_PRETTY_COMMAND_PRINTING") - 1, 3373 define_variable ("KMK_OPTS_PRETTY_COMMAND_PRINTING", sizeof("KMK_OPTS_PRETTY_COMMAND_PRINTING") - 1, 3358 3374 pretty_command_printing ? "1" : "0", o_default, 1); 3359 3375 sprintf (val, "%u", process_priority); 3360 define_variable ("KMK_OPTS_PRORITY", sizeof("KMK_OPTS_PRORITY") - 1, 3376 define_variable ("KMK_OPTS_PRORITY", sizeof("KMK_OPTS_PRORITY") - 1, 3361 3377 val, o_default, 1); 3362 3378 sprintf (val, "%u", process_affinity); 3363 define_variable ("KMK_OPTS_AFFINITY", sizeof("KMK_OPTS_AFFINITY") - 1, 3379 define_variable ("KMK_OPTS_AFFINITY", sizeof("KMK_OPTS_AFFINITY") - 1, 3364 3380 val, o_default, 1); 3381 define_variable ("KMK_OPTS_STATISTICS", sizeof("KMK_OPTS_STATISTICS") - 1, 3382 make_expensive_statistics ? "1" : "0", o_default, 1); 3365 3383 } 3366 3384 #endif … … 3400 3418 %s Copyright (c) 1998 Todd C. Miller <[email protected]>\n\ 3401 3419 %s\n", 3402 precede, KBUILD_VERSION_MAJOR, KBUILD_VERSION_MINOR, 3420 precede, KBUILD_VERSION_MAJOR, KBUILD_VERSION_MINOR, 3403 3421 KBUILD_VERSION_PATCH, KBUILD_SVN_REV, 3404 3422 precede, version_string, 3405 precede, precede, precede, precede, precede, precede, 3423 precede, precede, precede, precede, precede, precede, 3406 3424 precede, precede); 3407 3425 #else -
trunk/src/kmk/make.h
r1438 r1535 503 503 extern int pretty_command_printing; 504 504 #endif 505 #ifdef CONFIG_WITH_MAKE_STATS 506 extern int make_expensive_statistics; 507 #endif 508 505 509 506 510 /* can we run commands via 'sh -c xxx' or must we use batch files? */ -
trunk/src/kmk/misc.c
r1469 r1535 363 363 #ifdef CONFIG_WITH_MAKE_STATS 364 364 make_stats_allocations++; 365 make_stats_allocated += SIZE_OF_HEAP_BLOCK (result); 366 make_stats_allocated_sum += SIZE_OF_HEAP_BLOCK (result); 365 if (make_expensive_statistics) 366 { 367 unsigned int actual_size = SIZE_OF_HEAP_BLOCK (result); 368 make_stats_allocated += actual_size; 369 make_stats_allocated_sum += actual_size; 370 } 367 371 #endif 368 372 return result; … … 375 379 void *result; 376 380 #ifdef CONFIG_WITH_MAKE_STATS 377 if (ptr != NULL) 378 { 379 make_stats_allocated -= SIZE_OF_HEAP_BLOCK (ptr); 380 make_stats_allocated_sum -= SIZE_OF_HEAP_BLOCK (ptr); 381 if (make_expensive_statistics && ptr != NULL) 382 { 383 unsigned int actual_size = SIZE_OF_HEAP_BLOCK (ptr); 384 make_stats_allocated -= actual_size; 385 make_stats_allocated_sum -= actual_size; 381 386 } 382 387 #endif … … 389 394 fatal (NILF, _("virtual memory exhausted")); 390 395 #ifdef CONFIG_WITH_MAKE_STATS 391 make_stats_allocated += SIZE_OF_HEAP_BLOCK (result); 392 make_stats_allocated_sum += SIZE_OF_HEAP_BLOCK (result); 396 if (!ptr) 397 make_stats_allocations++; 398 if (make_expensive_statistics) 399 { 400 unsigned int actual_size = SIZE_OF_HEAP_BLOCK (result); 401 make_stats_allocated += actual_size; 402 make_stats_allocated_sum += actual_size; 403 } 393 404 #endif 394 405 return result; … … 412 423 #ifdef CONFIG_WITH_MAKE_STATS 413 424 make_stats_allocations++; 414 make_stats_allocated += SIZE_OF_HEAP_BLOCK (result); 415 make_stats_allocated_sum += SIZE_OF_HEAP_BLOCK (result); 425 if (make_expensive_statistics) 426 { 427 unsigned int actual_size = SIZE_OF_HEAP_BLOCK (result); 428 make_stats_allocated += actual_size; 429 make_stats_allocated_sum += actual_size; 430 } 416 431 #endif 417 432 #ifdef HAVE_STRDUP … … 950 965 void xfree(void *ptr) 951 966 { 952 if (ptr) 967 if (ptr) 953 968 { 954 969 make_stats_allocations--; 955 make_stats_allocated -= SIZE_OF_HEAP_BLOCK (ptr); 970 if (make_expensive_statistics) 971 make_stats_allocated -= SIZE_OF_HEAP_BLOCK (ptr); 956 972 free (ptr); 957 973 }
Note:
See TracChangeset
for help on using the changeset viewer.