Skip to content

Commit

Permalink
Fix: initialize the correct ammount of plot location
Browse files Browse the repository at this point in the history
  • Loading branch information
Syllo committed Aug 22, 2020
1 parent 2f401bf commit 71b7f96
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ static void initialize_all_windows(struct nvtop_interface *dwin) {
struct window_position *plot_positions = NULL;

enum plot_type plot_type;
compute_sizes_from_layout(dwin->show_plot, true, true, dwin->num_devices, 2,
compute_sizes_from_layout(dwin->show_plot, true, true, num_devices, 2,
3, device_length(), rows - 1, cols,
device_positions, &process_position,
&dwin->num_plots, &plot_positions, &plot_type);
Expand Down
9 changes: 7 additions & 2 deletions src/interface_layout_selection.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ void compute_sizes_from_layout(
rows_for_process += rows_left - 1;
}
if (num_plot_stacks > 0) {
// Allocate new plot stack is enough vertical room
// Allocate a new plot stack if there is enough vertical room
while (num_plot_stacks < *num_plots &&
rows_left / (num_plot_stacks + 1) >= 11 &&
(num_plot_stacks + 1) * min_plot_rows <= rows_left)
Expand Down Expand Up @@ -170,11 +170,16 @@ void compute_sizes_from_layout(
unsigned rows_per_stack = rows_left / num_plot_stacks;
if (rows_per_stack > 23)
rows_per_stack = 23;
unsigned plot_per_row = (*num_plots + (*num_plots % num_plot_stacks)) / num_plot_stacks;
unsigned plot_per_row = *num_plots / num_plot_stacks;
unsigned stacks_with_extra_plot = *num_plots % num_plot_stacks;
unsigned num_plot_done = 0;
unsigned currentPosX = 0, currentPosY = rows_for_header;
for (unsigned i = 0; i < num_plot_stacks; ++i) {
unsigned plot_in_this_row = min(*num_plots - num_plot_done, plot_per_row);
if (stacks_with_extra_plot) {
plot_in_this_row++;
stacks_with_extra_plot--;
}
unsigned cols_per_plot = cols / plot_in_this_row;
if (*plot_types == plot_gpu_duo)
cols_per_plot -= (cols_per_plot - cols_needed_box_drawing) %
Expand Down

0 comments on commit 71b7f96

Please sign in to comment.