Changeset 2758 for trunk/src/kmk


Ignore:
Timestamp:
Jan 28, 2015, 2:03:58 PM (10 years ago)
Author:
bird
Message:

Some more variable stats I added the other day (not in release builds).

Location:
trunk/src/kmk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk/function.c

    r2702 r2758  
    20432043      size_t off;
    20442044      const struct floc *reading_file_saved = reading_file;
     2045#ifdef CONFIG_WITH_MAKE_STATS
     2046      unsigned long long uStartTick = CURRENT_CLOCK_TICK();
     2047      MAKE_STATS_2(v->cEvalVals++);
     2048#endif
    20452049
    20462050      /* Make a copy of the value to the variable buffer since
     
    20682072        pop_variable_scope ();
    20692073      restore_variable_buffer (buf, len);
     2074
     2075      MAKE_STATS_2(v->cTicksEvalVal += CURRENT_CLOCK_TICK() - uStartTick);
    20702076    }
    20712077
  • trunk/src/kmk/main.c

    r2717 r2758  
    13681368  PATH_VAR (current_directory);
    13691369  unsigned int restarts = 0;
     1370#ifdef CONFIG_WITH_MAKE_STATS
     1371  unsigned long long uStartTick = CURRENT_CLOCK_TICK();
     1372#endif
    13701373#ifdef WINDOWS32
    13711374  char *unix_path = NULL;
     
    29222925             _("warning:  Clock skew detected.  Your build may be incomplete."));
    29232926
     2927    MAKE_STATS_2(if (uStartTick) printf("main ticks elapsed: %ull\n", (unsigned long long)(CURRENT_CLOCK_TICK() - uStartTick)) );
    29242928    /* Exit.  */
    29252929    die (status);
  • trunk/src/kmk/make.h

    r2745 r2758  
    238238
    239239/* bird - start */
     240#ifdef _MSC_VER
     241# include <intrin.h>
     242# define CURRENT_CLOCK_TICK() __rdtsc()
     243#else
     244# define CURRENT_CLOCK_TICK() 0
     245#endif
     246
    240247#define COMMA ,
    241248#ifdef CONFIG_WITH_VALUE_LENGTH
  • trunk/src/kmk/variable.c

    r2752 r2758  
    448448  MAKE_STATS_2(v->reallocs = 0);
    449449  MAKE_STATS_2(v->references = 0);
     450  MAKE_STATS_2(v->cEvalVals = 0);
     451  MAKE_STATS_2(v->cTicksEvalVal = 0);
    450452
    451453  v->exportable = 1;
     
    605607      MAKE_STATS_2(v->changes = 0);
    606608      MAKE_STATS_2(v->reallocs = 0);
     609      MAKE_STATS_2(v->references = 0);
     610      MAKE_STATS_2(v->cEvalVals = 0);
     611      MAKE_STATS_2(v->cTicksEvalVal = 0);
    607612      v->exportable = 1;
    608613      if (*name != '_' && (*name < 'A' || *name > 'Z')
     
    894899      if (v != VAR_NOT_KBUILD_ACCESSOR)
    895900        {
    896           MAKE_STATS (v->references++);
     901          MAKE_STATS_2 (v->references++);
    897902          return v;
    898903        }
     
    929934          RESOLVE_ALIAS_VARIABLE(v);
    930935# endif
    931          MAKE_STATS (v->references++);
    932           return v->special ? lookup_special_var (v) : v;
     936          MAKE_STATS_2 (v->references++);
     937           return v->special ? lookup_special_var (v) : v;
    933938        }
    934939
     
    10321037        {
    10331038          RESOLVE_ALIAS_VARIABLE(v);
    1034           MAKE_STATS (v->references++);
     1039          MAKE_STATS_2 (v->references++);
    10351040          return v;
    10361041        }
     
    10601065  RESOLVE_ALIAS_VARIABLE(v);
    10611066# endif
    1062   MAKE_STATS (if (v) v->references++);
     1067  MAKE_STATS_2 (if (v) v->references++);
    10631068  return v;
    10641069#endif /* CONFIG_WITH_STRCACHE2 */
     
    27642769static unsigned long var_stats_reallocs, var_stats_realloced;
    27652770static unsigned long var_stats_references, var_stats_referenced;
     2771static unsigned long var_stats_evalvals, var_stats_evalvaled;
     2772static uintmax_t var_stats_evalval_ticks;
    27662773static unsigned long var_stats_val_len, var_stats_val_alloc_len;
    27672774static unsigned long var_stats_val_rdonly_len;
     
    28362843  var_stats_changes += v->changes;
    28372844  var_stats_changed += (v->changes != 0);
     2845
    28382846  if (v->reallocs != 0)
    28392847      printf (_(", %u reallocs"), v->reallocs);
    28402848  var_stats_reallocs += v->reallocs;
    28412849  var_stats_realloced += (v->reallocs != 0);
     2850
    28422851  if (v->references != 0)
    28432852      printf (_(", %u references"), v->references);
    28442853  var_stats_references += v->references;
    28452854  var_stats_referenced += (v->references != 0);
     2855
     2856  if (v->cEvalVals != 0)
     2857      //printf (_(", %u evalvals (%llu ticks)"), v->cEvalVals, v->cTicksEvalVal);
     2858      printf (_(", %u evalvals (%llu ms)"), v->cEvalVals, v->cTicksEvalVal / 3299998);
     2859  var_stats_evalvals += v->cEvalVals;
     2860  var_stats_evalvaled += (v->cEvalVals != 0);
     2861
    28462862  var_stats_val_len += v->value_length;
    28472863  if (v->value_alloc_len)
  • trunk/src/kmk/variable.h

    r2752 r2758  
    113113    unsigned int reallocs;     /* Realloc on value count.  */
    114114    unsigned int references;   /* Lookup count.  */
     115    unsigned cEvalVals;        /* $(evalval v) or $(evalvalctx v) count */
     116    unsigned long long cTicksEvalVal; /* Number of ticks spend in cEvalVal. */
    115117#endif
    116118  };
Note: See TracChangeset for help on using the changeset viewer.