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:27:56 +00:00
parent e067753e6d
commit e9e5234b92
2 changed files with 17 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>
PR 1468/cpukit

View File

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