From 6e40b5bdce5bf8039889508644217e1747b34352 Mon Sep 17 00:00:00 2001 From: Danny Auble <da@schedmd.com> Date: Mon, 12 Sep 2011 13:34:04 -0700 Subject: [PATCH] BGQ - Alter tools to output multiple dimensional conn_type. --- src/api/block_info.c | 8 ++++---- src/sinfo/sinfo.c | 10 ++++++---- src/smap/partition_functions.c | 36 +++++++++++++++++++++------------- src/sview/block_info.c | 24 ++++++++++++++--------- 4 files changed, 47 insertions(+), 31 deletions(-) diff --git a/src/api/block_info.c b/src/api/block_info.c index 64a58ccad6b..06aa3f86a4d 100644 --- a/src/api/block_info.c +++ b/src/api/block_info.c @@ -115,7 +115,7 @@ char *slurm_sprint_block_info( block_info_t * block_ptr, int one_liner) { int j; - char tmp1[16]; + char tmp1[16], *tmp_char = NULL; char *out = NULL; char *line_end = "\n "; uint32_t cluster_flags = slurmdb_setup_cluster_flags(); @@ -137,10 +137,10 @@ char *slurm_sprint_block_info( xstrfmtcat(out, "JobRunning=%u ", block_ptr->job_running); else xstrcat(out, "JobRunning=NONE "); - + tmp_char = conn_type_string_full(block_ptr->conn_type); xstrfmtcat(out, "User=%s ConnType=%s", - block_ptr->owner_name, - conn_type_string(block_ptr->conn_type[0])); + block_ptr->owner_name, tmp_char); + xfree(tmp_char); if(cluster_flags & CLUSTER_FLAG_BGL) xstrfmtcat(out, " NodeUse=%s", node_use_string(block_ptr->node_use)); diff --git a/src/sinfo/sinfo.c b/src/sinfo/sinfo.c index 205c21d5ae8..33694653831 100644 --- a/src/sinfo/sinfo.c +++ b/src/sinfo/sinfo.c @@ -179,21 +179,23 @@ static int _bg_report(block_info_msg_t *block_ptr) } if (!params.no_header) - printf("BG_BLOCK MIDPLANES OWNER STATE CONNECTION USE\n"); + printf("BG_BLOCK MIDPLANES OWNER STATE CONNECTION USE\n"); /* 1234567890123456 123456789012 12345678 12345678 1234567890 12345+ */ /* RMP_22Apr1544018 bg[123x456] name READY TORUS COPROCESSOR */ for (i=0; i<block_ptr->record_count; i++) { - printf("%-16.16s %-12.12s %-8.8s %-8.8s %-10.10s %s\n", + char *conn_str = conn_type_string_full( + block_ptr->block_array[i].conn_type); + printf("%-16.16s %-15.15s %-8.8s %-8.8s %-10.10s %s\n", block_ptr->block_array[i].bg_block_id, block_ptr->block_array[i].mp_str, block_ptr->block_array[i].owner_name, bg_block_state_string( block_ptr->block_array[i].state), - conn_type_string( - block_ptr->block_array[i].conn_type[0]), + conn_str, node_use_string( block_ptr->block_array[i].node_use)); + xfree(conn_str); } return SLURM_SUCCESS; diff --git a/src/smap/partition_functions.c b/src/smap/partition_functions.c index 992bf0a71c1..f06d6c8625d 100644 --- a/src/smap/partition_functions.c +++ b/src/smap/partition_functions.c @@ -47,7 +47,7 @@ typedef struct { char *bg_block_name; - uint16_t bg_conn_type; + uint16_t bg_conn_type[HIGHEST_DIMENSIONS]; uint16_t bg_node_use; char *bg_user_name; char *ionode_str; @@ -304,8 +304,11 @@ extern void get_bg_part(void) block_ptr->bg_user_name = xstrdup(new_bg_ptr->block_array[i].owner_name); block_ptr->state = new_bg_ptr->block_array[i].state; - block_ptr->bg_conn_type = new_bg_ptr->block_array[i]. - conn_type[0]; + + memcpy(block_ptr->bg_conn_type, + new_bg_ptr->block_array[i].conn_type, + sizeof(block_ptr->bg_conn_type)); + if (params.cluster_flags & CLUSTER_FLAG_BGL) block_ptr->bg_node_use = new_bg_ptr->block_array[i].node_use; @@ -330,7 +333,7 @@ extern void get_bg_part(void) } block_ptr->job_running = new_bg_ptr->block_array[i].job_running; - if (block_ptr->bg_conn_type >= SELECT_SMALL) + if (block_ptr->bg_conn_type[0] >= SELECT_SMALL) block_ptr->size = 0; list_append(block_list, block_ptr); @@ -474,7 +477,7 @@ static void _print_header_part(void) mvwprintw(text_win, main_ycord, main_xcord, "CONN"); - main_xcord += 7; + main_xcord += 8; if (params.cluster_flags & CLUSTER_FLAG_BGL) { mvwprintw(text_win, main_ycord, @@ -504,7 +507,7 @@ static void _print_header_part(void) printf("STATE "); printf(" JOBID "); printf(" USER "); - printf(" CONN "); + printf(" CONN "); if (params.cluster_flags & CLUSTER_FLAG_BGL) printf(" NODE_USE "); } @@ -525,7 +528,7 @@ static int _print_text_part(partition_info_t *part_ptr, int prefixlen; int i = 0; int width = 0; - char *nodes = NULL, time_buf[20]; + char *nodes = NULL, time_buf[20], *conn_str = NULL; char tmp_cnt[8]; char tmp_char[8]; @@ -619,13 +622,15 @@ static int _print_text_part(partition_info_t *part_ptr, db2_info_ptr->bg_user_name); main_xcord += 9; + conn_str = conn_type_string_full( + db2_info_ptr->bg_conn_type); mvwprintw(text_win, main_ycord, - main_xcord, "%.5s", - conn_type_string( - db2_info_ptr-> - bg_conn_type)); - main_xcord += 7; + main_xcord, "%.7s", + conn_str); + xfree(conn_str); + main_xcord += 8; + if (params.cluster_flags & CLUSTER_FLAG_BGL) { mvwprintw(text_win, main_ycord, @@ -763,8 +768,11 @@ static int _print_text_part(partition_info_t *part_ptr, printf("%8.8s ", tmp_char); printf("%8.8s ", db2_info_ptr->bg_user_name); - printf("%5.5s ", conn_type_string( - db2_info_ptr->bg_conn_type)); + conn_str = conn_type_string_full( + db2_info_ptr->bg_conn_type); + printf("%8.8s ", conn_str); + xfree(conn_str); + if (params.cluster_flags & CLUSTER_FLAG_BGL) printf("%9.9s ", node_use_string( db2_info_ptr-> diff --git a/src/sview/block_info.c b/src/sview/block_info.c index 5adc7129e4b..bd15c926257 100644 --- a/src/sview/block_info.c +++ b/src/sview/block_info.c @@ -38,7 +38,7 @@ typedef struct { char *bg_block_name; char *slurm_part_name; char *mp_str; - uint16_t bg_conn_type; + uint16_t bg_conn_type[HIGHEST_DIMENSIONS]; uint16_t bg_node_use; uint16_t state; int size; @@ -227,6 +227,7 @@ static void _layout_block_record(GtkTreeView *treeview, int update) { char tmp_cnt[18]; + char *tmp_char = NULL; GtkTreeIter iter; GtkTreeStore *treestore = GTK_TREE_STORE(gtk_tree_view_get_model(treeview)); @@ -235,12 +236,13 @@ static void _layout_block_record(GtkTreeView *treeview, find_col_name(display_data_block, SORTID_NODELIST), block_ptr->mp_str); - + tmp_char = conn_type_string_full(block_ptr->bg_conn_type); add_display_treestore_line(update, treestore, &iter, find_col_name(display_data_block, SORTID_CONN), - conn_type_string( - block_ptr->bg_conn_type)); + tmp_char); + xfree(tmp_char); + if (cluster_flags & CLUSTER_FLAG_BGL) { add_display_treestore_line(update, treestore, &iter, find_col_name(display_data_block, @@ -315,6 +317,7 @@ static void _update_block_record(sview_block_info_t *block_ptr, GtkTreeStore *treestore, GtkTreeIter *iter) { char job_running[20], cnode_cnt[20]; + char *tmp_char = NULL; if (block_ptr->job_running > NO_JOB_RUNNING) snprintf(job_running, sizeof(job_running), @@ -325,14 +328,15 @@ static void _update_block_record(sview_block_info_t *block_ptr, convert_num_unit((float)block_ptr->cnode_cnt, cnode_cnt, sizeof(cnode_cnt), UNIT_NONE); + tmp_char = conn_type_string_full(block_ptr->bg_conn_type); + /* Combining these records provides a slight performance improvement */ gtk_tree_store_set(treestore, iter, SORTID_BLOCK, block_ptr->bg_block_name, SORTID_COLOR, sview_colors[block_ptr->color_inx], SORTID_COLOR_INX, block_ptr->color_inx, - SORTID_CONN, - conn_type_string(block_ptr->bg_conn_type), + SORTID_CONN, tmp_char, SORTID_IMAGERAMDISK, block_ptr->imageramdisk, SORTID_IMAGELINUX, block_ptr->imagelinux, SORTID_IMAGEMLOADER, block_ptr->imagemloader, @@ -347,6 +351,7 @@ static void _update_block_record(sview_block_info_t *block_ptr, SORTID_USER, block_ptr->bg_user_name, SORTID_UPDATED, 1, -1); + xfree(tmp_char); if (cluster_flags & CLUSTER_FLAG_BGL) { gtk_tree_store_set(treestore, iter, @@ -556,8 +561,9 @@ static List _create_block_list(partition_info_msg_t *part_info_ptr, block_ptr->state = block_info_ptr->block_array[i].state; - block_ptr->bg_conn_type - = block_info_ptr->block_array[i].conn_type[0]; + memcpy(block_ptr->bg_conn_type, + block_info_ptr->block_array[i].conn_type, + sizeof(block_ptr->bg_conn_type)); if (cluster_flags & CLUSTER_FLAG_BGL) block_ptr->bg_node_use @@ -578,7 +584,7 @@ static List _create_block_list(partition_info_msg_t *part_info_ptr, } block_ptr->job_running = block_info_ptr->block_array[i].job_running; - if (block_ptr->bg_conn_type >= SELECT_SMALL) + if (block_ptr->bg_conn_type[0] >= SELECT_SMALL) block_ptr->size = 0; list_append(block_list, block_ptr); -- GitLab