2009-11-11 Jennifer Averett <jennifer.averett@OARcorp.com>

PR 1471/cpukit
	* libmisc/cpuuse/cpuusagereport.c: Rework statement to ensure 64-bit
	multiplication is used to avoid overflow with intermediate value.
This commit is contained in:
Joel Sherrill
2009-11-11 16:28:06 +00:00
parent 00d6017bdf
commit 00735eec31
2 changed files with 16 additions and 2 deletions

View File

@@ -1,3 +1,9 @@
2009-11-11 Jennifer Averett <jennifer.averett@OARcorp.com>
PR 1471/cpukit
* libmisc/cpuuse/cpuusagereport.c: Rework statement to ensure 64-bit
multiplication is used to avoid overflow with intermediate value.
2009-11-10 Jennifer Averett <jennifer.averett@OARcorp.com> 2009-11-10 Jennifer Averett <jennifer.averett@OARcorp.com>
PR 1468/cpukit PR 1468/cpukit

View File

@@ -148,8 +148,16 @@ void rtems_cpu_usage_report_with_plugin(
ival, fval ival, fval
); );
#else #else
ival = (total_units) ? if (total_units) {
the_thread->cpu_time_used * 10000 / total_units : 0; uint64_t ival_64;
ival_64 = the_thread->cpu_time_used;
ival_64 *= 10000;
ival = ival_64 / total_units;
} else {
ival = 0;
}
fval = ival % 1000; fval = ival % 1000;
ival /= 1000; ival /= 1000;
(*print)( context, (*print)( context,