summaryrefslogtreecommitdiffstats
path: root/linux/Platform.c
diff options
context:
space:
mode:
authorBenny Baumann <BenBE@geshi.org>2020-10-31 23:28:02 +0100
committerBenny Baumann <BenBE@geshi.org>2020-11-02 22:15:01 +0100
commit61e14d4bb25268593019e6df3eb02264b4ac8e0e (patch)
tree910b68d9a5ee1c4d25b2cf3ee24abaaf3e6a096b /linux/Platform.c
parentb23f8235e28472c410dcb00893e0e3d403892673 (diff)
Spacing around operators
Diffstat (limited to 'linux/Platform.c')
-rw-r--r--linux/Platform.c35
1 files changed, 19 insertions, 16 deletions
diff --git a/linux/Platform.c b/linux/Platform.c
index 674952b0..3da3f029 100644
--- a/linux/Platform.c
+++ b/linux/Platform.c
@@ -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;

© 2014-2024 Faster IT GmbH | imprint | privacy policy