mirror of https://github.com/xzeldon/htop.git
Reduce scope of totaltime
This commit is contained in:
parent
51be2d5415
commit
98943d595e
|
@ -74,7 +74,6 @@ static inline void SolarisProcessList_scanCPUTime(ProcessList* pl) {
|
||||||
double intrbuf = 0;
|
double intrbuf = 0;
|
||||||
double krnlbuf = 0;
|
double krnlbuf = 0;
|
||||||
double userbuf = 0;
|
double userbuf = 0;
|
||||||
uint64_t totaltime = 0;
|
|
||||||
int arrskip = 0;
|
int arrskip = 0;
|
||||||
|
|
||||||
assert(cpus > 0);
|
assert(cpus > 0);
|
||||||
|
@ -104,10 +103,12 @@ static inline void SolarisProcessList_scanCPUTime(ProcessList* pl) {
|
||||||
&& (krnltime != NULL) && (usertime != NULL) );
|
&& (krnltime != NULL) && (usertime != NULL) );
|
||||||
|
|
||||||
CPUData* cpuData = &(spl->cpus[i + arrskip]);
|
CPUData* cpuData = &(spl->cpus[i + arrskip]);
|
||||||
totaltime = (idletime->value.ui64 - cpuData->lidle)
|
|
||||||
+ (intrtime->value.ui64 - cpuData->lintr)
|
uint64_t totaltime = (idletime->value.ui64 - cpuData->lidle)
|
||||||
+ (krnltime->value.ui64 - cpuData->lkrnl)
|
+ (intrtime->value.ui64 - cpuData->lintr)
|
||||||
+ (usertime->value.ui64 - cpuData->luser);
|
+ (krnltime->value.ui64 - cpuData->lkrnl)
|
||||||
|
+ (usertime->value.ui64 - cpuData->luser);
|
||||||
|
|
||||||
// Calculate percentages of deltas since last reading
|
// Calculate percentages of deltas since last reading
|
||||||
cpuData->userPercent = ((usertime->value.ui64 - cpuData->luser) / (double)totaltime) * 100.0;
|
cpuData->userPercent = ((usertime->value.ui64 - cpuData->luser) / (double)totaltime) * 100.0;
|
||||||
cpuData->nicePercent = (double)0.0; // Not implemented on Solaris
|
cpuData->nicePercent = (double)0.0; // Not implemented on Solaris
|
||||||
|
|
Loading…
Reference in New Issue