From e937072b80515fdccf7db379e245454aca022813 Mon Sep 17 00:00:00 2001 From: Brian Christiansen <brian@schedmd.com> Date: Tue, 12 Apr 2016 15:02:11 -0700 Subject: [PATCH] Add --units=[KMGP] option to sacct to display values in specific unit type. Bug 1783 --- NEWS | 1 + doc/man/man1/sacct.1 | 5 ++ src/api/block_info.c | 4 +- src/api/config_info.c | 12 +++-- src/api/job_info.c | 14 +++--- src/api/job_step_info.c | 6 +-- src/api/partition_info.c | 17 +++---- src/common/cpu_frequency.c | 2 +- src/common/slurm_protocol_api.c | 38 +++++++++++++-- src/common/slurm_protocol_api.h | 5 +- src/sacct/options.c | 12 +++++ src/sacct/print.c | 40 +++++++-------- src/sacct/sacct.h | 3 +- src/sacctmgr/event_functions.c | 4 +- src/sinfo/print.c | 30 ++++++------ src/smap/job_functions.c | 5 +- src/smap/partition_functions.c | 2 +- src/squeue/print.c | 24 ++++----- src/sstat/print.c | 46 +++++++++--------- src/sview/bb_info.c | 16 +++--- src/sview/block_info.c | 12 ++--- src/sview/job_info.c | 86 +++++++++++++++++---------------- src/sview/node_info.c | 34 ++++++------- src/sview/part_info.c | 68 +++++++++++++------------- src/sview/resv_info.c | 8 +-- 25 files changed, 272 insertions(+), 222 deletions(-) diff --git a/NEWS b/NEWS index 8f4fe75c687..b8a5ae51269 100644 --- a/NEWS +++ b/NEWS @@ -26,6 +26,7 @@ documents those changes that are of interest to users and administrators. -- select/cray - Initiate step node health check at start of step termination rather than after application completely ends so that NHC can capture information about hung (non-killable) processes. + -- Add --units=[KMGP] option to sacct to display values in specific unit type. * Changes in Slurm 16.05.0pre2 ============================== diff --git a/doc/man/man1/sacct.1 b/doc/man/man1/sacct.1 index cef89b3bcfa..6a254e93f2d 100644 --- a/doc/man/man1/sacct.1 +++ b/doc/man/man1/sacct.1 @@ -400,6 +400,11 @@ would be truncated to \-\-starttime. The same for end time and \-\-endtime. Use this comma separated list of uids or user names to select jobs to display. By default, the running user's uid is used. +.TP +\f3\-\-units=[KMGP]\fP +Display values in specified unit type. Takes precedence over \-\-noconvert +option. + .TP \f3\-\-usage\fP Display a command usage summary. diff --git a/src/api/block_info.c b/src/api/block_info.c index 7bc0a59ba2a..86cd6523d8d 100644 --- a/src/api/block_info.c +++ b/src/api/block_info.c @@ -123,10 +123,10 @@ char *slurm_sprint_block_info( /****** Line 1 ******/ convert_num_unit((float)block_ptr->cnode_cnt, tmp1, sizeof(tmp1), - UNIT_NONE, CONVERT_NUM_UNIT_EXACT); + UNIT_NONE, NO_VAL, CONVERT_NUM_UNIT_EXACT); if (cluster_flags & CLUSTER_FLAG_BGQ) { convert_num_unit((float)block_ptr->cnode_err_cnt, tmp2, - sizeof(tmp2), UNIT_NONE, + sizeof(tmp2), UNIT_NONE, NO_VAL, CONVERT_NUM_UNIT_EXACT); tmp_char = xstrdup_printf("%s/%s", tmp1, tmp2); } else diff --git a/src/api/config_info.c b/src/api/config_info.c index e50ea003c3a..f1ac815191b 100644 --- a/src/api/config_info.c +++ b/src/api/config_info.c @@ -340,9 +340,10 @@ void slurm_write_ctl_conf ( slurm_ctl_conf_info_msg_t * slurm_ctl_conf_ptr, if (p[i].max_nodes != INFINITE) { char tmp1[16]; if (cluster_flags & CLUSTER_FLAG_BG) - convert_num_unit((float)p[i].max_nodes, tmp1, - sizeof(tmp1), UNIT_NONE, - CONVERT_NUM_UNIT_EXACT); + convert_num_unit((float)p[i].max_nodes, tmp1, + sizeof(tmp1), UNIT_NONE, + NO_VAL, + CONVERT_NUM_UNIT_EXACT); else snprintf(tmp1, sizeof(tmp1), "%u", p[i].max_nodes); @@ -360,9 +361,10 @@ void slurm_write_ctl_conf ( slurm_ctl_conf_info_msg_t * slurm_ctl_conf_ptr, if (p[i].min_nodes != 1) { char tmp1[16]; if (cluster_flags & CLUSTER_FLAG_BG) - convert_num_unit((float)p[i].min_nodes, tmp1, + convert_num_unit((float)p[i].min_nodes, tmp1, sizeof(tmp1), UNIT_NONE, - CONVERT_NUM_UNIT_EXACT); + NO_VAL, + CONVERT_NUM_UNIT_EXACT); else snprintf(tmp1, sizeof(tmp1), "%u", p[i].min_nodes); diff --git a/src/api/job_info.c b/src/api/job_info.c index a1531bf8328..305c2edafd1 100644 --- a/src/api/job_info.c +++ b/src/api/job_info.c @@ -286,15 +286,15 @@ static void _sprint_range(char *str, uint32_t str_size, if (cluster_flags & CLUSTER_FLAG_BG) { convert_num_unit((float)lower, tmp, sizeof(tmp), UNIT_NONE, - CONVERT_NUM_UNIT_EXACT); + NO_VAL, CONVERT_NUM_UNIT_EXACT); } else { snprintf(tmp, sizeof(tmp), "%u", lower); } if (upper > 0) { char tmp2[128]; if (cluster_flags & CLUSTER_FLAG_BG) { - convert_num_unit((float)upper, tmp2, - sizeof(tmp2), UNIT_NONE, + convert_num_unit((float)upper, tmp2, sizeof(tmp2), + UNIT_NONE, NO_VAL, CONVERT_NUM_UNIT_EXACT); } else { snprintf(tmp2, sizeof(tmp2), "%u", upper); @@ -796,8 +796,8 @@ slurm_sprint_job_info ( job_info_t * job_ptr, int one_liner ) tmp6_ptr = "Node"; if (cluster_flags & CLUSTER_FLAG_BG) { - convert_num_unit((float)job_ptr->pn_min_cpus, - tmp1, sizeof(tmp1), UNIT_NONE, + convert_num_unit((float)job_ptr->pn_min_cpus, tmp1, + sizeof(tmp1), UNIT_NONE, NO_VAL, CONVERT_NUM_UNIT_EXACT); xstrfmtcat(out, "MinCPUsNode=%s ", tmp1); } else { @@ -805,9 +805,9 @@ slurm_sprint_job_info ( job_info_t * job_ptr, int one_liner ) } convert_num_unit((float)job_ptr->pn_min_memory, tmp1, sizeof(tmp1), - UNIT_MEGA, CONVERT_NUM_UNIT_EXACT); + UNIT_MEGA, NO_VAL, CONVERT_NUM_UNIT_EXACT); convert_num_unit((float)job_ptr->pn_min_tmp_disk, tmp2, sizeof(tmp2), - UNIT_MEGA, CONVERT_NUM_UNIT_EXACT); + UNIT_MEGA, NO_VAL, CONVERT_NUM_UNIT_EXACT); xstrfmtcat(out, "MinMemory%s=%s MinTmpDiskNode=%s", tmp6_ptr, tmp1, tmp2); xstrcat(out, line_end); diff --git a/src/api/job_step_info.c b/src/api/job_step_info.c index 1eed1d90203..bed51e42015 100644 --- a/src/api/job_step_info.c +++ b/src/api/job_step_info.c @@ -236,12 +236,12 @@ slurm_sprint_job_step_info ( job_step_info_t * job_step_ptr, SELECT_JOBDATA_NODE_CNT, &nodes); convert_num_unit((float)nodes, tmp_node_cnt, - sizeof(tmp_node_cnt), UNIT_NONE, + sizeof(tmp_node_cnt), UNIT_NONE, NO_VAL, CONVERT_NUM_UNIT_EXACT); } else { convert_num_unit((float)_nodes_in_list(job_step_ptr->nodes), - tmp_node_cnt, sizeof(tmp_node_cnt), - UNIT_NONE, CONVERT_NUM_UNIT_EXACT); + tmp_node_cnt, sizeof(tmp_node_cnt), UNIT_NONE, + NO_VAL, CONVERT_NUM_UNIT_EXACT); } snprintf(tmp_line, sizeof(tmp_line), diff --git a/src/api/partition_info.c b/src/api/partition_info.c index fe1d846c5f2..b40eaaf4982 100644 --- a/src/api/partition_info.c +++ b/src/api/partition_info.c @@ -222,8 +222,8 @@ char *slurm_sprint_partition_info ( partition_info_t * part_ptr, xstrcat(out, "MaxNodes=UNLIMITED"); else { if (cluster_flags & CLUSTER_FLAG_BG) { - convert_num_unit((float)part_ptr->max_nodes, - tmp, sizeof(tmp), UNIT_NONE, + convert_num_unit((float)part_ptr->max_nodes, tmp, + sizeof(tmp), UNIT_NONE, NO_VAL, CONVERT_NUM_UNIT_EXACT); xstrfmtcat(out, "MaxNodes=%s", tmp); } else @@ -242,8 +242,7 @@ char *slurm_sprint_partition_info ( partition_info_t * part_ptr, if (cluster_flags & CLUSTER_FLAG_BG) { convert_num_unit((float)part_ptr->min_nodes, tmp, sizeof(tmp), - UNIT_NONE, - CONVERT_NUM_UNIT_EXACT); + UNIT_NONE, NO_VAL, CONVERT_NUM_UNIT_EXACT); xstrfmtcat(out, " MinNodes=%s", tmp); } else xstrfmtcat(out, " MinNodes=%u", part_ptr->min_nodes); @@ -317,18 +316,16 @@ char *slurm_sprint_partition_info ( partition_info_t * part_ptr, xstrcat(out, "State=UNKNOWN"); if (cluster_flags & CLUSTER_FLAG_BG) { - convert_num_unit((float)part_ptr->total_cpus, tmp, - sizeof(tmp), UNIT_NONE, - CONVERT_NUM_UNIT_EXACT); + convert_num_unit((float)part_ptr->total_cpus, tmp, sizeof(tmp), + UNIT_NONE, NO_VAL, CONVERT_NUM_UNIT_EXACT); xstrfmtcat(out, " TotalCPUs=%s", tmp); } else xstrfmtcat(out, " TotalCPUs=%u", part_ptr->total_cpus); if (cluster_flags & CLUSTER_FLAG_BG) { - convert_num_unit((float)part_ptr->total_nodes, tmp, - sizeof(tmp), UNIT_NONE, - CONVERT_NUM_UNIT_EXACT); + convert_num_unit((float)part_ptr->total_nodes, tmp, sizeof(tmp), + UNIT_NONE, NO_VAL, CONVERT_NUM_UNIT_EXACT); xstrfmtcat(out, " TotalNodes=%s", tmp); } else xstrfmtcat(out, " TotalNodes=%u", part_ptr->total_nodes); diff --git a/src/common/cpu_frequency.c b/src/common/cpu_frequency.c index bf2bbcbbbea..bc798e560a3 100644 --- a/src/common/cpu_frequency.c +++ b/src/common/cpu_frequency.c @@ -1228,7 +1228,7 @@ cpu_freq_to_string(char *buf, int buf_size, uint32_t cpu_freq) buf[0] = '\0'; } else convert_num_unit2((double)cpu_freq, buf, buf_size, - UNIT_KILO, 1000, 0); + UNIT_KILO, NO_VAL, 1000, 0); } /* diff --git a/src/common/slurm_protocol_api.c b/src/common/slurm_protocol_api.c index 2c20bfaec87..0e62e75f36f 100644 --- a/src/common/slurm_protocol_api.c +++ b/src/common/slurm_protocol_api.c @@ -4538,8 +4538,23 @@ extern int nodelist_find(const char *nodelist, const char *name) return id; } +/* + * Convert number from one unit to another. + * By default, Will convert num to largest divisible unit. + * Appends unit type suffix -- if applicable. + * + * IN num: number to convert. + * OUT buf: buffer to copy converted number into. + * IN buf_size: size of buffer. + * IN orig_type: The original type of num. + * IN spec_type: Type to convert num to. If specified, num will be converted up + * or down to to this unit type. + * IN divisor: size of type + * IN flags: flags to control whether to convert exactly or not at all. + */ extern void convert_num_unit2(double num, char *buf, int buf_size, - int orig_type, int divisor, uint32_t flags) + int orig_type, int spec_type, int divisor, + uint32_t flags) { char *unit = "\0KMGTP?"; uint64_t i; @@ -4547,7 +4562,7 @@ extern void convert_num_unit2(double num, char *buf, int buf_size, if ((int64_t)num == 0) { snprintf(buf, buf_size, "0"); return; - } else if (flags & CONVERT_NUM_UNIT_EXACT) { + } else if (spec_type == NO_VAL && (flags & CONVERT_NUM_UNIT_EXACT)) { i = (uint64_t)num % (divisor / 2); if (i > 0) { @@ -4557,7 +4572,19 @@ extern void convert_num_unit2(double num, char *buf, int buf_size, } } - if (!(flags & CONVERT_NUM_UNIT_NO)) { + if (spec_type != NO_VAL) { + if (spec_type < orig_type) { + while (spec_type < orig_type) { + num *= divisor; + orig_type--; + } + } else if (spec_type > orig_type) { + while (spec_type > orig_type) { + num /= divisor; + orig_type++; + } + } + } else if (!(flags & CONVERT_NUM_UNIT_NO)) { while (num > divisor) { num /= divisor; orig_type++; @@ -4578,9 +4605,10 @@ extern void convert_num_unit2(double num, char *buf, int buf_size, } extern void convert_num_unit(double num, char *buf, int buf_size, - int orig_type, uint32_t flags) + int orig_type, int spec_type, uint32_t flags) { - convert_num_unit2(num, buf, buf_size, orig_type, 1024, flags); + convert_num_unit2(num, buf, buf_size, orig_type, spec_type, 1024, + flags); } extern int revert_num_unit(const char *buf) diff --git a/src/common/slurm_protocol_api.h b/src/common/slurm_protocol_api.h index 4a906f3d1b6..21545c867ad 100644 --- a/src/common/slurm_protocol_api.h +++ b/src/common/slurm_protocol_api.h @@ -1267,9 +1267,10 @@ extern void slurm_free_msg(slurm_msg_t * msg); extern char *nodelist_nth_host(const char *nodelist, int inx); extern int nodelist_find(const char *nodelist, const char *name); extern void convert_num_unit2(double num, char *buf, int buf_size, - int orig_type, int divisor, uint32_t flags); + int orig_type, int spec_type, int divisor, + uint32_t flags); extern void convert_num_unit(double num, char *buf, int buf_size, - int orig_type, uint32_t flags); + int orig_type, int spec_type, uint32_t flags); extern int revert_num_unit(const char *buf); extern int get_convert_unit_val(int base_type, char convert_to); extern void parse_int_to_array(int in, int *out); diff --git a/src/sacct/options.c b/src/sacct/options.c index d66558a9e25..297ca0eaeb3 100644 --- a/src/sacct/options.c +++ b/src/sacct/options.c @@ -42,6 +42,7 @@ #include "src/common/read_config.h" #include "src/common/slurm_time.h" #include "src/common/uid.h" +#include "src/common/slurm_strcasestr.h" #include "sacct.h" #include <time.h> @@ -49,6 +50,7 @@ #define OPT_LONG_NAME 0x100 #define OPT_LONG_DELIMITER 0x101 #define OPT_LONG_NOCONVERT 0x102 +#define OPT_LONG_UNITS 0x103 void _help_fields_msg(void); void _help_msg(void); @@ -423,6 +425,7 @@ void _init_params() params.job_cond = xmalloc(sizeof(slurmdb_job_cond_t)); params.job_cond->without_usage_truncation = 1; params.convert_flags = CONVERT_NUM_UNIT_EXACT; + params.units = NO_VAL; } int get_data(void) @@ -526,6 +529,7 @@ void parse_command_line(int argc, char **argv) {"clusters", required_argument, 0, 'M'}, {"nodelist", required_argument, 0, 'N'}, {"noconvert", no_argument, 0, OPT_LONG_NOCONVERT}, + {"units", required_argument, 0, OPT_LONG_UNITS}, {"noheader", no_argument, 0, 'n'}, {"fields", required_argument, 0, 'o'}, {"format", required_argument, 0, 'o'}, @@ -673,6 +677,14 @@ void parse_command_line(int argc, char **argv) case OPT_LONG_NOCONVERT: params.convert_flags |= CONVERT_NUM_UNIT_NO; break; + case OPT_LONG_UNITS: + { + char *unit = "\0KMGTP?"; + char *tmp_str = slurm_strcasestr(unit + 1, optarg); + if (tmp_str) + params.units = tmp_str - unit; + } + break; case 'n': print_fields_have_header = 0; break; diff --git a/src/sacct/print.c b/src/sacct/print.c index 7db8ae44b6b..c32c1635f1a 100644 --- a/src/sacct/print.c +++ b/src/sacct/print.c @@ -111,7 +111,7 @@ static void _print_small_double( if (dub > 1) convert_num_unit((double)dub, outbuf, buf_size, units, - params.convert_flags); + params.units, params.convert_flags); else if (dub > 0) snprintf(outbuf, buf_size, "%.2fM", dub); else @@ -347,7 +347,7 @@ void print_fields(type_t type, void *object) tmp_int = tmp_uint64; } convert_num_unit((double)tmp_int, outbuf, - sizeof(outbuf), UNIT_NONE, + sizeof(outbuf), UNIT_NONE, NO_VAL, params.convert_flags); field->print_routine(field, outbuf, @@ -386,9 +386,9 @@ void print_fields(type_t type, void *object) } } if (!fuzzy_equal(tmp_dub, NO_VAL)) - convert_num_unit2((double)tmp_dub, - outbuf, sizeof(outbuf), - UNIT_KILO, 1000, + convert_num_unit2((double)tmp_dub, outbuf, + sizeof(outbuf), UNIT_KILO, + params.units, 1000, params.convert_flags & (~CONVERT_NUM_UNIT_EXACT)); @@ -500,8 +500,8 @@ void print_fields(type_t type, void *object) } if (!fuzzy_equal(tmp_dub, NO_VAL)) convert_num_unit((double)tmp_dub, outbuf, - sizeof(outbuf), - UNIT_KILO, + sizeof(outbuf), UNIT_KILO, + params.units, params.convert_flags); field->print_routine(field, @@ -525,8 +525,8 @@ void print_fields(type_t type, void *object) } if (!fuzzy_equal(tmp_dub, NO_VAL)) convert_num_unit((double)tmp_dub, outbuf, - sizeof(outbuf), - UNIT_KILO, + sizeof(outbuf), UNIT_KILO, + params.units, params.convert_flags); field->print_routine(field, @@ -551,8 +551,8 @@ void print_fields(type_t type, void *object) if (!fuzzy_equal(tmp_dub, NO_VAL)) convert_num_unit((double)tmp_dub, outbuf, - sizeof(outbuf), - UNIT_KILO, + sizeof(outbuf), UNIT_KILO, + params.units, params.convert_flags); field->print_routine(field, @@ -623,9 +623,9 @@ void print_fields(type_t type, void *object) } } if (!fuzzy_equal(tmp_dub, NO_VAL)) - convert_num_unit2((double)tmp_dub, - outbuf, sizeof(outbuf), - UNIT_NONE, 1000, + convert_num_unit2((double)tmp_dub, outbuf, + sizeof(outbuf), UNIT_NONE, + params.units, 1000, params.convert_flags & (~CONVERT_NUM_UNIT_EXACT)); @@ -1135,7 +1135,7 @@ void print_fields(type_t type, void *object) convert_num_unit( (double)tmp_uint64, outbuf, sizeof(outbuf), - UNIT_KILO, + UNIT_KILO, params.units, params.convert_flags); } @@ -1213,7 +1213,7 @@ void print_fields(type_t type, void *object) convert_num_unit( (double)tmp_uint64, outbuf, sizeof(outbuf), - UNIT_KILO, + UNIT_KILO, params.units, params.convert_flags); } @@ -1293,7 +1293,7 @@ void print_fields(type_t type, void *object) convert_num_unit( (double)tmp_uint64, outbuf, sizeof(outbuf), - UNIT_KILO, + UNIT_KILO, params.units, params.convert_flags); } @@ -1476,7 +1476,7 @@ void print_fields(type_t type, void *object) } convert_num_unit((double)tmp_int, outbuf, sizeof(outbuf), UNIT_NONE, - params.convert_flags); + params.units, params.convert_flags); field->print_routine(field, outbuf, (curr_inx == field_count)); @@ -1703,7 +1703,7 @@ void print_fields(type_t type, void *object) } convert_num_unit((double)tmp_uint32, outbuf, sizeof(outbuf), - UNIT_MEGA, + UNIT_MEGA, params.units, params.convert_flags); if (per_cpu) sprintf(outbuf+strlen(outbuf), "c"); @@ -1740,7 +1740,7 @@ void print_fields(type_t type, void *object) } convert_num_unit((double)tmp_int, outbuf, sizeof(outbuf), UNIT_NONE, - params.convert_flags); + params.units, params.convert_flags); field->print_routine(field, outbuf, diff --git a/src/sacct/sacct.h b/src/sacct/sacct.h index dda9b663ce3..3380b0a271b 100644 --- a/src/sacct/sacct.h +++ b/src/sacct/sacct.h @@ -174,7 +174,7 @@ typedef enum { } sacct_print_types_t; typedef struct { - uint32_t convert_flags; + uint32_t convert_flags; /* --noconvert */ slurmdb_job_cond_t *job_cond; int opt_completion; /* --completion */ int opt_dup; /* --duplicates; +1 = explicitly set */ @@ -185,6 +185,7 @@ typedef struct { int opt_noheader; /* can only be cleared */ int opt_allocs; /* --total */ int opt_uid; /* running persons uid */ + int units; /* --units*/ } sacct_parameters_t; extern print_field_t fields[]; diff --git a/src/sacctmgr/event_functions.c b/src/sacctmgr/event_functions.c index 4f83089b04b..bdf5d35fa56 100644 --- a/src/sacctmgr/event_functions.c +++ b/src/sacctmgr/event_functions.c @@ -559,8 +559,8 @@ extern int sacctmgr_list_event(int argc, char *argv[]) convert_num_unit( (float)slurmdb_find_tres_count_in_string( event->tres_str, TRES_CPU), - tmp, sizeof(tmp), - UNIT_NONE, CONVERT_NUM_UNIT_EXACT); + tmp, sizeof(tmp), UNIT_NONE, NO_VAL, + CONVERT_NUM_UNIT_EXACT); field->print_routine( field, diff --git a/src/sinfo/print.c b/src/sinfo/print.c index d49070a1a1b..117151d165d 100644 --- a/src/sinfo/print.c +++ b/src/sinfo/print.c @@ -243,9 +243,9 @@ _build_min_max_16_string(char *buffer, int buf_size, uint16_t min, uint16_t max, char tmp_min[8]; char tmp_max[8]; convert_num_unit((float)min, tmp_min, sizeof(tmp_min), UNIT_NONE, - params.convert_flags); + NO_VAL, params.convert_flags); convert_num_unit((float)max, tmp_max, sizeof(tmp_max), UNIT_NONE, - params.convert_flags); + NO_VAL, params.convert_flags); if (max == min) return snprintf(buffer, buf_size, "%s", tmp_max); @@ -270,9 +270,9 @@ _build_min_max_32_string(char *buffer, int buf_size, if (use_suffix) { convert_num_unit((float)min, tmp_min, sizeof(tmp_min), - UNIT_NONE, params.convert_flags); + UNIT_NONE, NO_VAL, params.convert_flags); convert_num_unit((float)max, tmp_max, sizeof(tmp_max), - UNIT_NONE, params.convert_flags); + UNIT_NONE, NO_VAL, params.convert_flags); } else { snprintf(tmp_min, sizeof(tmp_min), "%u", min); snprintf(tmp_max, sizeof(tmp_max), "%u", max); @@ -478,16 +478,16 @@ int _print_cpus_aiot(sinfo_data_t * sinfo_data, int width, if (sinfo_data) { if (params.cluster_flags & CLUSTER_FLAG_BG) { convert_num_unit((float)sinfo_data->cpus_alloc, - tmpa, sizeof(tmpa), UNIT_NONE, + tmpa, sizeof(tmpa), UNIT_NONE, NO_VAL, params.convert_flags); convert_num_unit((float)sinfo_data->cpus_idle, - tmpi, sizeof(tmpi), UNIT_NONE, + tmpi, sizeof(tmpi), UNIT_NONE, NO_VAL, params.convert_flags); convert_num_unit((float)sinfo_data->cpus_other, - tmpo, sizeof(tmpo), UNIT_NONE, + tmpo, sizeof(tmpo), UNIT_NONE, NO_VAL, params.convert_flags); convert_num_unit((float)sinfo_data->cpus_total, - tmpt, sizeof(tmpt), UNIT_NONE, + tmpt, sizeof(tmpt), UNIT_NONE, NO_VAL, params.convert_flags); } else { snprintf(tmpa, sizeof(tmpa), "%u", @@ -783,7 +783,7 @@ int _print_nodes_t(sinfo_data_t * sinfo_data, int width, if (sinfo_data) { if (params.cluster_flags & CLUSTER_FLAG_BG) convert_num_unit((float)sinfo_data->nodes_total, - tmp, sizeof(tmp), UNIT_NONE, + tmp, sizeof(tmp), UNIT_NONE, NO_VAL, params.convert_flags); else snprintf(tmp, sizeof(tmp), "%d", @@ -807,10 +807,10 @@ int _print_nodes_ai(sinfo_data_t * sinfo_data, int width, if (sinfo_data) { if (params.cluster_flags & CLUSTER_FLAG_BG) { convert_num_unit((float)sinfo_data->nodes_alloc, - tmpa, sizeof(tmpa), UNIT_NONE, + tmpa, sizeof(tmpa), UNIT_NONE, NO_VAL, params.convert_flags); convert_num_unit((float)sinfo_data->nodes_idle, - tmpi, sizeof(tmpi), UNIT_NONE, + tmpi, sizeof(tmpi), UNIT_NONE, NO_VAL, params.convert_flags); } else { snprintf(tmpa, sizeof(tmpa), "%d", @@ -840,16 +840,16 @@ int _print_nodes_aiot(sinfo_data_t * sinfo_data, int width, if (sinfo_data) { if (params.cluster_flags & CLUSTER_FLAG_BG) { convert_num_unit((float)sinfo_data->nodes_alloc, - tmpa, sizeof(tmpa), UNIT_NONE, + tmpa, sizeof(tmpa), UNIT_NONE, NO_VAL, params.convert_flags); convert_num_unit((float)sinfo_data->nodes_idle, - tmpi, sizeof(tmpi), UNIT_NONE, + tmpi, sizeof(tmpi), UNIT_NONE, NO_VAL, params.convert_flags); convert_num_unit((float)sinfo_data->nodes_other, - tmpo, sizeof(tmpo), UNIT_NONE, + tmpo, sizeof(tmpo), UNIT_NONE, NO_VAL, params.convert_flags); convert_num_unit((float)sinfo_data->nodes_total, - tmpt, sizeof(tmpt), UNIT_NONE, + tmpt, sizeof(tmpt), UNIT_NONE, NO_VAL, params.convert_flags); } else { snprintf(tmpa, sizeof(tmpa), "%u", diff --git a/src/smap/job_functions.c b/src/smap/job_functions.c index 6310e16c57c..3348985eaa4 100644 --- a/src/smap/job_functions.c +++ b/src/smap/job_functions.c @@ -308,9 +308,8 @@ static int _print_text_job(job_info_t * job_ptr) node_cnt = job_ptr->num_nodes; if (params.cluster_flags & CLUSTER_FLAG_BG) - convert_num_unit((float)node_cnt, tmp_cnt, - sizeof(tmp_cnt), UNIT_NONE, - CONVERT_NUM_UNIT_EXACT); + convert_num_unit((float)node_cnt, tmp_cnt, sizeof(tmp_cnt), + UNIT_NONE, NO_VAL, CONVERT_NUM_UNIT_EXACT); else snprintf(tmp_cnt, sizeof(tmp_cnt), "%d", node_cnt); diff --git a/src/smap/partition_functions.c b/src/smap/partition_functions.c index 8e7b2323980..a6e8b95bb52 100644 --- a/src/smap/partition_functions.c +++ b/src/smap/partition_functions.c @@ -557,7 +557,7 @@ static int _print_text_part(partition_info_t *part_ptr, if (params.cluster_flags & CLUSTER_FLAG_BG) convert_num_unit((float)part_ptr->total_nodes, tmp_cnt, - sizeof(tmp_cnt), UNIT_NONE, + sizeof(tmp_cnt), UNIT_NONE, NO_VAL, CONVERT_NUM_UNIT_EXACT); else snprintf(tmp_cnt, sizeof(tmp_cnt), "%u", part_ptr->total_nodes); diff --git a/src/squeue/print.c b/src/squeue/print.c index e8b8c8b2ef9..2bef2a670b9 100644 --- a/src/squeue/print.c +++ b/src/squeue/print.c @@ -1047,7 +1047,7 @@ int _print_job_num_cpus(job_info_t * job, int width, bool right, char* suffix) else { if (params.cluster_flags & CLUSTER_FLAG_BG) convert_num_unit((float)job->num_cpus, tmp_char, - sizeof(tmp_char), UNIT_NONE, + sizeof(tmp_char), UNIT_NONE, NO_VAL, params.convert_flags); else snprintf(tmp_char, sizeof(tmp_char), @@ -1078,7 +1078,7 @@ int _print_job_num_nodes(job_info_t * job, int width, bool right_justify, if (params.cluster_flags & CLUSTER_FLAG_BG) convert_num_unit((float)node_cnt, tmp_char, - sizeof(tmp_char), UNIT_NONE, + sizeof(tmp_char), UNIT_NONE, NO_VAL, params.convert_flags); else snprintf(tmp_char, sizeof(tmp_char), "%d", node_cnt); @@ -1102,19 +1102,19 @@ int _print_job_num_sct(job_info_t * job, int width, bool right_justify, strcpy(sockets, "*"); else convert_num_unit((float)job->sockets_per_node, sockets, - sizeof(sockets), UNIT_NONE, + sizeof(sockets), UNIT_NONE, NO_VAL, params.convert_flags); if (job->cores_per_socket == (uint16_t) NO_VAL) strcpy(cores, "*"); else convert_num_unit((float)job->cores_per_socket, cores, - sizeof(cores), UNIT_NONE, + sizeof(cores), UNIT_NONE, NO_VAL, params.convert_flags); if (job->threads_per_core == (uint16_t) NO_VAL) strcpy(threads, "*"); else convert_num_unit((float)job->threads_per_core, threads, - sizeof(threads), UNIT_NONE, + sizeof(threads), UNIT_NONE, NO_VAL, params.convert_flags); xstrfmtcat(sct, "%s:%s:%s", sockets, cores, threads); _print_str(sct, width, right_justify, true); @@ -1179,7 +1179,7 @@ int _print_pn_min_cpus(job_info_t * job, int width, bool right_justify, _print_str("MIN_CPUS", width, right_justify, true); else { convert_num_unit((float)job->pn_min_cpus, tmp_char, - sizeof(tmp_char), UNIT_NONE, + sizeof(tmp_char), UNIT_NONE, NO_VAL, params.convert_flags); _print_str(tmp_char, width, right_justify, true); } @@ -1200,7 +1200,7 @@ int _print_sockets(job_info_t * job, int width, bool right_justify, strcpy(tmp_char, "*"); else convert_num_unit((float)job->sockets_per_node, tmp_char, - sizeof(tmp_char), UNIT_NONE, + sizeof(tmp_char), UNIT_NONE, NO_VAL, params.convert_flags); _print_str(tmp_char, width, right_justify, true); } @@ -1221,7 +1221,7 @@ int _print_cores(job_info_t * job, int width, bool right_justify, strcpy(tmp_char, "*"); else convert_num_unit((float)job->cores_per_socket, tmp_char, - sizeof(tmp_char), UNIT_NONE, + sizeof(tmp_char), UNIT_NONE, NO_VAL, params.convert_flags); _print_str(tmp_char, width, right_justify, true); } @@ -1242,7 +1242,7 @@ int _print_threads(job_info_t * job, int width, bool right_justify, strcpy(tmp_char, "*"); else convert_num_unit((float)job->threads_per_core, tmp_char, - sizeof(tmp_char), UNIT_NONE, + sizeof(tmp_char), UNIT_NONE, NO_VAL, params.convert_flags); _print_str(tmp_char, width, right_justify, true); } @@ -1261,7 +1261,7 @@ int _print_pn_min_memory(job_info_t * job, int width, bool right_justify, else { job->pn_min_memory &= (~MEM_PER_CPU); convert_num_unit((float)job->pn_min_memory, min_mem, - sizeof(min_mem), UNIT_MEGA, + sizeof(min_mem), UNIT_MEGA, NO_VAL, params.convert_flags); _print_str(min_mem, width, right_justify, true); } @@ -1280,8 +1280,8 @@ _print_pn_min_tmp_disk(job_info_t * job, int width, bool right_justify, if (job == NULL) /* Print the Header instead */ _print_str("MIN_TMP_DISK", width, right_justify, true); else { - convert_num_unit((float)job->pn_min_tmp_disk, - tmp_char, sizeof(tmp_char), UNIT_MEGA, + convert_num_unit((float)job->pn_min_tmp_disk, tmp_char, + sizeof(tmp_char), UNIT_MEGA, NO_VAL, params.convert_flags); _print_str(tmp_char, width, right_justify, true); } diff --git a/src/sstat/print.c b/src/sstat/print.c index b8c2c4ac0fb..b5129f1d068 100644 --- a/src/sstat/print.c +++ b/src/sstat/print.c @@ -86,7 +86,7 @@ static void _print_small_double( return; if (dub > 1) - convert_num_unit((double)dub, outbuf, buf_size, units, + convert_num_unit((double)dub, outbuf, buf_size, units, NO_VAL, params.convert_flags); else if (dub > 0) snprintf(outbuf, buf_size, "%.2fM", dub); @@ -118,9 +118,9 @@ void print_fields(slurmdb_step_rec_t *step) case PRINT_ACT_CPUFREQ: convert_num_unit2((double)step->stats.act_cpufreq, - outbuf, sizeof(outbuf), - UNIT_KILO, 1000, params.convert_flags - & (~CONVERT_NUM_UNIT_EXACT)); + outbuf, sizeof(outbuf), UNIT_KILO, + NO_VAL, 1000, params.convert_flags & + (~CONVERT_NUM_UNIT_EXACT)); field->print_routine(field, outbuf, @@ -131,7 +131,7 @@ void print_fields(slurmdb_step_rec_t *step) convert_num_unit2((double) step->stats.consumed_energy, outbuf, sizeof(outbuf), - UNIT_NONE, 1000, + UNIT_NONE, NO_VAL, 1000, params.convert_flags & (~CONVERT_NUM_UNIT_EXACT)); } @@ -163,27 +163,27 @@ void print_fields(slurmdb_step_rec_t *step) (curr_inx == field_count)); break; case PRINT_AVEPAGES: - convert_num_unit((double)step->stats.pages_ave, - outbuf, sizeof(outbuf), - UNIT_KILO, params.convert_flags); + convert_num_unit((double)step->stats.pages_ave, outbuf, + sizeof(outbuf), UNIT_KILO, NO_VAL, + params.convert_flags); field->print_routine(field, outbuf, (curr_inx == field_count)); break; case PRINT_AVERSS: - convert_num_unit((double)step->stats.rss_ave, - outbuf, sizeof(outbuf), - UNIT_KILO, params.convert_flags); + convert_num_unit((double)step->stats.rss_ave, outbuf, + sizeof(outbuf), UNIT_KILO, NO_VAL, + params.convert_flags); field->print_routine(field, outbuf, (curr_inx == field_count)); break; case PRINT_AVEVSIZE: - convert_num_unit((double)step->stats.vsize_ave, - outbuf, sizeof(outbuf), - UNIT_KILO, params.convert_flags); + convert_num_unit((double)step->stats.vsize_ave, outbuf, + sizeof(outbuf), UNIT_KILO, NO_VAL, + params.convert_flags); field->print_routine(field, outbuf, @@ -249,9 +249,9 @@ void print_fields(slurmdb_step_rec_t *step) (curr_inx == field_count)); break; case PRINT_MAXPAGES: - convert_num_unit((double)step->stats.pages_max, - outbuf, sizeof(outbuf), - UNIT_KILO, params.convert_flags); + convert_num_unit((double)step->stats.pages_max, outbuf, + sizeof(outbuf), UNIT_KILO, NO_VAL, + params.convert_flags); field->print_routine(field, outbuf, @@ -272,9 +272,9 @@ void print_fields(slurmdb_step_rec_t *step) (curr_inx == field_count)); break; case PRINT_MAXRSS: - convert_num_unit((double)step->stats.rss_max, - outbuf, sizeof(outbuf), - UNIT_KILO, params.convert_flags); + convert_num_unit((double)step->stats.rss_max, outbuf, + sizeof(outbuf), UNIT_KILO, NO_VAL, + params.convert_flags); field->print_routine(field, outbuf, @@ -295,9 +295,9 @@ void print_fields(slurmdb_step_rec_t *step) (curr_inx == field_count)); break; case PRINT_MAXVSIZE: - convert_num_unit((double)step->stats.vsize_max, - outbuf, sizeof(outbuf), - UNIT_KILO, params.convert_flags); + convert_num_unit((double)step->stats.vsize_max, outbuf, + sizeof(outbuf), UNIT_KILO, NO_VAL, + params.convert_flags); field->print_routine(field, outbuf, diff --git a/src/sview/bb_info.c b/src/sview/bb_info.c index fea6025939f..d0906281cef 100644 --- a/src/sview/bb_info.c +++ b/src/sview/bb_info.c @@ -204,9 +204,9 @@ static void _layout_bb_record(GtkTreeView *treeview, if (bb_ptr->name) { strncpy(bb_name_id, bb_ptr->name, sizeof(bb_name_id)); } else if (bb_ptr->array_task_id == NO_VAL) { - convert_num_unit(bb_ptr->job_id, bb_name_id, - sizeof(bb_name_id), - UNIT_NONE, working_sview_config.convert_flags); + convert_num_unit(bb_ptr->job_id, bb_name_id, sizeof(bb_name_id), + UNIT_NONE, NO_VAL, + working_sview_config.convert_flags); } else { snprintf(bb_name_id, sizeof(bb_name_id), "%u_%u(%u)", @@ -322,9 +322,9 @@ static void _update_bb_record(sview_bb_info_t *sview_bb_info_ptr, if (bb_ptr->name) { strncpy(bb_name_id, bb_ptr->name, sizeof(bb_name_id)); } else if (bb_ptr->array_task_id == NO_VAL) { - convert_num_unit(bb_ptr->job_id, bb_name_id, - sizeof(bb_name_id), - UNIT_NONE, working_sview_config.convert_flags); + convert_num_unit(bb_ptr->job_id, bb_name_id, sizeof(bb_name_id), + UNIT_NONE, NO_VAL, + working_sview_config.convert_flags); } else { snprintf(bb_name_id, sizeof(bb_name_id), "%u_%u(%u)", @@ -483,7 +483,7 @@ static List _create_bb_info_list(burst_buffer_info_msg_t *bb_info_ptr) convert_num_unit(bb_resv_ptr->job_id, bb_name_id, sizeof(bb_name_id), - UNIT_NONE, + UNIT_NONE, NO_VAL, working_sview_config. convert_flags); } else { @@ -549,7 +549,7 @@ static void _display_info_bb(List info_list, popup_info_t *popup_win) convert_num_unit(bb_ptr->job_id, bb_name_id, sizeof(bb_name_id), - UNIT_NONE, + UNIT_NONE, NO_VAL, working_sview_config.convert_flags); } else { snprintf(bb_name_id, sizeof(bb_name_id), diff --git a/src/sview/block_info.c b/src/sview/block_info.c index 5a1e9a17b41..db81dd41985 100644 --- a/src/sview/block_info.c +++ b/src/sview/block_info.c @@ -349,12 +349,12 @@ static void _layout_block_record(GtkTreeView *treeview, SORTID_USE), node_use_string( block_ptr->bg_node_use)); - } - convert_num_unit((float)block_ptr->cnode_cnt, tmp_cnt, sizeof(tmp_cnt), - UNIT_NONE, working_sview_config.convert_flags); + } convert_num_unit((float)block_ptr->cnode_cnt, tmp_cnt, + sizeof(tmp_cnt), UNIT_NONE, NO_VAL, + working_sview_config.convert_flags); if (cluster_flags & CLUSTER_FLAG_BGQ) { convert_num_unit((float)block_ptr->cnode_err_cnt, tmp_cnt2, - sizeof(tmp_cnt2), UNIT_NONE, + sizeof(tmp_cnt2), UNIT_NONE, NO_VAL, working_sview_config.convert_flags); tmp_char = xstrdup_printf("%s/%s", tmp_cnt, tmp_cnt2); } else @@ -386,11 +386,11 @@ static void _update_block_record(sview_block_info_t *block_ptr, char *tmp_char = NULL, *tmp_char2 = NULL, *tmp_char3 = NULL; convert_num_unit((float)block_ptr->cnode_cnt, cnode_cnt, - sizeof(cnode_cnt), UNIT_NONE, + sizeof(cnode_cnt), UNIT_NONE, NO_VAL, working_sview_config.convert_flags); if (cluster_flags & CLUSTER_FLAG_BGQ) { convert_num_unit((float)block_ptr->cnode_err_cnt, cnode_cnt2, - sizeof(cnode_cnt), UNIT_NONE, + sizeof(cnode_cnt), UNIT_NONE, NO_VAL, working_sview_config.convert_flags); tmp_char3 = xstrdup_printf("%s/%s", cnode_cnt, cnode_cnt2); } else diff --git a/src/sview/job_info.c b/src/sview/job_info.c index 710b142045f..4f9497346d9 100644 --- a/src/sview/job_info.c +++ b/src/sview/job_info.c @@ -1516,9 +1516,9 @@ static void _layout_job_record(GtkTreeView *treeview, tmp_char); if (cluster_flags & CLUSTER_FLAG_BG) - convert_num_unit((float)job_ptr->num_cpus, - tmp_char, sizeof(tmp_char), - UNIT_NONE, working_sview_config.convert_flags); + convert_num_unit((float)job_ptr->num_cpus, tmp_char, + sizeof(tmp_char), UNIT_NONE, NO_VAL, + working_sview_config.convert_flags); else snprintf(tmp_char, sizeof(tmp_char), "%u", job_ptr->num_cpus); @@ -1528,9 +1528,9 @@ static void _layout_job_record(GtkTreeView *treeview, tmp_char); if (cluster_flags & CLUSTER_FLAG_BG) - convert_num_unit((float)job_ptr->max_cpus, - tmp_char, sizeof(tmp_char), - UNIT_NONE, working_sview_config.convert_flags); + convert_num_unit((float)job_ptr->max_cpus, tmp_char, + sizeof(tmp_char), UNIT_NONE, NO_VAL, + working_sview_config.convert_flags); else snprintf(tmp_char, sizeof(tmp_char), "%u", job_ptr->max_cpus); @@ -1540,9 +1540,9 @@ static void _layout_job_record(GtkTreeView *treeview, tmp_char); if (cluster_flags & CLUSTER_FLAG_BG) - convert_num_unit((float)job_ptr->num_cpus, - tmp_char, sizeof(tmp_char), - UNIT_NONE, working_sview_config.convert_flags); + convert_num_unit((float)job_ptr->num_cpus, tmp_char, + sizeof(tmp_char), UNIT_NONE, NO_VAL, + working_sview_config.convert_flags); else snprintf(tmp_char, sizeof(tmp_char), "%u", job_ptr->num_cpus); @@ -1691,8 +1691,8 @@ static void _layout_job_record(GtkTreeView *treeview, (job_ptr->mcs_label==NULL) ? "N/A" : job_ptr->mcs_label); - convert_num_unit((float)job_ptr->pn_min_cpus, - tmp_char, sizeof(tmp_char), UNIT_NONE, + convert_num_unit((float)job_ptr->pn_min_cpus, tmp_char, + sizeof(tmp_char), UNIT_NONE, NO_VAL, working_sview_config.convert_flags); add_display_treestore_line(update, treestore, &iter, find_col_name(display_data_job, @@ -1705,8 +1705,8 @@ static void _layout_job_record(GtkTreeView *treeview, if (min_mem > 0) { int len; - convert_num_unit((float)min_mem, - tmp_char, sizeof(tmp_char), UNIT_MEGA, + convert_num_unit((float)min_mem, tmp_char, sizeof(tmp_char), + UNIT_MEGA, NO_VAL, working_sview_config.convert_flags); len = strlen(tmp_char); if (job_ptr->pn_min_memory & MEM_PER_CPU) @@ -1721,8 +1721,8 @@ static void _layout_job_record(GtkTreeView *treeview, tmp_char); if (job_ptr->pn_min_tmp_disk > 0) - convert_num_unit((float)job_ptr->pn_min_tmp_disk, - tmp_char, sizeof(tmp_char), UNIT_MEGA, + convert_num_unit((float)job_ptr->pn_min_tmp_disk, tmp_char, + sizeof(tmp_char), UNIT_MEGA, NO_VAL, working_sview_config.convert_flags); else sprintf(tmp_char, " "); @@ -1768,8 +1768,8 @@ static void _layout_job_record(GtkTreeView *treeview, } if (cluster_flags & CLUSTER_FLAG_BG) - convert_num_unit((float)sview_job_info_ptr->node_cnt, - tmp_char, sizeof(tmp_char), UNIT_NONE, + convert_num_unit((float)sview_job_info_ptr->node_cnt, tmp_char, + sizeof(tmp_char), UNIT_NONE, NO_VAL, working_sview_config.convert_flags); else snprintf(tmp_char, sizeof(tmp_char), "%u", @@ -1781,8 +1781,8 @@ static void _layout_job_record(GtkTreeView *treeview, tmp_char); if (cluster_flags & CLUSTER_FLAG_BG) - convert_num_unit((float)sview_job_info_ptr->node_cnt, - tmp_char, sizeof(tmp_char), UNIT_NONE, + convert_num_unit((float)sview_job_info_ptr->node_cnt, tmp_char, + sizeof(tmp_char), UNIT_NONE, NO_VAL, working_sview_config.convert_flags); else snprintf(tmp_char, sizeof(tmp_char), "%u", @@ -1794,8 +1794,8 @@ static void _layout_job_record(GtkTreeView *treeview, tmp_char); if (cluster_flags & CLUSTER_FLAG_BG) - convert_num_unit((float)sview_job_info_ptr->node_cnt, - tmp_char, sizeof(tmp_char), UNIT_NONE, + convert_num_unit((float)sview_job_info_ptr->node_cnt, tmp_char, + sizeof(tmp_char), UNIT_NONE, NO_VAL, working_sview_config.convert_flags); else snprintf(tmp_char, sizeof(tmp_char), "%u", @@ -2139,29 +2139,29 @@ static void _update_job_record(sview_job_info_t *sview_job_info_ptr, tmp_cpus_per_task[0] = '\0'; if (cluster_flags & CLUSTER_FLAG_BG) { - convert_num_unit((float)job_ptr->num_cpus, - tmp_cpu_cnt, sizeof(tmp_cpu_cnt), - UNIT_NONE, working_sview_config.convert_flags); + convert_num_unit((float)job_ptr->num_cpus, tmp_cpu_cnt, + sizeof(tmp_cpu_cnt), UNIT_NONE, NO_VAL, + working_sview_config.convert_flags); } else { snprintf(tmp_cpu_cnt, sizeof(tmp_cpu_cnt), "%u", job_ptr->num_cpus); } - convert_num_unit((float)job_ptr->pn_min_cpus, - tmp_cpu_req, sizeof(tmp_cpu_req), UNIT_NONE, + convert_num_unit((float)job_ptr->pn_min_cpus, tmp_cpu_req, + sizeof(tmp_cpu_req), UNIT_NONE, NO_VAL, working_sview_config.convert_flags); if (cluster_flags & CLUSTER_FLAG_BG) { - convert_num_unit((float)job_ptr->max_cpus, - tmp_cpus_max, sizeof(tmp_cpus_max), - UNIT_NONE, working_sview_config.convert_flags); + convert_num_unit((float)job_ptr->max_cpus, tmp_cpus_max, + sizeof(tmp_cpus_max), UNIT_NONE, NO_VAL, + working_sview_config.convert_flags); } else { snprintf(tmp_cpus_max, sizeof(tmp_cpus_max), "%u", job_ptr->max_cpus); } - convert_num_unit((float)job_ptr->pn_min_tmp_disk, - tmp_disk, sizeof(tmp_disk), UNIT_MEGA, + convert_num_unit((float)job_ptr->pn_min_tmp_disk, tmp_disk, + sizeof(tmp_disk), UNIT_MEGA, NO_VAL, working_sview_config.convert_flags); if (WIFSIGNALED(job_ptr->derived_ec)) @@ -2191,8 +2191,8 @@ static void _update_job_record(sview_job_info_t *sview_job_info_ptr, if (min_mem > 0) { int len; - convert_num_unit((float)min_mem, - tmp_mem_min, sizeof(tmp_mem_min), UNIT_MEGA, + convert_num_unit((float)min_mem, tmp_mem_min, + sizeof(tmp_mem_min), UNIT_MEGA, NO_VAL, working_sview_config.convert_flags); len = strlen(tmp_mem_min); if (job_ptr->pn_min_memory & MEM_PER_CPU) @@ -2205,7 +2205,7 @@ static void _update_job_record(sview_job_info_t *sview_job_info_ptr, if (cluster_flags & CLUSTER_FLAG_BG) convert_num_unit((float)sview_job_info_ptr->node_cnt, tmp_node_cnt, sizeof(tmp_node_cnt), UNIT_NONE, - working_sview_config.convert_flags); + NO_VAL, working_sview_config.convert_flags); else sprintf(tmp_node_cnt, "%u", sview_job_info_ptr->node_cnt); @@ -2588,7 +2588,7 @@ static void _layout_step_record(GtkTreeView *treeview, return; convert_num_unit((float)step_ptr->num_cpus, tmp_char, sizeof(tmp_char), - UNIT_NONE, working_sview_config.convert_flags); + UNIT_NONE, NO_VAL, working_sview_config.convert_flags); add_display_treestore_line(update, treestore, &iter, find_col_name(display_data_job, SORTID_CPUS), @@ -2644,16 +2644,17 @@ static void _layout_step_record(GtkTreeView *treeview, &nodes); convert_num_unit( (float)nodes, - tmp_char, sizeof(tmp_char), UNIT_NONE, + tmp_char, sizeof(tmp_char), UNIT_NONE, NO_VAL, working_sview_config.convert_flags); } else if (cluster_flags & CLUSTER_FLAG_BG) convert_num_unit( (float)step_ptr->num_tasks / cpus_per_node, - tmp_char, sizeof(tmp_char), UNIT_NONE, + tmp_char, sizeof(tmp_char), UNIT_NONE, NO_VAL, working_sview_config.convert_flags); else { convert_num_unit((float)_nodes_in_list(tmp_nodes), tmp_char, sizeof(tmp_char), UNIT_NONE, + NO_VAL, working_sview_config.convert_flags); } add_display_treestore_line(update, treestore, &iter, @@ -2695,7 +2696,7 @@ static void _layout_step_record(GtkTreeView *treeview, tmp_time); convert_num_unit((float)step_ptr->num_tasks, tmp_char, sizeof(tmp_char), - UNIT_NONE, working_sview_config.convert_flags); + UNIT_NONE, NO_VAL, working_sview_config.convert_flags); add_display_treestore_line(update, treestore, &iter, find_col_name(display_data_job, SORTID_TASKS), @@ -2720,7 +2721,7 @@ static void _update_step_record(job_step_info_t *step_ptr, int color_inx = step_ptr->step_id % sview_colors_cnt; convert_num_unit((float)step_ptr->num_cpus, tmp_cpu_min, - sizeof(tmp_cpu_min), UNIT_NONE, + sizeof(tmp_cpu_min), UNIT_NONE, NO_VAL, working_sview_config.convert_flags); if (suspended) @@ -2745,22 +2746,23 @@ static void _update_step_record(job_step_info_t *step_ptr, &nodes); convert_num_unit((float)nodes, tmp_node_cnt, sizeof(tmp_node_cnt), UNIT_NONE, + NO_VAL, working_sview_config.convert_flags); } else if (cluster_flags & CLUSTER_FLAG_BG) { convert_num_unit( (float)step_ptr->num_tasks / cpus_per_node, tmp_node_cnt, sizeof(tmp_node_cnt), UNIT_NONE, - working_sview_config.convert_flags); + NO_VAL, working_sview_config.convert_flags); } else { convert_num_unit((float)_nodes_in_list(tmp_nodes), tmp_node_cnt, sizeof(tmp_node_cnt), - UNIT_NONE, + UNIT_NONE, NO_VAL, working_sview_config.convert_flags); } } convert_num_unit((float)step_ptr->num_tasks, tmp_task_cnt, - sizeof(tmp_task_cnt), UNIT_NONE, + sizeof(tmp_task_cnt), UNIT_NONE, NO_VAL, working_sview_config.convert_flags); if ((step_ptr->time_limit == NO_VAL) || diff --git a/src/sview/node_info.c b/src/sview/node_info.c index 7db354c0df0..be22e68134b 100644 --- a/src/sview/node_info.c +++ b/src/sview/node_info.c @@ -274,7 +274,7 @@ static void _layout_node_record(GtkTreeView *treeview, node_ptr->mcs_label), convert_num_unit((float)node_ptr->cpus, tmp_cnt, sizeof(tmp_cnt), - UNIT_NONE, working_sview_config.convert_flags); + UNIT_NONE, NO_VAL, working_sview_config.convert_flags); add_display_treestore_line(update, treestore, &iter, find_col_name(display_data_node, SORTID_CPUS), @@ -316,7 +316,7 @@ static void _layout_node_record(GtkTreeView *treeview, } idle_cpus -= alloc_cpus; convert_num_unit((float)alloc_cpus, tmp_cnt, - sizeof(tmp_cnt), UNIT_NONE, + sizeof(tmp_cnt), UNIT_NONE, NO_VAL, working_sview_config.convert_flags); add_display_treestore_line(update, treestore, &iter, find_col_name(display_data_node, @@ -333,14 +333,14 @@ static void _layout_node_record(GtkTreeView *treeview, idle_cpus -= err_cpus; convert_num_unit((float)err_cpus, tmp_cnt, sizeof(tmp_cnt), UNIT_NONE, - working_sview_config.convert_flags); + NO_VAL, working_sview_config.convert_flags); add_display_treestore_line(update, treestore, &iter, find_col_name(display_data_node, SORTID_ERR_CPUS), tmp_cnt); convert_num_unit((float)idle_cpus, tmp_cnt, sizeof(tmp_cnt), UNIT_NONE, - working_sview_config.convert_flags); + NO_VAL, working_sview_config.convert_flags); add_display_treestore_line(update, treestore, &iter, find_col_name(display_data_node, SORTID_IDLE_CPUS), @@ -356,35 +356,35 @@ static void _layout_node_record(GtkTreeView *treeview, xfree(lower); convert_num_unit((float)node_ptr->boards, tmp_cnt, sizeof(tmp_cnt), - UNIT_NONE, working_sview_config.convert_flags); + UNIT_NONE, NO_VAL, working_sview_config.convert_flags); add_display_treestore_line(update, treestore, &iter, find_col_name(display_data_node, SORTID_BOARDS), tmp_cnt); convert_num_unit((float)node_ptr->sockets, tmp_cnt, sizeof(tmp_cnt), - UNIT_NONE, working_sview_config.convert_flags); + UNIT_NONE, NO_VAL, working_sview_config.convert_flags); add_display_treestore_line(update, treestore, &iter, find_col_name(display_data_node, SORTID_SOCKETS), tmp_cnt); convert_num_unit((float)node_ptr->cores, tmp_cnt, sizeof(tmp_cnt), - UNIT_NONE, working_sview_config.convert_flags); + UNIT_NONE, NO_VAL, working_sview_config.convert_flags); add_display_treestore_line(update, treestore, &iter, find_col_name(display_data_node, SORTID_CORES), tmp_cnt); convert_num_unit((float)node_ptr->threads, tmp_cnt, sizeof(tmp_cnt), - UNIT_NONE, working_sview_config.convert_flags); + UNIT_NONE, NO_VAL, working_sview_config.convert_flags); add_display_treestore_line(update, treestore, &iter, find_col_name(display_data_node, SORTID_THREADS), tmp_cnt); convert_num_unit((float)node_ptr->real_memory, tmp_cnt, sizeof(tmp_cnt), - UNIT_MEGA, working_sview_config.convert_flags); + UNIT_MEGA, NO_VAL, working_sview_config.convert_flags); add_display_treestore_line(update, treestore, &iter, find_col_name(display_data_node, SORTID_REAL_MEMORY), @@ -401,7 +401,7 @@ static void _layout_node_record(GtkTreeView *treeview, tmp_cnt); convert_num_unit((float)node_ptr->tmp_disk, tmp_cnt, sizeof(tmp_cnt), - UNIT_MEGA, working_sview_config.convert_flags); + UNIT_MEGA, NO_VAL, working_sview_config.convert_flags); add_display_treestore_line(update, treestore, &iter, find_col_name(display_data_node, SORTID_TMP_DISK), @@ -546,7 +546,7 @@ static void _update_node_record(sview_node_info_t *sview_node_info_ptr, } convert_num_unit((float)node_ptr->cpus, tmp_cpus, - sizeof(tmp_cpus), UNIT_NONE, + sizeof(tmp_cpus), UNIT_NONE, NO_VAL, working_sview_config.convert_flags); select_g_select_nodeinfo_get(node_ptr->select_nodeinfo, @@ -563,7 +563,7 @@ static void _update_node_record(sview_node_info_t *sview_node_info_ptr, } idle_cpus = node_ptr->cpus - alloc_cpus; convert_num_unit((float)alloc_cpus, tmp_used_cpus, - sizeof(tmp_used_cpus), UNIT_NONE, + sizeof(tmp_used_cpus), UNIT_NONE, NO_VAL, working_sview_config.convert_flags); select_g_select_nodeinfo_get(node_ptr->select_nodeinfo, @@ -573,7 +573,7 @@ static void _update_node_record(sview_node_info_t *sview_node_info_ptr, snprintf(tmp_used_memory, sizeof(tmp_used_memory), "%uM", alloc_memory); convert_num_unit((float)alloc_cpus, tmp_used_cpus, - sizeof(tmp_used_cpus), UNIT_NONE, + sizeof(tmp_used_cpus), UNIT_NONE, NO_VAL, working_sview_config.convert_flags); select_g_select_nodeinfo_get(node_ptr->select_nodeinfo, @@ -584,10 +584,10 @@ static void _update_node_record(sview_node_info_t *sview_node_info_ptr, err_cpus *= cpus_per_node; idle_cpus -= err_cpus; convert_num_unit((float)err_cpus, tmp_err_cpus, sizeof(tmp_err_cpus), - UNIT_NONE, working_sview_config.convert_flags); + UNIT_NONE, NO_VAL, working_sview_config.convert_flags); convert_num_unit((float)idle_cpus, tmp_idle_cpus, sizeof(tmp_idle_cpus), - UNIT_NONE, working_sview_config.convert_flags); + UNIT_NONE, NO_VAL, working_sview_config.convert_flags); if (IS_NODE_DRAIN(node_ptr)) { /* don't worry about mixed since the @@ -601,10 +601,10 @@ static void _update_node_record(sview_node_info_t *sview_node_info_ptr, tmp_state_lower = str_tolower(tmp_state_upper); convert_num_unit((float)node_ptr->real_memory, tmp_mem, sizeof(tmp_mem), - UNIT_MEGA, working_sview_config.convert_flags); + UNIT_MEGA, NO_VAL, working_sview_config.convert_flags); convert_num_unit((float)node_ptr->tmp_disk, tmp_disk, sizeof(tmp_disk), - UNIT_MEGA, working_sview_config.convert_flags); + UNIT_MEGA, NO_VAL, working_sview_config.convert_flags); if (node_ptr->version == NULL) { snprintf(tmp_version, sizeof(tmp_version), "N/A"); diff --git a/src/sview/part_info.c b/src/sview/part_info.c index 896d517c9e6..f4b14113a2b 100644 --- a/src/sview/part_info.c +++ b/src/sview/part_info.c @@ -345,9 +345,9 @@ static int _build_min_max_32_string(char *buffer, int buf_size, char tmp_min[8]; char tmp_max[8]; convert_num_unit((float)min, tmp_min, sizeof(tmp_min), UNIT_NONE, - working_sview_config.convert_flags); + NO_VAL, working_sview_config.convert_flags); convert_num_unit((float)max, tmp_max, sizeof(tmp_max), UNIT_NONE, - working_sview_config.convert_flags); + NO_VAL, working_sview_config.convert_flags); if (max == min) return snprintf(buffer, buf_size, "%s", tmp_max); @@ -946,13 +946,13 @@ static void _layout_part_record(GtkTreeView *treeview, GTK_TREE_STORE(gtk_tree_view_get_model(treeview)); convert_num_unit((float)sview_part_info->sub_part_total.node_alloc_cnt, - tmp_cnt, sizeof(tmp_cnt), UNIT_NONE, + tmp_cnt, sizeof(tmp_cnt), UNIT_NONE, NO_VAL, working_sview_config.convert_flags); convert_num_unit((float)sview_part_info->sub_part_total.node_idle_cnt, - tmp_cnt1, sizeof(tmp_cnt1), UNIT_NONE, + tmp_cnt1, sizeof(tmp_cnt1), UNIT_NONE, NO_VAL, working_sview_config.convert_flags); convert_num_unit((float)sview_part_info->sub_part_total.node_error_cnt, - tmp_cnt2, sizeof(tmp_cnt2), UNIT_NONE, + tmp_cnt2, sizeof(tmp_cnt2), UNIT_NONE, NO_VAL, working_sview_config.convert_flags); snprintf(ind_cnt, sizeof(ind_cnt), "%s/%s/%s", tmp_cnt, tmp_cnt1, tmp_cnt2); @@ -987,7 +987,7 @@ static void _layout_part_record(GtkTreeView *treeview, case SORTID_CPUS: convert_num_unit((float)part_ptr->total_cpus, tmp_cnt, sizeof(tmp_cnt), - UNIT_NONE, + UNIT_NONE, NO_VAL, working_sview_config.convert_flags); temp_char = tmp_cnt; break; @@ -1058,7 +1058,7 @@ static void _layout_part_record(GtkTreeView *treeview, convert_num_unit((float)sview_part_info-> sub_part_total.mem_total, tmp_cnt, sizeof(tmp_cnt), - UNIT_MEGA, + UNIT_MEGA, NO_VAL, working_sview_config.convert_flags); temp_char = tmp_cnt; break; @@ -1071,8 +1071,8 @@ static void _layout_part_record(GtkTreeView *treeview, case SORTID_NODES: if (cluster_flags & CLUSTER_FLAG_BG) convert_num_unit((float)part_ptr->total_nodes, - tmp_cnt, - sizeof(tmp_cnt), UNIT_NONE, + tmp_cnt, sizeof(tmp_cnt), + UNIT_NONE, NO_VAL, working_sview_config. convert_flags); else @@ -1101,12 +1101,14 @@ static void _layout_part_record(GtkTreeView *treeview, case SORTID_PRIORITY_JOB_FACTOR: convert_num_unit((float)part_ptr->priority_job_factor, time_buf, sizeof(time_buf), UNIT_NONE, + NO_VAL, working_sview_config.convert_flags); temp_char = time_buf; break; case SORTID_PRIORITY_TIER: convert_num_unit((float)part_ptr->priority_tier, time_buf, sizeof(time_buf), UNIT_NONE, + NO_VAL, working_sview_config.convert_flags); temp_char = time_buf; break; @@ -1142,7 +1144,7 @@ static void _layout_part_record(GtkTreeView *treeview, convert_num_unit( (float)sview_part_info->sub_part_total. disk_total, - time_buf, sizeof(time_buf), UNIT_NONE, + time_buf, sizeof(time_buf), UNIT_NONE, NO_VAL, working_sview_config.convert_flags); temp_char = time_buf; break; @@ -1176,8 +1178,8 @@ static void _layout_part_record(GtkTreeView *treeview, temp_char = "infinite"; else { convert_num_unit( - (float)limit_set, - time_buf, sizeof(time_buf), UNIT_NONE, + (float)limit_set, time_buf, + sizeof(time_buf), UNIT_NONE, NO_VAL, working_sview_config.convert_flags); temp_char = time_buf; } @@ -1223,7 +1225,7 @@ static void _update_part_record(sview_part_info_t *sview_part_info, if (cluster_flags & CLUSTER_FLAG_BG) convert_num_unit((float)part_ptr->total_cpus, tmp_cpu_cnt, - sizeof(tmp_cpu_cnt), UNIT_NONE, + sizeof(tmp_cpu_cnt), UNIT_NONE, NO_VAL, working_sview_config.convert_flags); else sprintf(tmp_cpu_cnt, "%u", part_ptr->total_cpus); @@ -1278,17 +1280,17 @@ static void _update_part_record(sview_part_info_t *sview_part_info, if (part_ptr->max_nodes == (uint32_t) INFINITE) snprintf(tmp_max_nodes, sizeof(tmp_max_nodes), "infinite"); else { - convert_num_unit((float)part_ptr->max_nodes, - tmp_max_nodes, sizeof(tmp_max_nodes), - UNIT_NONE, working_sview_config.convert_flags); + convert_num_unit((float)part_ptr->max_nodes, tmp_max_nodes, + sizeof(tmp_max_nodes), UNIT_NONE, NO_VAL, + working_sview_config.convert_flags); } if (part_ptr->min_nodes == (uint32_t) INFINITE) snprintf(tmp_min_nodes, sizeof(tmp_min_nodes), "infinite"); else { - convert_num_unit((float)part_ptr->min_nodes, - tmp_min_nodes, sizeof(tmp_min_nodes), - UNIT_NONE, working_sview_config.convert_flags); + convert_num_unit((float)part_ptr->min_nodes, tmp_min_nodes, + sizeof(tmp_min_nodes), UNIT_NONE, NO_VAL, + working_sview_config.convert_flags); } if (part_ptr->max_cpus_per_node == INFINITE) { @@ -1300,7 +1302,7 @@ static void _update_part_record(sview_part_info_t *sview_part_info, if (cluster_flags & CLUSTER_FLAG_BG) convert_num_unit((float)part_ptr->total_nodes, tmp_node_cnt, - sizeof(tmp_node_cnt), UNIT_NONE, + sizeof(tmp_node_cnt), UNIT_NONE, NO_VAL, working_sview_config.convert_flags); else sprintf(tmp_node_cnt, "%u", part_ptr->total_nodes); @@ -1331,10 +1333,10 @@ static void _update_part_record(sview_part_info_t *sview_part_info, convert_num_unit((float)part_ptr->priority_job_factor, tmp_prio_job_factor, sizeof(tmp_prio_job_factor), - UNIT_NONE, working_sview_config.convert_flags); + UNIT_NONE, NO_VAL, working_sview_config.convert_flags); - convert_num_unit((float)part_ptr->priority_tier, - tmp_prio_tier, sizeof(tmp_prio_tier), UNIT_NONE, + convert_num_unit((float)part_ptr->priority_tier, tmp_prio_tier, + sizeof(tmp_prio_tier), UNIT_NONE, NO_VAL, working_sview_config.convert_flags); if (part_ptr->max_share & SHARED_FORCE) { @@ -1439,7 +1441,7 @@ static void _update_part_sub_record(sview_part_sub_t *sview_part_sub, if (sview_part_sub->cpu_alloc_cnt) { convert_num_unit((float)sview_part_sub->cpu_alloc_cnt, tmp_cnt, - sizeof(tmp_cnt), UNIT_NONE, + sizeof(tmp_cnt), UNIT_NONE, NO_VAL, working_sview_config.convert_flags); xstrfmtcat(tmp_cpus, "Alloc:%s", tmp_cnt); if (cluster_flags & CLUSTER_FLAG_BG) { @@ -1447,7 +1449,7 @@ static void _update_part_sub_record(sview_part_sub_t *sview_part_sub, (float)(sview_part_sub->cpu_alloc_cnt / cpus_per_node), tmp_cnt, - sizeof(tmp_cnt), UNIT_NONE, + sizeof(tmp_cnt), UNIT_NONE, NO_VAL, working_sview_config.convert_flags); xstrfmtcat(tmp_nodes, "Alloc:%s", tmp_cnt); } @@ -1455,7 +1457,7 @@ static void _update_part_sub_record(sview_part_sub_t *sview_part_sub, if (sview_part_sub->cpu_error_cnt) { convert_num_unit((float)sview_part_sub->cpu_error_cnt, tmp_cnt, - sizeof(tmp_cnt), UNIT_NONE, + sizeof(tmp_cnt), UNIT_NONE, NO_VAL, working_sview_config.convert_flags); if (tmp_cpus) xstrcat(tmp_cpus, " "); @@ -1465,7 +1467,7 @@ static void _update_part_sub_record(sview_part_sub_t *sview_part_sub, (float)(sview_part_sub->cpu_error_cnt / cpus_per_node), tmp_cnt, - sizeof(tmp_cnt), UNIT_NONE, + sizeof(tmp_cnt), UNIT_NONE, NO_VAL, working_sview_config.convert_flags); if (tmp_nodes) xstrcat(tmp_nodes, " "); @@ -1475,7 +1477,7 @@ static void _update_part_sub_record(sview_part_sub_t *sview_part_sub, if (sview_part_sub->cpu_idle_cnt) { convert_num_unit((float)sview_part_sub->cpu_idle_cnt, tmp_cnt, - sizeof(tmp_cnt), UNIT_NONE, + sizeof(tmp_cnt), UNIT_NONE, NO_VAL, working_sview_config.convert_flags); if (tmp_cpus) xstrcat(tmp_cpus, " "); @@ -1485,7 +1487,7 @@ static void _update_part_sub_record(sview_part_sub_t *sview_part_sub, (float)(sview_part_sub->cpu_idle_cnt / cpus_per_node), tmp_cnt, - sizeof(tmp_cnt), UNIT_NONE, + sizeof(tmp_cnt), UNIT_NONE, NO_VAL, working_sview_config.convert_flags); if (tmp_nodes) xstrcat(tmp_nodes, " "); @@ -1495,23 +1497,23 @@ static void _update_part_sub_record(sview_part_sub_t *sview_part_sub, } else { tmp_cpus = xmalloc(20); convert_num_unit((float)sview_part_sub->cpu_cnt, - tmp_cpus, 20, UNIT_NONE, + tmp_cpus, 20, UNIT_NONE, NO_VAL, working_sview_config.convert_flags); } if (!tmp_nodes) { convert_num_unit((float)sview_part_sub->node_cnt, tmp_cnt, - sizeof(tmp_cnt), UNIT_NONE, + sizeof(tmp_cnt), UNIT_NONE, NO_VAL, working_sview_config.convert_flags); tmp_nodes = xstrdup(tmp_cnt); } convert_num_unit((float)sview_part_sub->disk_total, tmp_disk, - sizeof(tmp_disk), UNIT_NONE, + sizeof(tmp_disk), UNIT_NONE, NO_VAL, working_sview_config.convert_flags); convert_num_unit((float)sview_part_sub->mem_total, tmp_mem, - sizeof(tmp_mem), UNIT_MEGA, + sizeof(tmp_mem), UNIT_MEGA, NO_VAL, working_sview_config.convert_flags); tmp_nodelist = hostlist_ranged_string_xmalloc(sview_part_sub->hl); diff --git a/src/sview/resv_info.c b/src/sview/resv_info.c index cc034bd6692..cb95db0dce0 100644 --- a/src/sview/resv_info.c +++ b/src/sview/resv_info.c @@ -592,7 +592,7 @@ static void _layout_resv_record(GtkTreeView *treeview, resv_ptr->burst_buffer); convert_num_unit((float)resv_ptr->core_cnt, - time_buf, sizeof(time_buf), UNIT_NONE, + time_buf, sizeof(time_buf), UNIT_NONE, NO_VAL, working_sview_config.convert_flags); add_display_treestore_line(update, treestore, &iter, find_col_name(display_data_resv, @@ -625,7 +625,7 @@ static void _layout_resv_record(GtkTreeView *treeview, /* NOTE: node_cnt in reservation info from slurmctld ONE number */ convert_num_unit((float)resv_ptr->node_cnt, - time_buf, sizeof(time_buf), UNIT_NONE, + time_buf, sizeof(time_buf), UNIT_NONE, NO_VAL, working_sview_config.convert_flags); add_display_treestore_line(update, treestore, &iter, find_col_name(display_data_resv, @@ -701,11 +701,11 @@ static void _update_resv_record(sview_resv_info_t *sview_resv_info_ptr, tmp_flags = reservation_flags_string(resv_ptr->flags); convert_num_unit((float)resv_ptr->core_cnt, - tmp_cores, sizeof(tmp_cores), UNIT_NONE, + tmp_cores, sizeof(tmp_cores), UNIT_NONE, NO_VAL, working_sview_config.convert_flags); convert_num_unit((float)resv_ptr->node_cnt, - tmp_nodes, sizeof(tmp_nodes), UNIT_NONE, + tmp_nodes, sizeof(tmp_nodes), UNIT_NONE, NO_VAL, working_sview_config.convert_flags); slurm_make_time_str((time_t *)&resv_ptr->start_time, tmp_start, -- GitLab