Пример #1
0
void CompilationStatsData :: translateToExternalFormat(SQL_COMPILATION_STATS_DATA *query_cmp_data)
{
  query_cmp_data->compileStartTime 
    = compileStartTime();

  query_cmp_data->compileEndTime
    = compileEndTime();

  if ( query_cmp_data->compileEndTime == 0)
    {
      query_cmp_data->compileEndTime = NA_ConvertTimestamp(NA_JulianTimestamp()) ;
    }

  str_cpy_all(query_cmp_data->compilerId,
	      compilerId(),
	      COMPILER_ID_LEN);

  query_cmp_data->cmpCpuTotal
    = cmpCpuTotal();

  query_cmp_data->cmpCpuBinder
    = cmpCpuBinder();

  query_cmp_data->cmpCpuNormalizer
    = cmpCpuNormalizer();

  query_cmp_data->cmpCpuAnalyzer
    = cmpCpuAnalyzer();

  query_cmp_data->cmpCpuOptimizer
    = cmpCpuOptimizer();
  query_cmp_data->cmpCpuGenerator
    = cmpCpuGenerator();

  query_cmp_data->metadataCacheHits
    = metadataCacheHits();

  query_cmp_data->metadataCacheLookups
    = metadataCacheLookups();

  query_cmp_data->queryCacheState
    = queryCacheState();

  query_cmp_data->histogramCacheHits
    = histogramCacheHits();

  query_cmp_data->histogramCacheLookups
    = histogramCacheLookups();

  query_cmp_data->stmtHeapSize
    = stmtHeapSize();

}
void CompilationStats::dumpToFile()
{
  FILE *myf = fopen ("CmpStatsDump", "ac");
  fprintf(myf, "---========= BEGIN NEW STMT STATS =========---\n");

  char beginTime[100];
  char endTime[100];
  getTimestampAsBuffer(compileStartTime_, beginTime);
  getTimestampAsBuffer(compileEndTime_, endTime);

  fprintf(myf, "  Compilation Start Time: %s\n", beginTime);
  fprintf(myf, "  Compilation End Time: %s\n", endTime); 

  char cmpId[COMPILER_ID_LEN];
  getCompilerId(cmpId);
  fprintf(myf, "  Compiler Id: %s\n", cmpId);
  fprintf(myf, "  All Cmp Phases Execution length: \n");
  fprintf(myf, "    Binder: %d\n", cmpPhaseLength(CompilationStats::CMP_PHASE_BINDER));
  fprintf(myf, "    normalizer: %d\n", cmpPhaseLength(CompilationStats::CMP_PHASE_NORMALIZER));
  fprintf(myf, "    Analyzer: %d\n", cmpPhaseLength(CompilationStats::CMP_PHASE_ANALYZER));
  fprintf(myf, "    Optimizer: %d\n", cmpPhaseLength(CompilationStats::CMP_PHASE_OPTIMIZER));
  fprintf(myf, "    Generator: %d\n", cmpPhaseLength(CompilationStats::CMP_PHASE_GENERATOR));
  fprintf(myf, "    All Cmp Length: %d\n", cmpPhaseLength(CompilationStats::CMP_PHASE_ALL));
  fprintf(myf, "  Metadata Cache Hits: %d\n", metadataCacheHits());
  fprintf(myf, "  Metadata Look Ups: %d\n", metadataCacheLookups());
  fprintf(myf, "  Query Cache Hits: %d\n", getQueryCacheState());
  fprintf(myf, "  Histogram Cache Hits: %d\n", histogramCacheHits());
  fprintf(myf, "  Histogram Cache Lookups: %d\n", histogramCacheLookups());
  fprintf(myf, "  Stmt Heap current Size: %ld\n", (Int64) stmtHeapCurrentSize());
  fprintf(myf, "  Context Heap current size: %ld\n", (Int64) cxtHeapCurrentSize());
  fprintf(myf, "  Compiler Optimization Tasks: %d\n", optimizationTasks());
  fprintf(myf, "  Compiler Optimization Contexts: %d\n", optimizationContexts());

  fprintf(myf, "  isRecompile: ");
  if (isRecompile())
      fprintf(myf, "Yes\n");
  else
      fprintf(myf, "No\n");

  fprintf(myf, "---========= END NEW STMT STATS =========---\n");
  fclose (myf);
}