Whitespace and indentation issues

This commit is contained in:
Benny Baumann
2020-10-31 22:14:27 +01:00
parent 9a16b1079e
commit b23f8235e2
24 changed files with 347 additions and 288 deletions

View File

@ -194,11 +194,11 @@ bool LinuxProcess_setIOPriority(Process* this, Arg ioprio) {
#ifdef HAVE_DELAYACCT
void LinuxProcess_printDelay(float delay_percent, char* buffer, int n) {
if (isnan(delay_percent)) {
xSnprintf(buffer, n, " N/A ");
} else {
xSnprintf(buffer, n, "%4.1f ", delay_percent);
}
if (isnan(delay_percent)) {
xSnprintf(buffer, n, " N/A ");
} else {
xSnprintf(buffer, n, "%4.1f ", delay_percent);
}
}
#endif
@ -379,7 +379,8 @@ long LinuxProcess_compare(const void* v1, const void* v2) {
default:
return Process_compare(v1, v2);
}
test_diff:
test_diff:
return (diff > 0) ? 1 : (diff < 0 ? -1 : 0);
}

View File

@ -419,20 +419,20 @@ static void LinuxProcessList_readIoFile(LinuxProcess* process, const char* dirna
while ((line = strsep(&buf, "\n")) != NULL) {
switch (line[0]) {
case 'r':
if (line[1] == 'c' && String_startsWith(line+2, "har: "))
process->io_rchar = strtoull(line+7, NULL, 10);
else if (String_startsWith(line+1, "ead_bytes: ")) {
process->io_read_bytes = strtoull(line+12, NULL, 10);
if (line[1] == 'c' && String_startsWith(line + 2, "har: ")) {
process->io_rchar = strtoull(line + 7, NULL, 10);
} else if (String_startsWith(line + 1, "ead_bytes: ")) {
process->io_read_bytes = strtoull(line + 12, NULL, 10);
process->io_rate_read_bps =
((double)(process->io_read_bytes - last_read))/(((double)(now - process->io_rate_read_time))/1000);
process->io_rate_read_time = now;
}
break;
case 'w':
if (line[1] == 'c' && String_startsWith(line+2, "har: "))
process->io_wchar = strtoull(line+7, NULL, 10);
else if (String_startsWith(line+1, "rite_bytes: ")) {
process->io_write_bytes = strtoull(line+13, NULL, 10);
if (line[1] == 'c' && String_startsWith(line + 2, "har: ")) {
process->io_wchar = strtoull(line + 7, NULL, 10);
} else if (String_startsWith(line + 1, "rite_bytes: ")) {
process->io_write_bytes = strtoull(line + 13, NULL, 10);
process->io_rate_write_bps =
((double)(process->io_write_bytes - last_write))/(((double)(now - process->io_rate_write_time))/1000);
process->io_rate_write_time = now;
@ -446,8 +446,8 @@ static void LinuxProcessList_readIoFile(LinuxProcess* process, const char* dirna
}
break;
case 'c':
if (String_startsWith(line+1, "ancelled_write_bytes: ")) {
process->io_cancelled_write_bytes = strtoull(line+23, NULL, 10);
if (String_startsWith(line + 1, "ancelled_write_bytes: ")) {
process->io_cancelled_write_bytes = strtoull(line + 23, NULL, 10);
}
}
}
@ -1087,7 +1087,9 @@ static bool LinuxProcessList_recurseProcTree(LinuxProcessList* this, const char*
continue;
// Exception handler.
errorReadingProcess: {
errorReadingProcess:
{
if (preExisting) {
ProcessList_remove(pl, proc);
} else {

View File

@ -24,24 +24,24 @@ static const int PressureStallMeter_attributes[] = {
};
static void PressureStallMeter_updateValues(Meter* this, char* buffer, int len) {
const char *file;
if (strstr(Meter_name(this), "CPU")) {
file = "cpu";
} else if (strstr(Meter_name(this), "IO")) {
file = "io";
} else {
file = "memory";
}
const char* file;
if (strstr(Meter_name(this), "CPU")) {
file = "cpu";
} else if (strstr(Meter_name(this), "IO")) {
file = "io";
} else {
file = "memory";
}
bool some;
if (strstr(Meter_name(this), "Some")) {
some = true;
} else {
some = false;
}
bool some;
if (strstr(Meter_name(this), "Some")) {
some = true;
} else {
some = false;
}
Platform_getPressureStall(file, some, &this->values[0], &this->values[1], &this->values[2]);
xSnprintf(buffer, len, "xxxx %.2lf%% %.2lf%% %.2lf%%", this->values[0], this->values[1], this->values[2]);
Platform_getPressureStall(file, some, &this->values[0], &this->values[1], &this->values[2]);
xSnprintf(buffer, len, "xxxx %.2lf%% %.2lf%% %.2lf%%", this->values[0], this->values[1], this->values[2]);
}
static void PressureStallMeter_display(const Object* cast, RichString* out) {