mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-12 12:14:36 +03:00
Spacing around operators
This commit is contained in:
@ -169,8 +169,11 @@ int Platform_getUptime() {
|
||||
|
||||
void Platform_getLoadAverage(double* one, double* five, double* fifteen) {
|
||||
int activeProcs, totalProcs, lastProc;
|
||||
*one = 0; *five = 0; *fifteen = 0;
|
||||
FILE *fd = fopen(PROCDIR "/loadavg", "r");
|
||||
*one = 0;
|
||||
*five = 0;
|
||||
*fifteen = 0;
|
||||
|
||||
FILE* fd = fopen(PROCDIR "/loadavg", "r");
|
||||
if (fd) {
|
||||
int total = fscanf(fd, "%32lf %32lf %32lf %32d/%32d %32d", one, five, fifteen,
|
||||
&activeProcs, &totalProcs, &lastProc);
|
||||
@ -207,15 +210,15 @@ double Platform_setCPUValues(Meter* this, int cpu) {
|
||||
v[CPU_METER_IOWAIT] = cpuData->ioWaitPeriod / total * 100.0;
|
||||
this->curItems = 8;
|
||||
if (this->pl->settings->accountGuestInCPUMeter) {
|
||||
percent = v[0]+v[1]+v[2]+v[3]+v[4]+v[5]+v[6];
|
||||
percent = v[0] + v[1] + v[2] + v[3] + v[4] + v[5] + v[6];
|
||||
} else {
|
||||
percent = v[0]+v[1]+v[2]+v[3]+v[4];
|
||||
percent = v[0] + v[1] + v[2] + v[3] + v[4];
|
||||
}
|
||||
} else {
|
||||
v[2] = cpuData->systemAllPeriod / total * 100.0;
|
||||
v[3] = (cpuData->stealPeriod + cpuData->guestPeriod) / total * 100.0;
|
||||
this->curItems = 4;
|
||||
percent = v[0]+v[1]+v[2]+v[3];
|
||||
percent = v[0] + v[1] + v[2] + v[3];
|
||||
}
|
||||
percent = CLAMP(percent, 0.0, 100.0);
|
||||
if (isnan(percent)) percent = 0.0;
|
||||
@ -275,7 +278,7 @@ char* Platform_getProcessEnv(pid_t pid) {
|
||||
if (!fd)
|
||||
return NULL;
|
||||
|
||||
char *env = NULL;
|
||||
char* env = NULL;
|
||||
|
||||
size_t capacity = 0;
|
||||
size_t size = 0;
|
||||
@ -299,16 +302,16 @@ char* Platform_getProcessEnv(pid_t pid) {
|
||||
env = xRealloc(env, size + 2);
|
||||
|
||||
env[size] = '\0';
|
||||
env[size+1] = '\0';
|
||||
env[size + 1] = '\0';
|
||||
|
||||
return env;
|
||||
}
|
||||
|
||||
void Platform_getPressureStall(const char *file, bool some, double* ten, double* sixty, double* threehundred) {
|
||||
void Platform_getPressureStall(const char* file, bool some, double* ten, double* sixty, double* threehundred) {
|
||||
*ten = *sixty = *threehundred = 0;
|
||||
char procname[128+1];
|
||||
char procname[128 + 1];
|
||||
xSnprintf(procname, 128, PROCDIR "/pressure/%s", file);
|
||||
FILE *fd = fopen(procname, "r");
|
||||
FILE* fd = fopen(procname, "r");
|
||||
if (!fd) {
|
||||
*ten = *sixty = *threehundred = NAN;
|
||||
return;
|
||||
@ -323,7 +326,7 @@ void Platform_getPressureStall(const char *file, bool some, double* ten, double*
|
||||
}
|
||||
|
||||
bool Platform_getDiskIO(DiskIOData* data) {
|
||||
FILE *fd = fopen(PROCDIR "/diskstats", "r");
|
||||
FILE* fd = fopen(PROCDIR "/diskstats", "r");
|
||||
if (!fd)
|
||||
return false;
|
||||
|
||||
@ -367,11 +370,11 @@ bool Platform_getDiskIO(DiskIOData* data) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Platform_getNetworkIO(unsigned long int *bytesReceived,
|
||||
unsigned long int *packetsReceived,
|
||||
unsigned long int *bytesTransmitted,
|
||||
unsigned long int *packetsTransmitted) {
|
||||
FILE *fd = fopen(PROCDIR "/net/dev", "r");
|
||||
bool Platform_getNetworkIO(unsigned long int* bytesReceived,
|
||||
unsigned long int* packetsReceived,
|
||||
unsigned long int* bytesTransmitted,
|
||||
unsigned long int* packetsTransmitted) {
|
||||
FILE* fd = fopen(PROCDIR "/net/dev", "r");
|
||||
if (!fd)
|
||||
return false;
|
||||
|
||||
|
Reference in New Issue
Block a user