Changeset 1918 for trunk/src/kmk/main.c


Ignore:
Timestamp:
Oct 23, 2008, 11:27:11 PM (17 years ago)
Author:
bird
Message:

kmk: New switch --print-stats which will print variable, file, strcache, allocation and heap statistics.

File:
1 edited

Legend:

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

    r1915 r1918  
    8383void verify_file_data_base (void);
    8484
     85#ifdef CONFIG_WITH_PRINT_STATS_SWITCH
     86void print_variable_stats (void);
     87void print_file_stats (void);
     88#endif
     89
    8590#if defined HAVE_WAITPID || defined HAVE_WAIT3
    8691# define HAVE_WAIT_NOHANG
     
    172177
    173178int pretty_command_printing;
     179#endif
     180
     181#ifdef CONFIG_WITH_PRINT_STATS_SWITCH
     182/* Nonzero means to print internal statistics before exiting. */
     183
     184int print_stats_flag;
    174185#endif
    175186
     
    476487       "pretty-command-printing" },
    477488#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
    478493#ifdef KMK
    479     { CHAR_MAX+11, positive_int, (char *) &process_priority, 1, 1, 0,
     494    { CHAR_MAX+12, positive_int, (char *) &process_priority, 1, 1, 0,
    480495      (char *) &process_priority, (char *) &process_priority, "priority" },
    481     { CHAR_MAX+12, positive_int, (char *) &process_affinity, 1, 1, 0,
     496    { CHAR_MAX+14, positive_int, (char *) &process_affinity, 1, 1, 0,
    482497      (char *) &process_affinity, (char *) &process_affinity, "affinity" },
    483498#endif
     
    490505      "no-keep-going" },
    491506#if defined (CONFIG_WITH_MAKE_STATS) || defined (CONFIG_WITH_MINIMAL_STATS)
    492     { CHAR_MAX+14, flag, (char *) &make_expensive_statistics, 1, 1, 1, 0, 0,
     507    { CHAR_MAX+15, flag, (char *) &make_expensive_statistics, 1, 1, 1, 0, 0,
    493508       "statistics" },
    494509#endif
     
    36533668  printf (_("\n# Finished Make data base on %s\n"), ctime (&when));
    36543669}
     3670#ifdef CONFIG_WITH_PRINT_STATS_SWITCH
     3671
     3672static void
     3673print_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
    36553696
    36563697static void
     
    37343775      if (print_data_base_flag)
    37353776        print_data_base ();
     3777
     3778#ifdef CONFIG_WITH_PRINT_STATS_SWITCH
     3779      if (print_stats_flag)
     3780        print_stats ();
     3781#endif
    37363782
    37373783#ifdef NDEBUG /* bird: Don't waste time on debug sanity checks.  */
Note: See TracChangeset for help on using the changeset viewer.