diff --git a/NEWS b/NEWS index c123e9bf35cc9f53432fd0e14d58034f5ee1c27b..045e5ab25cb8bec24113aa253340fcda9d5b7082 100644 --- a/NEWS +++ b/NEWS @@ -24,6 +24,7 @@ documents those changes that are of interest to users and administrators. (i.e. gres=gpu/tesla) it would get a count of 0. -- Allow sstat to talk to slurmd's that are new in protocol version. -- Permit database names over 33 characters in accounting_storage/mysql. + -- Fix negative values when profiling. * Changes in Slurm 17.11.9-2 ============================ diff --git a/src/plugins/jobacct_gather/common/common_jag.c b/src/plugins/jobacct_gather/common/common_jag.c index d545d1de3b503b63ede533bcf00ad2906853cab8..69859f512aa963725aae5dd3a14a02b4afa02d85 100644 --- a/src/plugins/jobacct_gather/common/common_jag.c +++ b/src/plugins/jobacct_gather/common/common_jag.c @@ -728,6 +728,10 @@ static void _record_profile(struct jobacctinfo *jobacct) } else { data[FIELD_CPUTIME].d = jobacct->tot_cpu - jobacct->last_total_cputime; + + if (data[FIELD_CPUTIME].d < 0) + data[FIELD_CPUTIME].d = jobacct->tot_cpu; + et = (jobacct->cur_time - jobacct->last_time); if (!et) data[FIELD_CPUUTIL].d = 0.0; @@ -739,8 +743,14 @@ static void _record_profile(struct jobacctinfo *jobacct) data[FIELD_READ].d = jobacct->tot_disk_read - jobacct->last_tot_disk_read; + if (data[FIELD_READ].d < 0) + data[FIELD_READ].d = jobacct->tot_disk_read; + data[FIELD_WRITE].d = jobacct->tot_disk_write - jobacct->last_tot_disk_write; + + if (data[FIELD_WRITE].d < 0) + data[FIELD_WRITE].d = jobacct->tot_disk_write; } if (debug_flags & DEBUG_FLAG_PROFILE) {