Fix processDiskReadSeconds and processDiskWriteSeconds. (#7608)

This commit is contained in:
Renxuan Wang 2022-07-18 13:47:45 -07:00 committed by GitHub
parent d28fb2b809
commit 570db7a7d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 8 deletions

View File

@ -1731,15 +1731,10 @@ SystemStatistics getSystemStatistics(std::string const& dataFolder,
0,
returnStats.elapsed -
std::min<double>(returnStats.elapsed, (nowIOMilliSecs - (*statState)->lastIOMilliSecs) / 1000.0));
returnStats.processDiskReadSeconds = std::max<double>(
0,
returnStats.elapsed - std::min<double>(returnStats.elapsed,
(nowReadMilliSecs - (*statState)->lastReadMilliSecs) / 1000.0));
returnStats.processDiskReadSeconds =
std::min<double>(returnStats.elapsed, (nowReadMilliSecs - (*statState)->lastReadMilliSecs) / 1000.0);
returnStats.processDiskWriteSeconds =
std::max<double>(0,
returnStats.elapsed -
std::min<double>(returnStats.elapsed,
(nowWriteMilliSecs - (*statState)->lastWriteMilliSecs) / 1000.0));
std::min<double>(returnStats.elapsed, (nowWriteMilliSecs - (*statState)->lastWriteMilliSecs) / 1000.0);
returnStats.processDiskRead = (nowReads - (*statState)->lastReads);
returnStats.processDiskWrite = (nowWrites - (*statState)->lastWrites);
returnStats.processDiskWriteSectors = (nowWriteSectors - (*statState)->lastWriteSectors);