static void render_map(WholeSpace *priv) { int i; // Clear vis window werase(priv->vis); for (i = 0; i < priv->nb_blocks; i += priv->blocks_per_vis) { int64_t end_blk_index = (i + priv->blocks_per_vis < priv->nb_blocks) ? i + priv->blocks_per_vis : priv->nb_blocks; int j; int this_cell_fully_processed = 1; int errors_in_this_cell = 0; for (j = i; j < end_blk_index; j++) { if (priv->blocks_map[j] == 2) { errors_in_this_cell = 1; break; } if (!priv->blocks_map[j]) this_cell_fully_processed = 0; } if (errors_in_this_cell) print_vis(priv->vis, error_vis[3]); else if (!this_cell_fully_processed) print_vis(priv->vis, bs_vis[0]); // gray light shade else print_vis(priv->vis, bs_vis[3]); // green shade } wnoutrefresh(priv->vis); }
void show_legend(WINDOW *win) { unsigned int i; for (i = 0; i < sizeof(bs_vis)/sizeof(*bs_vis); i++) { print_vis(win, bs_vis[i]); wattrset(win, A_NORMAL); wprintw(win, " <%"PRIu64"ms\n", bs_vis[i].access_time / 1000); } print_vis(win,exceed_vis); wattrset(win, A_NORMAL); wprintw(win, " >500ms\n"); print_vis(win, error_vis); wattrset(win, A_NORMAL); wprintw(win, " ERR\n"); wrefresh(win); }
void whole_space_show_legend(WholeSpace *priv) { WINDOW *win = priv->legend; print_vis(win, bs_vis[0]); wattrset(win, A_NORMAL); wprintw(win, " unread space\n\n"); print_vis(win, bs_vis[3]); wattrset(win, A_NORMAL); wprintw(win, " copied space,\n no read errors\n"); print_vis(win, error_vis[3]); wattrset(win, A_NORMAL); wprintw(win, " read errors\n occured\n"); wprintw(win, "Display block is %"PRId64" blocks by %d sectors\n", priv->blocks_per_vis, priv->sectors_per_block); wrefresh(win); }
static void render_update_vis(SlidingWindow *priv, blk_report_t *rep) { if (rep->report.blk_status) { print_vis(priv->vis, error_vis[rep->report.blk_status]); priv->error_stats_accum[rep->report.blk_status]++; } else { print_vis(priv->vis, choose_vis(rep->report.blk_access_time)); unsigned int i; for (i = 0; i < 5; i++) if (rep->report.blk_access_time < bs_vis[i].access_time) { priv->access_time_stats_accum[i]++; break; } if (i == 5) priv->access_time_stats_accum[5]++; // of exceed } wnoutrefresh(priv->vis); }
static void render_update_stats(WholeSpace *priv) { if (priv->avg_processing_speed != 0) { werase(priv->avg_speed); wprintw(priv->avg_speed, "SPEED %7"PRIu64" kb/s", priv->avg_processing_speed / 1024); wnoutrefresh(priv->avg_speed); } if (priv->eta_time != 0) { unsigned int minute, second; second = priv->eta_time % 60; minute = priv->eta_time / 60; werase(priv->eta); wprintw(priv->eta, "ETA %11u:%02u", minute, second); wnoutrefresh(priv->eta); } werase(priv->w_cur_lba); char comma_lba_buf[30], *comma_lba_p; comma_lba_p = commaprint(priv->cur_lba, comma_lba_buf, sizeof(comma_lba_buf)); wprintw(priv->w_cur_lba, "LBA: %14s", comma_lba_p); wnoutrefresh(priv->w_cur_lba); werase(priv->w_stats); print_vis(priv->w_stats, bs_vis[0]); wattrset(priv->w_stats, A_NORMAL); wprintw(priv->w_stats, " %"PRIu64"\n", priv->unread_count); print_vis(priv->w_stats, bs_vis[3]); wattrset(priv->w_stats, A_NORMAL); wprintw(priv->w_stats, " %"PRIu64"\n", priv->read_ok_count); print_vis(priv->w_stats, error_vis[3]); wattrset(priv->w_stats, A_NORMAL); wprintw(priv->w_stats, " %"PRIu64"\n", priv->errors_count); wnoutrefresh(priv->w_stats); }