Changeset 1915 in kBuild
- Timestamp:
- Oct 22, 2008 9:59:51 PM (16 years ago)
- Location:
- trunk/src/kmk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/Makefile.am
r1889 r1915 135 135 -DCONFIG_WITH_WHICH \ 136 136 -DCONFIG_WITH_EVALPLUS \ 137 -DCONFIG_WITH_M AKE_STATS \137 -DCONFIG_WITH_MINIMAL_STATS \ 138 138 -DCONFIG_WITH_COMMANDS_FUNC \ 139 139 -DCONFIG_PRETTY_COMMAND_PRINTING \ -
trunk/src/kmk/Makefile.kmk
r1887 r1915 165 165 CONFIG_WITH_WHICH \ 166 166 CONFIG_WITH_EVALPLUS \ 167 CONFIG_WITH_M AKE_STATS \167 CONFIG_WITH_MINIMAL_STATS \ 168 168 CONFIG_WITH_COMMANDS_FUNC \ 169 169 CONFIG_PRETTY_COMMAND_PRINTING \ -
trunk/src/kmk/dir.c
r1914 r1915 47 47 #endif 48 48 /* bird: end */ 49 50 #ifdef CONFIG_WITH_STRCACHE2 51 # include <stddef.h> 52 #endif 49 53 50 54 /* In GNU systems, <dirent.h> defines this macro for us. */ -
trunk/src/kmk/file.c
r1903 r1915 28 28 #include "debug.h" 29 29 #include "hash.h" 30 #ifdef CONFIG_WITH_STRCACHE2 31 # include <stddef.h> 32 #endif 30 33 31 34 -
trunk/src/kmk/function.c
r1863 r1915 3724 3724 #endif /* CONFIG_WITH_OS2_LIBPATH */ 3725 3725 3726 #if def CONFIG_WITH_MAKE_STATS3726 #if defined (CONFIG_WITH_MAKE_STATS) || defined (CONFIG_WITH_MINIMAL_STATS) 3727 3727 /* Retrieve make statistics. */ 3728 3728 static char * … … 3734 3734 if (!argv[0] || (!argv[0][0] && !argv[1])) 3735 3735 { 3736 # ifdef CONFIG_WITH_MAKE_STATS 3736 3737 len = sprintf (buf, "alloc-cur: %5ld %6luKB (/%3luMB) hash: %5lu %2lu%%", 3737 3738 make_stats_allocations, … … 3741 3742 (make_stats_ht_collisions * 100) / make_stats_ht_lookups); 3742 3743 o = variable_buffer_output (o, buf, len); 3744 #endif 3743 3745 } 3744 3746 else … … 3751 3753 if (i != 0) 3752 3754 o = variable_buffer_output (o, " ", 1); 3753 if (!strcmp(argv[i], "allocations")) 3755 if (0) 3756 continue; 3757 # ifdef CONFIG_WITH_MAKE_STATS 3758 else if (!strcmp(argv[i], "allocations")) 3754 3759 val = make_stats_allocations; 3755 3760 else if (!strcmp(argv[i], "allocated")) … … 3763 3768 else if (!strcmp(argv[i], "ht_collisions_pct")) 3764 3769 val = (make_stats_ht_collisions * 100) / make_stats_ht_lookups; 3770 #endif 3765 3771 else 3766 3772 { … … 3773 3779 } 3774 3780 } 3781 3775 3782 return o; 3776 3783 } -
trunk/src/kmk/hash.c
r1914 r1915 137 137 #endif 138 138 139 ht->ht_lookups++; 140 #ifdef CONFIG_WITH_MAKE_STATS 141 make_stats_ht_lookups++; 142 #endif 139 MAKE_STATS (ht->ht_lookups++); 140 MAKE_STATS_3 (make_stats_ht_lookups++); 143 141 for (;;) 144 142 { … … 159 157 if ((*ht->ht_compare) (key, *slot) == 0) 160 158 return slot; 161 ht->ht_collisions++; 162 #ifdef CONFIG_WITH_MAKE_STATS 163 make_stats_ht_collisions++; 164 #endif 159 MAKE_STATS (ht->ht_collisions++); 160 MAKE_STATS_3 (make_stats_ht_collisions++); 165 161 } 166 162 if (!hash_2) … … 186 182 #endif 187 183 188 ht->ht_lookups++; 189 #ifdef CONFIG_WITH_MAKE_STATS 190 make_stats_ht_lookups++; 191 #endif 184 MAKE_STATS (ht->ht_lookups++); 185 MAKE_STATS_3 (make_stats_ht_lookups++); 192 186 193 187 /* first iteration unrolled. */ … … 203 197 return slot; 204 198 205 ht->ht_collisions++; 206 #ifdef CONFIG_WITH_MAKE_STATS 207 make_stats_ht_collisions++; 208 #endif 199 MAKE_STATS (ht->ht_collisions++); 200 MAKE_STATS_3 (make_stats_ht_collisions++); 209 201 } 210 202 else … … 233 225 return slot; 234 226 235 ht->ht_collisions++; 236 #ifdef CONFIG_WITH_MAKE_STATS 237 make_stats_ht_collisions++; 238 #endif 227 MAKE_STATS (ht->ht_collisions++); 228 MAKE_STATS_3 (make_stats_ht_collisions++); 239 229 } 240 230 -
trunk/src/kmk/main.c
r1882 r1915 329 329 #endif /* KMK */ 330 330 331 #if def CONFIG_WITH_MAKE_STATS331 #if defined (CONFIG_WITH_MAKE_STATS) || defined (CONFIG_WITH_MINIMAL_STATS) 332 332 /* When set, we'll gather expensive statistics like for the heap. */ 333 333 … … 489 489 { 'S', flag_off, &keep_going_flag, 1, 1, 0, 0, &default_keep_going_flag, 490 490 "no-keep-going" }, 491 #if def KMK491 #if defined (CONFIG_WITH_MAKE_STATS) || defined (CONFIG_WITH_MINIMAL_STATS) 492 492 { CHAR_MAX+14, flag, (char *) &make_expensive_statistics, 1, 1, 1, 0, 0, 493 493 "statistics" }, … … 829 829 errno = 0; 830 830 if (nice (nice_level) == -1 && errno != 0) 831 fprintf (stderr, "warning: nice (%d) failed: %s\n", nice, strerror (errno)); 831 fprintf (stderr, "warning: nice (%d) failed: %s\n", 832 nice_level, strerror (errno)); 832 833 #endif 833 834 } … … 1840 1841 { 1841 1842 struct stat st; 1842 if (( stat ("Makefile.kup", &st) == 01843 && S_ISREG (st.st_mode) )1844 || ( stat ("makefile.kup", &st) == 01845 && S_ISREG (st.st_mode) )1843 if (( ( stat ("Makefile.kup", &st) == 0 1844 && S_ISREG (st.st_mode) ) 1845 || ( stat ("makefile.kup", &st) == 0 1846 && S_ISREG (st.st_mode) ) ) 1846 1847 && stat ("Makefile.kmk", &st) < 0 1847 1848 && stat ("makefile.kmk", &st) < 0) … … 3531 3532 define_variable ("KMK_OPTS_AFFINITY", sizeof("KMK_OPTS_AFFINITY") - 1, 3532 3533 val, o_default, 1); 3534 #if defined (CONFIG_WITH_MAKE_STATS) || defined (CONFIG_WITH_MINIMAL_STATS) 3533 3535 define_variable ("KMK_OPTS_STATISTICS", sizeof("KMK_OPTS_STATISTICS") - 1, 3534 3536 make_expensive_statistics ? "1" : "0", o_default, 1); 3537 # endif 3535 3538 } 3536 3539 #endif … … 3604 3607 if (!remote_description || *remote_description == '\0') 3605 3608 printf (_("\n%sThis program is built for %s/%s/%s [" __DATE__ " " __TIME__ "]\n"), 3606 precede, KBUILD_HOST, KBUILD_HOST_ARCH, KBUILD_HOST_CPU , remote_description);3609 precede, KBUILD_HOST, KBUILD_HOST_ARCH, KBUILD_HOST_CPU); 3607 3610 else 3608 3611 printf (_("\n%sThis program is built for %s/%s/%s (%s) [" __DATE__ " " __TIME__ "]\n"), -
trunk/src/kmk/make.h
r1897 r1915 660 660 extern int pretty_command_printing; 661 661 #endif 662 #if def CONFIG_WITH_MAKE_STATS662 #if defined (CONFIG_WITH_MAKE_STATS) || defined (CONFIG_WITH_MINIMAL_STATS) 663 663 extern int make_expensive_statistics; 664 664 #endif … … 880 880 # endif 881 881 882 # define MAKE_STATS_3(expr) do { expr; } while (0) 883 # define MAKE_STATS_2(expr) do { expr; } while (0) 884 # define MAKE_STATS(expr) do { expr; } while (0) 885 #else 886 # define MAKE_STATS_3(expr) do { } while (0) 887 # define MAKE_STATS_2(expr) do { } while (0) 888 # define MAKE_STATS(expr) do { } while (0) 882 889 #endif 883 890 -
trunk/src/kmk/strcache2.c
r1913 r1915 686 686 assert (!cache->case_insensitive); 687 687 688 cache->lookup_count++;688 MAKE_STATS (cache->lookup_count++); 689 689 690 690 /* Lookup the entry in the hash table, hoping for an … … 696 696 if (strcache2_is_equal (cache, entry, str, length, hash)) 697 697 return (const char *)(entry + 1); 698 cache->collision_1st_count++;698 MAKE_STATS (cache->collision_1st_count++); 699 699 700 700 entry = entry->next; … … 703 703 if (strcache2_is_equal (cache, entry, str, length, hash)) 704 704 return (const char *)(entry + 1); 705 cache->collision_2nd_count++;705 MAKE_STATS (cache->collision_2nd_count++); 706 706 707 707 /* Loop the rest. */ … … 713 713 if (strcache2_is_equal (cache, entry, str, length, hash)) 714 714 return (const char *)(entry + 1); 715 cache->collision_3rd_count++;715 MAKE_STATS (cache->collision_3rd_count++); 716 716 } 717 717 /* not reached */ … … 734 734 #endif /* NDEBUG */ 735 735 736 cache->lookup_count++;736 MAKE_STATS (cache->lookup_count++); 737 737 738 738 /* Lookup the entry in the hash table, hoping for an … … 744 744 if (strcache2_is_equal (cache, entry, str, length, hash)) 745 745 return (const char *)(entry + 1); 746 cache->collision_1st_count++;746 MAKE_STATS (cache->collision_1st_count++); 747 747 748 748 entry = entry->next; … … 751 751 if (strcache2_is_equal (cache, entry, str, length, hash)) 752 752 return (const char *)(entry + 1); 753 cache->collision_2nd_count++;753 MAKE_STATS (cache->collision_2nd_count++); 754 754 755 755 /* Loop the rest. */ … … 761 761 if (strcache2_is_equal (cache, entry, str, length, hash)) 762 762 return (const char *)(entry + 1); 763 cache->collision_3rd_count++;763 MAKE_STATS (cache->collision_3rd_count++); 764 764 } 765 765 /* not reached */ … … 776 776 assert (!cache->case_insensitive); 777 777 778 cache->lookup_count++;778 MAKE_STATS (cache->lookup_count++); 779 779 780 780 /* Lookup the entry in the hash table, hoping for an … … 786 786 if (strcache2_is_equal (cache, entry, str, length, hash)) 787 787 return (const char *)(entry + 1); 788 cache->collision_1st_count++;788 MAKE_STATS (cache->collision_1st_count++); 789 789 790 790 entry = entry->next; … … 793 793 if (strcache2_is_equal (cache, entry, str, length, hash)) 794 794 return (const char *)(entry + 1); 795 cache->collision_2nd_count++;795 MAKE_STATS (cache->collision_2nd_count++); 796 796 797 797 /* Loop the rest. */ … … 803 803 if (strcache2_is_equal (cache, entry, str, length, hash)) 804 804 return (const char *)(entry + 1); 805 cache->collision_3rd_count++;805 MAKE_STATS (cache->collision_3rd_count++); 806 806 } 807 807 /* not reached */ … … 820 820 assert (!cache->case_insensitive); 821 821 822 cache->lookup_count++;822 MAKE_STATS (cache->lookup_count++); 823 823 824 824 /* Lookup the entry in the hash table, hoping for an … … 830 830 if (strcache2_is_equal (cache, entry, str, length, hash)) 831 831 return (const char *)(entry + 1); 832 cache->collision_1st_count++;832 MAKE_STATS (cache->collision_1st_count++); 833 833 834 834 entry = entry->next; … … 837 837 if (strcache2_is_equal (cache, entry, str, length, hash)) 838 838 return (const char *)(entry + 1); 839 cache->collision_2nd_count++;839 MAKE_STATS (cache->collision_2nd_count++); 840 840 841 841 /* Loop the rest. */ … … 847 847 if (strcache2_is_equal (cache, entry, str, length, hash)) 848 848 return (const char *)(entry + 1); 849 cache->collision_3rd_count++;849 MAKE_STATS (cache->collision_3rd_count++); 850 850 } 851 851 /* not reached */ … … 868 868 #endif /* NDEBUG */ 869 869 870 cache->lookup_count++;870 MAKE_STATS (cache->lookup_count++); 871 871 872 872 /* Lookup the entry in the hash table, hoping for an … … 878 878 if (strcache2_is_equal (cache, entry, str, length, hash)) 879 879 return (const char *)(entry + 1); 880 cache->collision_1st_count++;880 MAKE_STATS (cache->collision_1st_count++); 881 881 882 882 entry = entry->next; … … 885 885 if (strcache2_is_equal (cache, entry, str, length, hash)) 886 886 return (const char *)(entry + 1); 887 cache->collision_2nd_count++;887 MAKE_STATS (cache->collision_2nd_count++); 888 888 889 889 /* Loop the rest. */ … … 895 895 if (strcache2_is_equal (cache, entry, str, length, hash)) 896 896 return (const char *)(entry + 1); 897 cache->collision_3rd_count++;897 MAKE_STATS (cache->collision_3rd_count++); 898 898 } 899 899 /* not reached */ … … 910 910 assert (!cache->case_insensitive); 911 911 912 cache->lookup_count++;912 MAKE_STATS (cache->lookup_count++); 913 913 914 914 /* Lookup the entry in the hash table, hoping for an … … 920 920 if (strcache2_is_equal (cache, entry, str, length, hash)) 921 921 return (const char *)(entry + 1); 922 cache->collision_1st_count++;922 MAKE_STATS (cache->collision_1st_count++); 923 923 924 924 entry = entry->next; … … 927 927 if (strcache2_is_equal (cache, entry, str, length, hash)) 928 928 return (const char *)(entry + 1); 929 cache->collision_2nd_count++;929 MAKE_STATS (cache->collision_2nd_count++); 930 930 931 931 /* Loop the rest. */ … … 937 937 if (strcache2_is_equal (cache, entry, str, length, hash)) 938 938 return (const char *)(entry + 1); 939 cache->collision_3rd_count++;939 MAKE_STATS (cache->collision_3rd_count++); 940 940 } 941 941 /* not reached */ -
trunk/src/kmk/variable.c
r1914 r1915 33 33 #ifdef KMK 34 34 # include "kbuild.h" 35 #endif 36 #ifdef CONFIG_WITH_STRCACHE2 37 # include <stddef.h> 35 38 #endif 36 39 … … 229 232 } 230 233 else 231 assert (!v || (v->name == name && !HASH_VACANT (v))); 234 { 235 assert (!v || (v->name == name && !HASH_VACANT (v))); 236 var_slot = 0; 237 } 232 238 #endif /* CONFIG_WITH_STRCACHE2 */ 233 239 if (! HASH_VACANT (v)) … … 466 472 hash_1 = strcache2_calc_ptr_hash (&variable_strcache, name); 467 473 ht = &setlist->set->table; 474 MAKE_STATS (ht->ht_lookups++); 468 475 idx = hash_1 & (ht->ht_size - 1); 469 476 v = ht->ht_vec[idx]; … … 481 488 idx &= (ht->ht_size - 1); 482 489 v = (struct variable *) ht->ht_vec[idx]; 483 ht->ht_collisions++; /* there are hardly any deletions, so don't bother with not counting deleted clashes. */490 MAKE_STATS (ht->ht_collisions++); /* there are hardly any deletions, so don't bother with not counting deleted clashes. */ 484 491 485 492 if (v == 0) … … 510 517 /* first iteration unrolled */ 511 518 ht = &setlist->set->table; 519 MAKE_STATS (ht->ht_lookups++); 512 520 idx = hash_1 & (ht->ht_size - 1); 513 521 v = ht->ht_vec[idx]; … … 524 532 idx &= (ht->ht_size - 1); 525 533 v = (struct variable *) ht->ht_vec[idx]; 526 ht->ht_collisions++; /* see reason above */534 MAKE_STATS (ht->ht_collisions++); /* see reason above */ 527 535 528 536 if (v == 0) … … 1158 1166 && defined (CONFIG_WITH_WHICH) \ 1159 1167 && defined (CONFIG_WITH_EVALPLUS) \ 1160 && defined (CONFIG_WITH_MAKE_STATS) \1168 && (defined (CONFIG_WITH_MAKE_STATS) || defined (CONFIG_WITH_MINIMAL_STATS)) \ 1161 1169 && defined (CONFIG_WITH_COMMANDS_FUNC) \ 1162 1170 && defined (KMK_HELPERS) … … 1234 1242 strcat (buf, " evalctx evalval evalvalctx evalcall evalcall2"); 1235 1243 # endif 1236 # if defined (CONFIG_WITH_MAKE_STATS) 1244 # if defined (CONFIG_WITH_MAKE_STATS) || defined (CONFIG_WITH_MINIMAL_STATS) 1237 1245 strcat (buf, " make-stats"); 1238 1246 # endif
Note:
See TracChangeset
for help on using the changeset viewer.