mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-12 12:14:36 +03:00
Use unsigned types for CPU counts and associated variables
This commit is contained in:

committed by
Benny Baumann

parent
53bcc5cbff
commit
a11d01568c
@ -184,7 +184,7 @@ void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate) {
|
||||
|
||||
/* Get the time difference */
|
||||
dpl->global_diff = 0;
|
||||
for (int i = 0; i < dpl->super.cpuCount; ++i) {
|
||||
for (unsigned int i = 0; i < dpl->super.cpuCount; ++i) {
|
||||
for (size_t j = 0; j < CPU_STATE_MAX; ++j) {
|
||||
dpl->global_diff += dpl->curr_load[i].cpu_ticks[j] - dpl->prev_load[i].cpu_ticks[j];
|
||||
}
|
||||
|
@ -182,12 +182,12 @@ int Platform_getMaxPid() {
|
||||
|
||||
static double Platform_setCPUAverageValues(Meter* mtr) {
|
||||
const ProcessList* dpl = mtr->pl;
|
||||
int cpus = dpl->cpuCount;
|
||||
unsigned int cpus = dpl->cpuCount;
|
||||
double sumNice = 0.0;
|
||||
double sumNormal = 0.0;
|
||||
double sumKernel = 0.0;
|
||||
double sumPercent = 0.0;
|
||||
for (int i = 1; i <= cpus; i++) {
|
||||
for (unsigned int i = 1; i <= cpus; i++) {
|
||||
sumPercent += Platform_setCPUValues(mtr, i);
|
||||
sumNice += mtr->values[CPU_METER_NICE];
|
||||
sumNormal += mtr->values[CPU_METER_NORMAL];
|
||||
@ -199,7 +199,7 @@ static double Platform_setCPUAverageValues(Meter* mtr) {
|
||||
return sumPercent / cpus;
|
||||
}
|
||||
|
||||
double Platform_setCPUValues(Meter* mtr, int cpu) {
|
||||
double Platform_setCPUValues(Meter* mtr, unsigned int cpu) {
|
||||
|
||||
if (cpu == 0) {
|
||||
return Platform_setCPUAverageValues(mtr);
|
||||
|
@ -47,7 +47,7 @@ void Platform_getLoadAverage(double* one, double* five, double* fifteen);
|
||||
|
||||
int Platform_getMaxPid(void);
|
||||
|
||||
double Platform_setCPUValues(Meter* mtr, int cpu);
|
||||
double Platform_setCPUValues(Meter* mtr, unsigned int cpu);
|
||||
|
||||
void Platform_setMemoryValues(Meter* mtr);
|
||||
|
||||
|
Reference in New Issue
Block a user