VirtualBox

Changeset 1915 in kBuild


Ignore:
Timestamp:
Oct 22, 2008 9:59:51 PM (16 years ago)
Author:
bird
Message:

kmk: CONFIG_WITH_MINIMAL_STATS vs. CONFIG_WITH_MAKE_STATS - require special builds for expensive statistics.

Location:
trunk/src/kmk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk/Makefile.am

    r1889 r1915  
    135135        -DCONFIG_WITH_WHICH \
    136136        -DCONFIG_WITH_EVALPLUS \
    137         -DCONFIG_WITH_MAKE_STATS \
     137        -DCONFIG_WITH_MINIMAL_STATS \
    138138        -DCONFIG_WITH_COMMANDS_FUNC \
    139139        -DCONFIG_PRETTY_COMMAND_PRINTING \
  • trunk/src/kmk/Makefile.kmk

    r1887 r1915  
    165165        CONFIG_WITH_WHICH \
    166166        CONFIG_WITH_EVALPLUS \
    167         CONFIG_WITH_MAKE_STATS \
     167        CONFIG_WITH_MINIMAL_STATS \
    168168        CONFIG_WITH_COMMANDS_FUNC \
    169169        CONFIG_PRETTY_COMMAND_PRINTING \
  • trunk/src/kmk/dir.c

    r1914 r1915  
    4747#endif
    4848/* bird: end */
     49
     50#ifdef CONFIG_WITH_STRCACHE2
     51# include <stddef.h>
     52#endif
    4953
    5054/* In GNU systems, <dirent.h> defines this macro for us.  */
  • trunk/src/kmk/file.c

    r1903 r1915  
    2828#include "debug.h"
    2929#include "hash.h"
     30#ifdef CONFIG_WITH_STRCACHE2
     31# include <stddef.h>
     32#endif
    3033
    3134
  • trunk/src/kmk/function.c

    r1863 r1915  
    37243724#endif  /* CONFIG_WITH_OS2_LIBPATH */
    37253725
    3726 #ifdef CONFIG_WITH_MAKE_STATS
     3726#if defined (CONFIG_WITH_MAKE_STATS) || defined (CONFIG_WITH_MINIMAL_STATS)
    37273727/* Retrieve make statistics. */
    37283728static char *
     
    37343734  if (!argv[0] || (!argv[0][0] && !argv[1]))
    37353735    {
     3736# ifdef CONFIG_WITH_MAKE_STATS
    37363737      len = sprintf (buf, "alloc-cur: %5ld %6luKB (/%3luMB)  hash: %5lu %2lu%%",
    37373738                     make_stats_allocations,
     
    37413742                     (make_stats_ht_collisions * 100) / make_stats_ht_lookups);
    37423743      o = variable_buffer_output (o, buf, len);
     3744#endif
    37433745    }
    37443746  else
     
    37513753          if (i != 0)
    37523754            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"))
    37543759            val = make_stats_allocations;
    37553760          else if (!strcmp(argv[i], "allocated"))
     
    37633768          else if (!strcmp(argv[i], "ht_collisions_pct"))
    37643769            val = (make_stats_ht_collisions * 100) / make_stats_ht_lookups;
     3770#endif
    37653771          else
    37663772            {
     
    37733779        }
    37743780    }
     3781
    37753782  return o;
    37763783}
  • trunk/src/kmk/hash.c

    r1914 r1915  
    137137#endif
    138138
    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++);
    143141  for (;;)
    144142    {
     
    159157          if ((*ht->ht_compare) (key, *slot) == 0)
    160158            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++);
    165161        }
    166162      if (!hash_2)
     
    186182#endif
    187183
    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++);
    192186
    193187  /* first iteration unrolled. */
     
    203197        return slot;
    204198
    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++);
    209201    }
    210202  else
     
    233225            return slot;
    234226
    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++);
    239229        }
    240230
  • trunk/src/kmk/main.c

    r1882 r1915  
    329329#endif /* KMK */
    330330
    331 #ifdef CONFIG_WITH_MAKE_STATS
     331#if defined (CONFIG_WITH_MAKE_STATS) || defined (CONFIG_WITH_MINIMAL_STATS)
    332332/* When set, we'll gather expensive statistics like for the heap. */
    333333
     
    489489    { 'S', flag_off, &keep_going_flag, 1, 1, 0, 0, &default_keep_going_flag,
    490490      "no-keep-going" },
    491 #ifdef KMK
     491#if defined (CONFIG_WITH_MAKE_STATS) || defined (CONFIG_WITH_MINIMAL_STATS)
    492492    { CHAR_MAX+14, flag, (char *) &make_expensive_statistics, 1, 1, 1, 0, 0,
    493493       "statistics" },
     
    829829  errno = 0;
    830830  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));
    832833#endif
    833834}
     
    18401841    {
    18411842      struct stat st;
    1842       if ((   stat ("Makefile.kup", &st) == 0
    1843            && S_ISREG (st.st_mode) )
    1844        || (   stat ("makefile.kup", &st) == 0
    1845            && 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) ) )
    18461847       && stat ("Makefile.kmk", &st) < 0
    18471848       && stat ("makefile.kmk", &st) < 0)
     
    35313532    define_variable ("KMK_OPTS_AFFINITY", sizeof("KMK_OPTS_AFFINITY") - 1,
    35323533                     val, o_default, 1);
     3534#if defined (CONFIG_WITH_MAKE_STATS) || defined (CONFIG_WITH_MINIMAL_STATS)
    35333535    define_variable ("KMK_OPTS_STATISTICS", sizeof("KMK_OPTS_STATISTICS") - 1,
    35343536                     make_expensive_statistics ? "1" : "0", o_default, 1);
     3537# endif
    35353538  }
    35363539#endif
     
    36043607  if (!remote_description || *remote_description == '\0')
    36053608    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);
    36073610  else
    36083611    printf (_("\n%sThis program is built for %s/%s/%s (%s) [" __DATE__ " " __TIME__ "]\n"),
  • trunk/src/kmk/make.h

    r1897 r1915  
    660660extern int pretty_command_printing;
    661661#endif
    662 #ifdef CONFIG_WITH_MAKE_STATS
     662#if defined (CONFIG_WITH_MAKE_STATS) || defined (CONFIG_WITH_MINIMAL_STATS)
    663663extern int make_expensive_statistics;
    664664#endif
     
    880880# endif
    881881
     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)
    882889#endif
    883890
  • trunk/src/kmk/strcache2.c

    r1913 r1915  
    686686  assert (!cache->case_insensitive);
    687687
    688   cache->lookup_count++;
     688  MAKE_STATS (cache->lookup_count++);
    689689
    690690  /* Lookup the entry in the hash table, hoping for an
     
    696696  if (strcache2_is_equal (cache, entry, str, length, hash))
    697697    return (const char *)(entry + 1);
    698   cache->collision_1st_count++;
     698  MAKE_STATS (cache->collision_1st_count++);
    699699
    700700  entry = entry->next;
     
    703703  if (strcache2_is_equal (cache, entry, str, length, hash))
    704704    return (const char *)(entry + 1);
    705   cache->collision_2nd_count++;
     705  MAKE_STATS (cache->collision_2nd_count++);
    706706
    707707  /* Loop the rest.  */
     
    713713      if (strcache2_is_equal (cache, entry, str, length, hash))
    714714        return (const char *)(entry + 1);
    715       cache->collision_3rd_count++;
     715      MAKE_STATS (cache->collision_3rd_count++);
    716716    }
    717717  /* not reached */
     
    734734#endif /* NDEBUG */
    735735
    736   cache->lookup_count++;
     736  MAKE_STATS (cache->lookup_count++);
    737737
    738738  /* Lookup the entry in the hash table, hoping for an
     
    744744  if (strcache2_is_equal (cache, entry, str, length, hash))
    745745    return (const char *)(entry + 1);
    746   cache->collision_1st_count++;
     746  MAKE_STATS (cache->collision_1st_count++);
    747747
    748748  entry = entry->next;
     
    751751  if (strcache2_is_equal (cache, entry, str, length, hash))
    752752    return (const char *)(entry + 1);
    753   cache->collision_2nd_count++;
     753  MAKE_STATS (cache->collision_2nd_count++);
    754754
    755755  /* Loop the rest.  */
     
    761761      if (strcache2_is_equal (cache, entry, str, length, hash))
    762762        return (const char *)(entry + 1);
    763       cache->collision_3rd_count++;
     763      MAKE_STATS (cache->collision_3rd_count++);
    764764    }
    765765  /* not reached */
     
    776776  assert (!cache->case_insensitive);
    777777
    778   cache->lookup_count++;
     778  MAKE_STATS (cache->lookup_count++);
    779779
    780780  /* Lookup the entry in the hash table, hoping for an
     
    786786  if (strcache2_is_equal (cache, entry, str, length, hash))
    787787    return (const char *)(entry + 1);
    788   cache->collision_1st_count++;
     788  MAKE_STATS (cache->collision_1st_count++);
    789789
    790790  entry = entry->next;
     
    793793  if (strcache2_is_equal (cache, entry, str, length, hash))
    794794    return (const char *)(entry + 1);
    795   cache->collision_2nd_count++;
     795  MAKE_STATS (cache->collision_2nd_count++);
    796796
    797797  /* Loop the rest. */
     
    803803      if (strcache2_is_equal (cache, entry, str, length, hash))
    804804        return (const char *)(entry + 1);
    805       cache->collision_3rd_count++;
     805      MAKE_STATS (cache->collision_3rd_count++);
    806806    }
    807807  /* not reached */
     
    820820  assert (!cache->case_insensitive);
    821821
    822   cache->lookup_count++;
     822  MAKE_STATS (cache->lookup_count++);
    823823
    824824  /* Lookup the entry in the hash table, hoping for an
     
    830830  if (strcache2_is_equal (cache, entry, str, length, hash))
    831831    return (const char *)(entry + 1);
    832   cache->collision_1st_count++;
     832  MAKE_STATS (cache->collision_1st_count++);
    833833
    834834  entry = entry->next;
     
    837837  if (strcache2_is_equal (cache, entry, str, length, hash))
    838838    return (const char *)(entry + 1);
    839   cache->collision_2nd_count++;
     839  MAKE_STATS (cache->collision_2nd_count++);
    840840
    841841  /* Loop the rest. */
     
    847847      if (strcache2_is_equal (cache, entry, str, length, hash))
    848848        return (const char *)(entry + 1);
    849       cache->collision_3rd_count++;
     849      MAKE_STATS (cache->collision_3rd_count++);
    850850    }
    851851  /* not reached */
     
    868868#endif /* NDEBUG */
    869869
    870   cache->lookup_count++;
     870  MAKE_STATS (cache->lookup_count++);
    871871
    872872  /* Lookup the entry in the hash table, hoping for an
     
    878878  if (strcache2_is_equal (cache, entry, str, length, hash))
    879879    return (const char *)(entry + 1);
    880   cache->collision_1st_count++;
     880  MAKE_STATS (cache->collision_1st_count++);
    881881
    882882  entry = entry->next;
     
    885885  if (strcache2_is_equal (cache, entry, str, length, hash))
    886886    return (const char *)(entry + 1);
    887   cache->collision_2nd_count++;
     887  MAKE_STATS (cache->collision_2nd_count++);
    888888
    889889  /* Loop the rest. */
     
    895895      if (strcache2_is_equal (cache, entry, str, length, hash))
    896896        return (const char *)(entry + 1);
    897       cache->collision_3rd_count++;
     897      MAKE_STATS (cache->collision_3rd_count++);
    898898    }
    899899  /* not reached */
     
    910910  assert (!cache->case_insensitive);
    911911
    912   cache->lookup_count++;
     912  MAKE_STATS (cache->lookup_count++);
    913913
    914914  /* Lookup the entry in the hash table, hoping for an
     
    920920  if (strcache2_is_equal (cache, entry, str, length, hash))
    921921    return (const char *)(entry + 1);
    922   cache->collision_1st_count++;
     922  MAKE_STATS (cache->collision_1st_count++);
    923923
    924924  entry = entry->next;
     
    927927  if (strcache2_is_equal (cache, entry, str, length, hash))
    928928    return (const char *)(entry + 1);
    929   cache->collision_2nd_count++;
     929  MAKE_STATS (cache->collision_2nd_count++);
    930930
    931931  /* Loop the rest. */
     
    937937      if (strcache2_is_equal (cache, entry, str, length, hash))
    938938        return (const char *)(entry + 1);
    939       cache->collision_3rd_count++;
     939      MAKE_STATS (cache->collision_3rd_count++);
    940940    }
    941941  /* not reached */
  • trunk/src/kmk/variable.c

    r1914 r1915  
    3333#ifdef KMK
    3434# include "kbuild.h"
     35#endif
     36#ifdef CONFIG_WITH_STRCACHE2
     37# include <stddef.h>
    3538#endif
    3639
     
    229232    }
    230233  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    }
    232238#endif /* CONFIG_WITH_STRCACHE2 */
    233239  if (! HASH_VACANT (v))
     
    466472  hash_1 = strcache2_calc_ptr_hash (&variable_strcache, name);
    467473  ht = &setlist->set->table;
     474  MAKE_STATS (ht->ht_lookups++);
    468475  idx = hash_1 & (ht->ht_size - 1);
    469476  v = ht->ht_vec[idx];
     
    481488          idx &= (ht->ht_size - 1);
    482489          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. */
    484491
    485492          if (v == 0)
     
    510517      /* first iteration unrolled */
    511518      ht = &setlist->set->table;
     519      MAKE_STATS (ht->ht_lookups++);
    512520      idx = hash_1 & (ht->ht_size - 1);
    513521      v = ht->ht_vec[idx];
     
    524532              idx &= (ht->ht_size - 1);
    525533              v = (struct variable *) ht->ht_vec[idx];
    526               ht->ht_collisions++; /* see reason above */
     534              MAKE_STATS (ht->ht_collisions++); /* see reason above */
    527535
    528536              if (v == 0)
     
    11581166  && defined (CONFIG_WITH_WHICH) \
    11591167  && defined (CONFIG_WITH_EVALPLUS) \
    1160   && defined (CONFIG_WITH_MAKE_STATS) \
     1168  && (defined (CONFIG_WITH_MAKE_STATS) || defined (CONFIG_WITH_MINIMAL_STATS)) \
    11611169  && defined (CONFIG_WITH_COMMANDS_FUNC) \
    11621170  && defined (KMK_HELPERS)
     
    12341242  strcat (buf, " evalctx evalval evalvalctx evalcall evalcall2");
    12351243#  endif
    1236 #  if defined (CONFIG_WITH_MAKE_STATS)
     1244#  if defined (CONFIG_WITH_MAKE_STATS) || defined (CONFIG_WITH_MINIMAL_STATS)
    12371245  strcat (buf, " make-stats");
    12381246#  endif
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette