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[]) { ...@@ -692,7 +692,7 @@ int main (int argc, char *argv[]) {
elapsed_us = timediff_us(&now,&lastUpdate); elapsed_us = timediff_us(&now,&lastUpdate);
/* Statistics */ /* Statistics */
if (!wasRunning) { if (!wasRunning) {
statsTimeDelayed += elapsed_us; statsTimeDelayed += elapsed_us / 1000;
} }
/* Are we processing load limits? */ /* Are we processing load limits? */
...@@ -749,6 +749,7 @@ int main (int argc, char *argv[]) { ...@@ -749,6 +749,7 @@ int main (int argc, char *argv[]) {
/* Check we did not exceed 1s */ /* Check we did not exceed 1s */
if (tickBucket > tickBucketMax) { if (tickBucket > tickBucketMax) {
tickBucket = tickBucketMax; tickBucket = tickBucketMax;
/* Check if we don't have an insane negative value either */ /* Check if we don't have an insane negative value either */
} else if (tickBucket < - HZ) { } else if (tickBucket < - HZ) {
tickBucket = - HZ; tickBucket = - HZ;
...@@ -764,7 +765,7 @@ int main (int argc, char *argv[]) { ...@@ -764,7 +765,7 @@ int main (int argc, char *argv[]) {
} else if (tickBucket > 0) { } else if (tickBucket > 0) {
exceededCPU = 0; exceededCPU = 0;
/* Set new sleep time */ /* Set new sleep time */
sleep_us = (tickBucket / HZ) * CLOCK_PRECISION; sleep_us = (tickBucket / cpuPerHZ) * CLOCK_PRECISION;
}; };
/* Only use this if its a greater value */ /* Only use this if its a greater value */
...@@ -841,7 +842,7 @@ int main (int argc, char *argv[]) { ...@@ -841,7 +842,7 @@ int main (int argc, char *argv[]) {
} }
if (verbose) { 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); 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