mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-15 21:44:36 +03:00
Spacing around operators
This commit is contained in:
@ -53,7 +53,7 @@ void Battery_getData(double* level, ACPresence* isOnAC) {
|
||||
mib[4] = 3;
|
||||
if (sysctl(mib, 5, &s, &slen, NULL, 0) != -1) {
|
||||
double charge = s.value;
|
||||
*level = 100*(charge / last_full_capacity);
|
||||
*level = 100 * (charge / last_full_capacity);
|
||||
if (charge >= last_full_capacity) {
|
||||
*level = 100;
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, ui
|
||||
}
|
||||
|
||||
for (i = 0; i <= pl->cpuCount; i++) {
|
||||
CPUData *d = opl->cpus + i;
|
||||
CPUData* d = opl->cpus + i;
|
||||
d->totalTime = 1;
|
||||
d->totalPeriod = 1;
|
||||
}
|
||||
@ -134,7 +134,7 @@ static inline void OpenBSDProcessList_scanMemoryInfo(ProcessList* pl) {
|
||||
*/
|
||||
}
|
||||
|
||||
char *OpenBSDProcessList_readProcessName(kvm_t* kd, struct kinfo_proc* kproc, int* basenameEnd) {
|
||||
char* OpenBSDProcessList_readProcessName(kvm_t* kd, struct kinfo_proc* kproc, int* basenameEnd) {
|
||||
char *s, **arg;
|
||||
size_t len = 0, n;
|
||||
int i;
|
||||
@ -163,7 +163,7 @@ char *OpenBSDProcessList_readProcessName(kvm_t* kd, struct kinfo_proc* kproc, in
|
||||
n = strlcat(s, arg[i], len);
|
||||
if (i == 0) {
|
||||
/* TODO: rename all basenameEnd to basenameLen, make size_t */
|
||||
*basenameEnd = MINIMUM(n, len-1);
|
||||
*basenameEnd = MINIMUM(n, len - 1);
|
||||
}
|
||||
/* the trailing space should get truncated anyway */
|
||||
strlcat(s, " ", len);
|
||||
@ -175,9 +175,9 @@ char *OpenBSDProcessList_readProcessName(kvm_t* kd, struct kinfo_proc* kproc, in
|
||||
/*
|
||||
* Taken from OpenBSD's ps(1).
|
||||
*/
|
||||
static double getpcpu(const struct kinfo_proc *kp) {
|
||||
static double getpcpu(const struct kinfo_proc* kp) {
|
||||
if (fscale == 0)
|
||||
return (0.0);
|
||||
return 0.0;
|
||||
|
||||
#define fxtofl(fixpt) ((double)(fixpt) / fscale)
|
||||
|
||||
@ -232,7 +232,7 @@ static inline void OpenBSDProcessList_scanProcs(OpenBSDProcessList* this) {
|
||||
proc->m_size = kproc->p_vm_dsize;
|
||||
proc->m_resident = kproc->p_vm_rssize;
|
||||
proc->percent_mem = (proc->m_resident * CRT_pageSizeKB) / (double)(this->super.totalMem) * 100.0;
|
||||
proc->percent_cpu = CLAMP(getpcpu(kproc), 0.0, this->super.cpuCount*100.0);
|
||||
proc->percent_cpu = CLAMP(getpcpu(kproc), 0.0, this->super.cpuCount * 100.0);
|
||||
//proc->nlwp = kproc->p_numthreads;
|
||||
//proc->time = kproc->p_rtime_sec + ((kproc->p_rtime_usec + 500000) / 10);
|
||||
proc->nice = kproc->p_nice - 20;
|
||||
|
@ -43,7 +43,7 @@ ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, ui
|
||||
|
||||
void ProcessList_delete(ProcessList* this);
|
||||
|
||||
char *OpenBSDProcessList_readProcessName(kvm_t* kd, struct kinfo_proc* kproc, int* basenameEnd);
|
||||
char* OpenBSDProcessList_readProcessName(kvm_t* kd, struct kinfo_proc* kproc, int* basenameEnd);
|
||||
|
||||
void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate);
|
||||
|
||||
|
@ -162,7 +162,7 @@ double Platform_setCPUValues(Meter* this, int cpu) {
|
||||
const CPUData* cpuData = &(pl->cpus[cpu]);
|
||||
double total = cpuData->totalPeriod == 0 ? 1 : cpuData->totalPeriod;
|
||||
double totalPercent;
|
||||
double *v = this->values;
|
||||
double* v = this->values;
|
||||
|
||||
v[CPU_METER_NICE] = cpuData->nicePeriod / total * 100.0;
|
||||
v[CPU_METER_NORMAL] = cpuData->userPeriod / total * 100.0;
|
||||
@ -175,11 +175,11 @@ double Platform_setCPUValues(Meter* this, int cpu) {
|
||||
v[CPU_METER_IOWAIT] = 0.0;
|
||||
v[CPU_METER_FREQUENCY] = NAN;
|
||||
this->curItems = 8;
|
||||
totalPercent = v[0]+v[1]+v[2]+v[3];
|
||||
totalPercent = v[0] + v[1] + v[2] + v[3];
|
||||
} else {
|
||||
v[2] = cpuData->sysAllPeriod / total * 100.0;
|
||||
v[3] = 0.0; // No steal nor guest on OpenBSD
|
||||
totalPercent = v[0]+v[1]+v[2];
|
||||
totalPercent = v[0] + v[1] + v[2];
|
||||
this->curItems = 4;
|
||||
}
|
||||
|
||||
@ -208,7 +208,7 @@ void Platform_setMemoryValues(Meter* this) {
|
||||
*/
|
||||
void Platform_setSwapValues(Meter* this) {
|
||||
const ProcessList* pl = this->pl;
|
||||
struct swapent *swdev;
|
||||
struct swapent* swdev;
|
||||
unsigned long long int total, used;
|
||||
int nswap, rnswap, i;
|
||||
nswap = swapctl(SWAP_NSWAP, 0, 0);
|
||||
@ -243,11 +243,11 @@ void Platform_setSwapValues(Meter* this) {
|
||||
|
||||
char* Platform_getProcessEnv(pid_t pid) {
|
||||
char errbuf[_POSIX2_LINE_MAX];
|
||||
char *env;
|
||||
char **ptr;
|
||||
char* env;
|
||||
char** ptr;
|
||||
int count;
|
||||
kvm_t *kt;
|
||||
struct kinfo_proc *kproc;
|
||||
kvm_t* kt;
|
||||
struct kinfo_proc* kproc;
|
||||
size_t capacity = 4096, size = 0;
|
||||
|
||||
if ((kt = kvm_openfiles(NULL, NULL, NULL, KVM_NO_FILES, errbuf)) == NULL)
|
||||
@ -265,7 +265,7 @@ char* Platform_getProcessEnv(pid_t pid) {
|
||||
}
|
||||
|
||||
env = xMalloc(capacity);
|
||||
for (char **p = ptr; *p; p++) {
|
||||
for (char** p = ptr; *p; p++) {
|
||||
size_t len = strlen(*p) + 1;
|
||||
|
||||
if (size + len > capacity) {
|
||||
@ -294,10 +294,10 @@ bool Platform_getDiskIO(DiskIOData* data) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Platform_getNetworkIO(unsigned long int *bytesReceived,
|
||||
unsigned long int *packetsReceived,
|
||||
unsigned long int *bytesTransmitted,
|
||||
unsigned long int *packetsTransmitted) {
|
||||
bool Platform_getNetworkIO(unsigned long int* bytesReceived,
|
||||
unsigned long int* packetsReceived,
|
||||
unsigned long int* bytesTransmitted,
|
||||
unsigned long int* packetsTransmitted) {
|
||||
// TODO
|
||||
*bytesReceived = 0;
|
||||
*packetsReceived = 0;
|
||||
|
@ -44,9 +44,9 @@ char* Platform_getProcessEnv(pid_t pid);
|
||||
|
||||
bool Platform_getDiskIO(DiskIOData* data);
|
||||
|
||||
bool Platform_getNetworkIO(unsigned long int *bytesReceived,
|
||||
unsigned long int *packetsReceived,
|
||||
unsigned long int *bytesTransmitted,
|
||||
unsigned long int *packetsTransmitted);
|
||||
bool Platform_getNetworkIO(unsigned long int* bytesReceived,
|
||||
unsigned long int* packetsReceived,
|
||||
unsigned long int* bytesTransmitted,
|
||||
unsigned long int* packetsTransmitted);
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user