Exemplo n.º 1
0
Arquivo: subp.c Projeto: flavioc/XSB
/*
 * Called through builtins statistics/1 and statistics/0.
 * ( statistics :- statistics(1). )
 */
void print_statistics(CTXTdeclc int amount) {

  switch (amount) {

  case 0:		    /* Reset Statistical Parameters */
#ifndef MULTI_THREAD
    realtime_count_gl = real_time();
    perproc_reset_stat();	/* reset op-counts, starting time, and 'tds'
				   struct variable (all 0's) */
    reset_stat_total(); 	/* reset 'ttt' struct variable (all 0's) */
    xsb_mesg("Statistics is reset.");
    break;
#else
    realtime_count_gl = real_time();
    break;
#endif

  case 1:		    /* Default use: Print Stack Usage and CPUtime: */
    perproc_stat();		/* move max usage into 'ttt' struct variable */
    total_stat(CTXTc real_time()-realtime_count_gl);   /* print */
    reset_stat_total(); 	/* reset 'ttt' struct variable (all 0's) */
    break;

  case 2:		    /* Print Detailed Table Usage */
    print_detailed_tablespace_stats(CTXT);
    break;

  case 3:		    /* Print Detailed Table, Stack, and CPUtime */
#ifndef MULTI_THREAD
    perproc_stat();
    total_stat(CTXTc real_time()-realtime_count_gl);
    reset_stat_total();
    print_detailed_tablespace_stats(CTXT);
    print_detailed_subsumption_stats();
    break;
#else
    fprintf(stdwarn,"statistics(3) not yet implemented for MT engine\n");
    break;
#endif
  case 4:                  /* mutex use (if PROFILE_MUTEXES is defined) */
    print_mutex_use();
    print_mem_allocs();
    break;
  case 5:
    dis(0); 
    break;		/* output memory image - data only; for debugging */
  case 6:
    dis(1); 
    break;		/* output memory image - data + text; for debugging */
#ifdef CP_DEBUG
  case 7:
    print_cp_backtrace();
    break;
#endif
  case 8:              /* print symbol/string statistics */
    symbol_table_stats();
    string_table_stats();
    break;
  }
}
Exemplo n.º 2
0
/*
 * Called through builtins statistics/1 and statistics/0.
 * ( statistics :- statistics(1). )
 */
void print_statistics(CTXTdeclc int choice) {

  switch (choice) {

  case STAT_RESET:		   
#ifndef MULTI_THREAD
    realtime_count_gl = real_time();
    reset_stat_counters();	/* reset op-counts */
    break;
#else
    realtime_count_gl = real_time();
    break;
#endif

  case STAT_DEFAULT:		    /* Default use: Print Stack Usage and CPUtime: */
#ifndef MULTI_THREAD
    cputime_count_gl = (cpu_time() - time_start_gl);
#endif
    total_stat(CTXTc real_time()-realtime_count_gl);   /* print */
    break;

  case STAT_TABLE:		    /* Print Detailed Table Usage */
    print_detailed_tablespace_stats(CTXT);
    break;

  case 3:		    /* Print Detailed Table, Stack, and CPUtime */
#ifndef MULTI_THREAD
    cputime_count_gl += (cpu_time() - time_start_gl);
    total_stat(CTXTc real_time()-realtime_count_gl);
    print_detailed_tablespace_stats(CTXT);
    print_detailed_subsumption_stats();
    break;
#else
    fprintf(stdwarn,"statistics(3) not yet implemented for MT engine\n");
    break;
#endif
  case STAT_MUTEX:                  /* mutex use (if PROFILE_MUTEXES is defined) */
    print_mutex_use();
    print_mem_allocs("stat_mutex");
    break;
  case 5:
    dis(0); 
    break;		/* output memory image - data only; for debugging */
  case 6:
    dis(1); 
    break;		/* output memory image - data + text; for debugging */
#ifdef CP_DEBUG
  case 7:
    print_cp_backtrace();
    break;
#endif
  case STAT_ATOM:              /* print symbol/string statistics */
    symbol_table_stats();
    string_table_stats();
    break;
  }
}