Skip to content
Snippets Groups Projects
Commit f07d086d authored by Nigel Kukard's avatar Nigel Kukard
Browse files

Fixed bug with statsTimeDelayed

* Fixed (double) cast, it should be (long double)
* Reduce precision of statsTimeDelayed
parent e3a3af5f
No related branches found
No related tags found
No related merge requests found
......@@ -692,7 +692,7 @@ int main (int argc, char *argv[]) {
elapsed_us = timediff_us(&now,&lastUpdate);
/* Statistics */
if (!wasRunning) {
statsTimeDelayed += elapsed_us;
statsTimeDelayed += elapsed_us / 1000;
}
/* Are we processing load limits? */
......@@ -749,6 +749,7 @@ int main (int argc, char *argv[]) {
/* Check we did not exceed 1s */
if (tickBucket > tickBucketMax) {
tickBucket = tickBucketMax;
/* Check if we don't have an insane negative value either */
} else if (tickBucket < - HZ) {
tickBucket = - HZ;
......@@ -764,7 +765,7 @@ int main (int argc, char *argv[]) {
} else if (tickBucket > 0) {
exceededCPU = 0;
/* Set new sleep time */
sleep_us = (tickBucket / HZ) * CLOCK_PRECISION;
sleep_us = (tickBucket / cpuPerHZ) * CLOCK_PRECISION;
};
/* Only use this if its a greater value */
......@@ -841,7 +842,7 @@ int main (int argc, char *argv[]) {
}
if (verbose) {
logmsg("STATISTICS: Slowdowns = %lu, Total Time Delayed = %.2fs\n",statsSlowdowns,( (double) statsTimeDelayed / (double) CLOCK_PRECISION ));
logmsg("STATISTICS: Slowdowns = %lu, Total Time Delayed = %.2Lfs\n",statsSlowdowns, (long double) statsTimeDelayed / 1000 );
}
return WEXITSTATUS(waitStatus);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment