Changeset e9e5234b in rtems


Ignore:
Timestamp:
Nov 11, 2009, 4:27:56 PM (10 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.9
Children:
c29dc1f7
Parents:
e067753
Message:

2009-11-11 Jennifer Averett <jennifer.averett@…>

PR 1471/cpukit

  • libmisc/cpuuse/cpuusagereport.c: Rework statement to ensure 64-bit multiplication is used to avoid overflow with intermediate value.
Location:
cpukit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/ChangeLog

    re067753 re9e5234b  
     12009-11-11      Jennifer Averett <jennifer.averett@OARcorp.com>
     2
     3        PR 1471/cpukit
     4        * libmisc/cpuuse/cpuusagereport.c: Rework statement to ensure 64-bit
     5        multiplication is used to avoid overflow with intermediate value.
     6
    172009-11-10      Jennifer Averett <jennifer.averett@OARcorp.com>
    28
  • cpukit/libmisc/cpuuse/cpuusagereport.c

    re067753 re9e5234b  
    142142          );
    143143        #else
    144           ival = (total_units) ?
    145                    the_thread->cpu_time_used * 10000 / total_units : 0;
     144          if (total_units) {
     145            uint64_t ival_64;
     146
     147            ival_64 = the_thread->cpu_time_used;
     148            ival_64 *= 10000;
     149            ival = ival_64 / total_units;
     150
     151          } else {
     152            ival = 0;
     153          }
     154
    146155          fval = ival % 100;
    147156          ival /= 100;
Note: See TracChangeset for help on using the changeset viewer.