static void prof_output_addr_table(void) { FILE *fptr; int i; double scale; double rate; fptr = MR_checked_fopen("Prof.Counts", "create", "w"); /* ** Write out header line indicating what we are profiling, ** the scale factor, and the units. ** The scale factor is the time per profiling interrupt. ** The units are seconds. */ scale = (double) MR_CLOCK_TICKS_PER_PROF_SIG / (double) MR_CLOCK_TICKS_PER_SECOND; fprintf(fptr, "%s %f %s\n", MR_time_method, scale, "seconds"); /* ** Write out the time profiling data: one one-line entry per node. */ for (i = 0; i < TIME_TABLE_SIZE ; i++) { print_time_node(fptr, addr_table[i]); } MR_checked_fclose(fptr, "Prof.Counts"); }
void MR_close_prof_decl_file(void) { #ifdef MR_MPROF_PROFILE_CALLS if (MR_prof_decl_fptr) { MR_checked_fclose(MR_prof_decl_fptr, "Prof.Decl"); } #endif }
static void prof_output_mem_tables(void) { FILE *words_fptr; FILE *cells_fptr; int i; words_fptr = MR_checked_fopen("Prof.MemoryWords", "create", "w"); cells_fptr = MR_checked_fopen("Prof.MemoryCells", "create", "w"); fprintf(words_fptr, "%s %f %s\n", "memory-words", 0.001, "kilowords"); fprintf(cells_fptr, "%s %f %s\n", "memory-cells", 0.001, "kilocells"); print_memory_node(words_fptr, cells_fptr, MR_memprof_procs.root); MR_checked_fclose(words_fptr, "Prof.MemoryWords"); MR_checked_fclose(cells_fptr, "Prof.MemoryCells"); }
static void prof_output_addr_pair_table(void) { FILE *fptr; int i; fptr = MR_checked_fopen("Prof.CallPair", "create", "w"); for (i = 0; i < CALL_TABLE_SIZE ; i++) { print_addr_pair_node(fptr, addr_pair_table[i]); } MR_checked_fclose(fptr, "Prof.CallPair"); }
void MR_print_stack_frame_stats(void) { FILE *fp; double det_frame_count; double det_frame_total_size; double non_frame_count; double non_frame_total_size; fp = MR_checked_fopen(MR_STACK_FRAME_STATS, "open", "a"); MR_convert_dword_to_double(MR_det_frame_count, det_frame_count); MR_convert_dword_to_double(MR_det_frame_total_size, det_frame_total_size); MR_convert_dword_to_double(MR_non_frame_count, non_frame_count); MR_convert_dword_to_double(MR_non_frame_total_size, non_frame_total_size); fprintf(fp, "number of det stack frames created: %.0f\n", det_frame_count); fprintf(fp, "number of words in det stack frames: %.0f\n", det_frame_total_size); fprintf(fp, "average size of a det stack frame: %.3f\n", det_frame_total_size / det_frame_count); fprintf(fp, "max size of det stack: %ld\n", (long) (MR_det_frame_max - MR_CONTEXT(MR_ctxt_detstack_zone)->min)); fprintf(fp, "\n"); fprintf(fp, "number of non stack frames created: %.0f\n", non_frame_count); fprintf(fp, "number of words in non stack frames: %.0f\n", non_frame_total_size); fprintf(fp, "average size of a non stack frame: %.3f\n", non_frame_total_size / non_frame_count); fprintf(fp, "max size of non stack: %ld\n", (long) (MR_non_frame_max - MR_CONTEXT(MR_ctxt_nondetstack_zone)->min)); fprintf(fp, "-------------------------------------------\n"); MR_checked_fclose(fp, MR_STACK_FRAME_STATS); }