示例#1
0
void display_wrapper_stats ()
{
  int largest;
  mps_lib_FILE *stream = mps_lib_get_stdout();
  char *message = "Start of heap statistics";
  mps_lib_fputc('\n', stream);
  mps_lib_fputs(message, stream);
  display_padding_for_string(message, ' ', class_name_size, stream);
  mps_lib_fputs("   (count)     (size)", stream);
  mps_lib_fputs("\n\n", stream);
  display_totals(stream);
  mps_lib_fputc('\n', stream);
  for (largest = biggest_below_value(very_big); 
       largest >= 0; 
       largest = biggest_below_value(largest)) {
    display_wrappers_of_size(largest, stream);
  }
  mps_lib_fputs("End of heap statistics\n\n", stream);
}
示例#2
0
int get_nodes_to_display(mon_disp_prop_t* display) {
    idata_t *infod_data = NULL;
    idata_entry_t *curInfoEntry = NULL;
    idata_iter_t *iter = NULL;

    mlog_bn_db("info", "Getting nodes to display\n");
    
    if (display == NULL)
        return 1;

    if (display->need_dest) {
        new_host(display, NULL);
        return 1;
    }

    // TODO : move this line out of here
    //bottom status line
    display_totals(display, display->show_status);

    if (!get_data_from_infod(display, &infod_data))
        return 0;

    display->last_host = display->info_src_host;

    // Calculating the memory size for each node and allocating memory
    if (display->raw_data == NULL) {
        allocate_display_raw_data_mem(display, infod_data->num);
    }

    //set needed info in the current_set
    set_settings(display, &current_set);

    if (!(iter = idata_iter_init(infod_data))) {
        free(infod_data);
        return 0;
    }

    // Setting the data in the raw data array (ordered as received from infod)
    // Which means ordered by IP
    int raw_index = 0;
    for (int i = 0; (curInfoEntry = idata_iter_next(iter)); i++) {
        // raw_index is advanced only if set_raw_data_item returns 1; If the node is filtered out we get 0
        if (set_raw_data_item(display, raw_index, curInfoEntry))
            raw_index++;
    }
    idata_iter_done(iter);

    display->nodes_count = raw_index;
    mlog_bn_db("info", "Data count : %d\n", display->nodes_count);

    // Sort the raw_data array by number
    qsort(display->raw_data,
            display->nodes_count,
            display->block_length,
            &compare_num);

    // Building the alive_arr
    int infodStatusItemId = dm_getIdByName("infod-status");

    for (int i = 0; i < display->nodes_count; i++) {
        void *raw_status_ptr =
                (void*) ((long) (display->raw_data) + (i * display->block_length) + get_pos(infodStatusItemId));
        int infod_status = (int) scalar_div_x(infodStatusItemId, raw_status_ptr, 1);
        display->alive_arr[i] = infod_status & INFOD_ALIVE;
    }

    free(infod_data);
    //free(temp);
    if (dbg_flg) fprintf(dbg_fp, "Data retrieved.\n");

    return 1;
}