diff options
author | Guy M. Broome <thrirhrafnir@gmail.com> | 2018-03-27 16:48:58 -0400 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2018-04-05 19:38:13 -0300 |
commit | fa18ac964c9f02ebc89d6e5b737331baf90b538e (patch) | |
tree | 0cfcf0852861588377200699e6d8fc33c0a18a5f | |
parent | 192e43c1ed230d54d9d79f9e87bc6321178dad31 (diff) | |
download | android_external_htop-fa18ac964c9f02ebc89d6e5b737331baf90b538e.tar.gz android_external_htop-fa18ac964c9f02ebc89d6e5b737331baf90b538e.tar.bz2 android_external_htop-fa18ac964c9f02ebc89d6e5b737331baf90b538e.zip |
Solaris: remove unneeded accumulators for process and thread counting
-rw-r--r-- | solaris/SolarisProcessList.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/solaris/SolarisProcessList.c b/solaris/SolarisProcessList.c index 54e7179..ce36c23 100644 --- a/solaris/SolarisProcessList.c +++ b/solaris/SolarisProcessList.c @@ -381,8 +381,6 @@ void ProcessList_goThroughEntries(ProcessList* this) { prusage_t _prusage; char filename[MAX_NAME+1]; FILE *fp = NULL; - uint64_t addRunning = 0; - uint64_t addTotal = 0; struct timeval tv; struct tm date; @@ -397,8 +395,6 @@ void ProcessList_goThroughEntries(ProcessList* this) { // We always count the scheduler this->kernelThreads = 1; while ((entry = readdir(dir)) != NULL) { - addRunning = 0; - addTotal = 0; name = entry->d_name; pid = atoi(name); proc = ProcessList_getProcess(this, pid, &preExisting, (Process_New) SolarisProcess_new); @@ -497,6 +493,7 @@ void ProcessList_goThroughEntries(ProcessList* this) { sproc->poolid = _psinfo.pr_poolid; sproc->contid = _psinfo.pr_contract; } + if (proc->nlwp > 1) { ProcessList_enumerateLWPs(proc, name, this, tv); } @@ -505,22 +502,23 @@ void ProcessList_goThroughEntries(ProcessList* this) { if (sproc->kernel && !this->settings->hideKernelThreads) { this->kernelThreads += proc->nlwp; - addTotal = proc->nlwp+1; - if (proc->state == 'O') addRunning++; + this->totalTasks += proc->nlwp+1; + if (proc->state == 'O') this->runningTasks++; } else if (!sproc->kernel) { - if (proc->state == 'O') addRunning++; + if (proc->state == 'O') this->runningTasks++; if (this->settings->hideUserlandThreads) { - addTotal++; + this->totalTasks++; } else { this->userlandThreads += proc->nlwp; - addTotal = proc->nlwp+1; + this->totalTasks += proc->nlwp+1; } } - this->runningTasks+=addRunning; - this->totalTasks+=addTotal; proc->updated = true; + } // while ((entry = readdir(dir)) != NULL) + closedir(dir); + } |