summaryrefslogtreecommitdiffstats
path: root/darwin/Platform.c
diff options
context:
space:
mode:
authorDaniel Lange <DLange@git.local>2020-11-15 14:32:41 +0100
committerDaniel Lange <DLange@git.local>2020-11-15 14:33:09 +0100
commitbb908f3dc4ac5847592e9698dec150658067e84e (patch)
treefb0d7b03602de14f4ba6efbdd9f8a9f3cf7cc067 /darwin/Platform.c
parentda2dcf9505299eae607e29cc85691b8163c1a36e (diff)
parente7b95feee4f375738cb339a58337fdab83f6abbf (diff)
Resolve merge conflicts, merge #298 "Macro cleanup" from @BenBE
Diffstat (limited to 'darwin/Platform.c')
-rw-r--r--darwin/Platform.c52
1 files changed, 26 insertions, 26 deletions
diff --git a/darwin/Platform.c b/darwin/Platform.c
index 1f9120cb..cd505b9d 100644
--- a/darwin/Platform.c
+++ b/darwin/Platform.c
@@ -150,7 +150,7 @@ int Platform_getUptime() {
void Platform_getLoadAverage(double* one, double* five, double* fifteen) {
double results[3];
- if(3 == getloadavg(results, 3)) {
+ if (3 == getloadavg(results, 3)) {
*one = results[0];
*five = results[1];
*fifteen = results[2];
@@ -177,7 +177,7 @@ ProcessPidColumn Process_pidColumns[] = {
};
static double Platform_setCPUAverageValues(Meter* mtr) {
- const ProcessList *dpl = mtr->pl;
+ const ProcessList* dpl = mtr->pl;
int cpus = dpl->cpuCount;
double sumNice = 0.0;
double sumNormal = 0.0;
@@ -201,22 +201,22 @@ double Platform_setCPUValues(Meter* mtr, int cpu) {
return Platform_setCPUAverageValues(mtr);
}
- const DarwinProcessList *dpl = (const DarwinProcessList *)mtr->pl;
- const processor_cpu_load_info_t prev = &dpl->prev_load[cpu-1];
- const processor_cpu_load_info_t curr = &dpl->curr_load[cpu-1];
+ const DarwinProcessList* dpl = (const DarwinProcessList*)mtr->pl;
+ const processor_cpu_load_info_t prev = &dpl->prev_load[cpu - 1];
+ const processor_cpu_load_info_t curr = &dpl->curr_load[cpu - 1];
double total = 0;
/* Take the sums */
- for(size_t i = 0; i < CPU_STATE_MAX; ++i) {
+ for (size_t i = 0; i < CPU_STATE_MAX; ++i) {
total += (double)curr->cpu_ticks[i] - (double)prev->cpu_ticks[i];
}
mtr->values[CPU_METER_NICE]
- = ((double)curr->cpu_ticks[CPU_STATE_NICE] - (double)prev->cpu_ticks[CPU_STATE_NICE])* 100.0 / total;
+ = ((double)curr->cpu_ticks[CPU_STATE_NICE] - (double)prev->cpu_ticks[CPU_STATE_NICE]) * 100.0 / total;
mtr->values[CPU_METER_NORMAL]
- = ((double)curr->cpu_ticks[CPU_STATE_USER] - (double)prev->cpu_ticks[CPU_STATE_USER])* 100.0 / total;
+ = ((double)curr->cpu_ticks[CPU_STATE_USER] - (double)prev->cpu_ticks[CPU_STATE_USER]) * 100.0 / total;
mtr->values[CPU_METER_KERNEL]
- = ((double)curr->cpu_ticks[CPU_STATE_SYSTEM] - (double)prev->cpu_ticks[CPU_STATE_SYSTEM])* 100.0 / total;
+ = ((double)curr->cpu_ticks[CPU_STATE_SYSTEM] - (double)prev->cpu_ticks[CPU_STATE_SYSTEM]) * 100.0 / total;
mtr->curItems = 3;
@@ -229,7 +229,7 @@ double Platform_setCPUValues(Meter* mtr, int cpu) {
}
void Platform_setMemoryValues(Meter* mtr) {
- const DarwinProcessList *dpl = (const DarwinProcessList *)mtr->pl;
+ const DarwinProcessList* dpl = (const DarwinProcessList*)mtr->pl;
const struct vm_statistics* vm = &dpl->vm_stats;
double page_K = (double)vm_page_size / (double)1024;
@@ -240,13 +240,13 @@ void Platform_setMemoryValues(Meter* mtr) {
}
void Platform_setSwapValues(Meter* mtr) {
- int mib[2] = {CTL_VM, VM_SWAPUSAGE};
- struct xsw_usage swapused;
- size_t swlen = sizeof(swapused);
- sysctl(mib, 2, &swapused, &swlen, NULL, 0);
+ int mib[2] = {CTL_VM, VM_SWAPUSAGE};
+ struct xsw_usage swapused;
+ size_t swlen = sizeof(swapused);
+ sysctl(mib, 2, &swapused, &swlen, NULL, 0);
- mtr->total = swapused.xsu_total / 1024;
- mtr->values[0] = swapused.xsu_used / 1024;
+ mtr->total = swapused.xsu_total / 1024;
+ mtr->values[0] = swapused.xsu_used / 1024;
}
void Platform_setZfsArcValues(Meter* this) {
@@ -284,25 +284,25 @@ char* Platform_getProcessEnv(pid_t pid) {
p += sizeof(int);
// skip exe
- p = strchr(p, 0)+1;
+ p = strchr(p, 0) + 1;
// skip padding
- while(!*p && p < endp)
+ while (!*p && p < endp)
++p;
// skip argv
- for (; argc-- && p < endp; p = strrchr(p, 0)+1)
+ for (; argc-- && p < endp; p = strrchr(p, 0) + 1)
;
// skip padding
- while(!*p && p < endp)
+ while (!*p && p < endp)
++p;
size_t size = endp - p;
- env = xMalloc(size+2);
+ env = xMalloc(size + 2);
memcpy(env, p, size);
env[size] = 0;
- env[size+1] = 0;
+ env[size + 1] = 0;
}
}
free(buf);
@@ -329,10 +329,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;

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