+
+ print_key_title("READ B/s", line++);
+ scale_unit(tmp->fileread, unit);
+ wprintw(center, "%s", unit);
+
+ print_key_title("WRITE B/s", line++);
+ scale_unit(tmp->filewrite, unit);
+ wprintw(center, "%s", unit);
+
+ g_hash_table_iter_init(&iter, global_perf_liszt);
+ while (g_hash_table_iter_next (&iter, &key, (gpointer) &perfn1)) {
+ print_key_title((char *) key, line++);
+ perfn2 = g_hash_table_lookup(tmp->perf, (char *) key);
+ wprintw(center, "%d", perfn2 ? perfn2->count : 0);
+ }
+ line++;
+
+ wattron(center, A_BOLD);
+ mvwprintw(center, line, 1, "FD");
+ mvwprintw(center, line, 10, "READ");
+ mvwprintw(center, line, 17, "WRITE");
+ mvwprintw(center, line++, 24, "FILENAME");
+ wattroff(center, A_BOLD);
+
+ /*
+ * since the process_files_table array could contain NULL file structures,
+ * and that the positions inside the array is important (it is the FD), we
+ * need to create a temporary array that we can sort.
+ */
+ for (i = 0; i < tmp->process_files_table->len; i++) {
+ file_tmp = g_ptr_array_index(tmp->process_files_table, i);
+ if (file_tmp)
+ g_ptr_array_add(newfilearray, file_tmp);
+ }
+
+ if (fileview[0].sort == 1)
+ g_ptr_array_sort(newfilearray, sort_by_file_fd_desc);
+ else if (fileview[1].sort == 1)
+ g_ptr_array_sort(newfilearray, sort_by_file_read_desc);
+ else if (fileview[2].sort == 1)
+ g_ptr_array_sort(newfilearray, sort_by_file_write_desc);
+ else
+ g_ptr_array_sort(newfilearray, sort_by_file_read_desc);
+
+ for (i = selected_line; i < newfilearray->len &&
+ i < (selected_line + max_center_lines - line + 2); i++) {
+ file_tmp = g_ptr_array_index(newfilearray, i);
+ if (!file_tmp)
+ continue;
+ mvwprintw(center, line + j, 1, "%d", file_tmp->fd);
+ scale_unit(file_tmp->read, unit);
+ mvwprintw(center, line + j, 10, "%s", unit);
+ scale_unit(file_tmp->write, unit);
+ mvwprintw(center, line + j, 17, "%s", unit);
+ snprintf(filename_buf, COLS - 25, "%s", file_tmp->name);
+ mvwprintw(center, line + j, 24, "%s", filename_buf);
+ j++;
+ }
+ g_ptr_array_free(newfilearray, TRUE);