示例#1
0
static void
print_memory_node(FILE *words_fptr, FILE *cells_fptr, MR_memprof_record *node)
{
    if (node != NULL) {
        MR_Dword    cells;
        MR_Dword    words;
        double      cells_double;
        double      words_double;

        cells = node->counter.cells_at_period_start;
        words = node->counter.words_at_period_start;

        MR_add_two_dwords(cells, node->counter.cells_since_period_start);
        MR_add_two_dwords(words, node->counter.words_since_period_start);

        MR_convert_dword_to_double(words, words_double);
        MR_convert_dword_to_double(cells, cells_double);

        fprintf(words_fptr, "%ld %.0f\n", (long) node->proc, words_double);
        fprintf(cells_fptr, "%ld %.0f\n", (long) node->proc, cells_double);

        print_memory_node(words_fptr, cells_fptr, node->left);
        print_memory_node(words_fptr, cells_fptr, node->right);
    }
}
示例#2
0
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);
}