aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/auxstats
diff options
context:
space:
mode:
authorDan Cross <cross@gajendra.net>2020-01-10 14:44:21 +0000
committerDan Cross <cross@gajendra.net>2020-01-10 14:54:30 +0000
commitfa325e9b42b0bdfb48857d1958d9fb7ceac55151 (patch)
tree81d26256d152435135bcb1ae43121979a49f5f2b /src/cmd/auxstats
parent77a0a5b5194d4441c86de097f2aae297cb75e2c2 (diff)
downloadplan9port-fa325e9b42b0bdfb48857d1958d9fb7ceac55151.tar.gz
plan9port-fa325e9b42b0bdfb48857d1958d9fb7ceac55151.tar.bz2
plan9port-fa325e9b42b0bdfb48857d1958d9fb7ceac55151.zip
Trivial changes: whitespace and modes.
Remote whitespace at the ends of lines. Remove blank lines from the ends of files. Change modes on source files so that they are not executable. Signed-off-by: Dan Cross <cross@gajendra.net>
Diffstat (limited to 'src/cmd/auxstats')
-rw-r--r--src/cmd/auxstats/Darwin.c46
-rw-r--r--src/cmd/auxstats/DragonFly.c3
-rw-r--r--src/cmd/auxstats/FreeBSD.c5
-rw-r--r--src/cmd/auxstats/Linux.c6
-rw-r--r--src/cmd/auxstats/NetBSD.c3
-rw-r--r--src/cmd/auxstats/SunOS.c3
-rw-r--r--src/cmd/auxstats/main.c1
7 files changed, 31 insertions, 36 deletions
diff --git a/src/cmd/auxstats/Darwin.c b/src/cmd/auxstats/Darwin.c
index b92f682e..836de520 100644
--- a/src/cmd/auxstats/Darwin.c
+++ b/src/cmd/auxstats/Darwin.c
@@ -79,7 +79,7 @@ void
sampleinit(void)
{
mach_timebase_info_data_t info;
-
+
if(stat_port)
return;
@@ -115,7 +115,7 @@ samplenet(void)
sample.net_obytes = 0;
sample.net_errors = 0;
sample.net_ifaces = 0;
-
+
for(ifa=ifa_list; ifa; ifa=ifa->ifa_next){
if(ifa->ifa_addr->sa_family != AF_LINK)
continue;
@@ -125,7 +125,7 @@ samplenet(void)
continue;
if(strncmp(ifa->ifa_name, "lo", 2) == 0) /* loopback */
continue;
-
+
if_data = (struct if_data*)ifa->ifa_data;
sample.net_ipackets += if_data->ifi_ipackets;
sample.net_opackets += if_data->ifi_opackets;
@@ -144,7 +144,7 @@ samplenet(void)
* all the other stat monitoring apps get set:
*
* -rwsr-xr-x 1 root wheel 83088 Mar 20 2005 /usr/bin/top
- * -rwsrwxr-x 1 root admin 54048 Mar 20 2005
+ * -rwsrwxr-x 1 root admin 54048 Mar 20 2005
* /Applications/Utilities/Activity Monitor.app/Contents/Resources/pmTool
*
* If Darwin eventually encompases more into sysctl then this
@@ -165,7 +165,7 @@ sampleevents(void)
mach_error_string(error));
return;
}
-
+
sample.p_syscalls_mach = sample.syscalls_mach;
sample.p_syscalls_unix = sample.syscalls_unix;
sample.p_csw = sample.csw;
@@ -173,7 +173,7 @@ sampleevents(void)
sample.syscalls_mach = 0;
sample.syscalls_unix = 0;
sample.csw = 0;
-
+
for(i=0; i<pcnt; i++){
if((error=host_processor_set_priv(stat_port, psets[i], &pset)) != KERN_SUCCESS){
Bprint(&bout, "host_processor_set_priv: %s\n", mach_error_string(error));
@@ -190,24 +190,24 @@ sampleevents(void)
sample.syscalls_unix += events.syscalls_unix;
sample.csw += events.csw;
}
-
+
if(tasks[j] != mach_task_self())
mach_port_deallocate(mach_task_self(), tasks[j]);
}
-
- if((error = vm_deallocate((vm_map_t)mach_task_self(),
+
+ if((error = vm_deallocate((vm_map_t)mach_task_self(),
(vm_address_t)tasks, tcnt*sizeof(task_t))) != KERN_SUCCESS){
Bprint(&bout, "vm_deallocate: %s\n", mach_error_string(error));
return;
}
-
+
if((error = mach_port_deallocate(mach_task_self(), pset)) != KERN_SUCCESS
|| (error = mach_port_deallocate(mach_task_self(), psets[i])) != KERN_SUCCESS){
Bprint(&bout, "mach_port_deallocate: %s\n", mach_error_string(error));
return;
}
}
-
+
if((error = vm_deallocate((vm_map_t)mach_task_self(), (vm_address_t)psets,
pcnt*sizeof(processor_set_t))) != KERN_SUCCESS){
Bprint(&bout, "vm_deallocate: %s\n", mach_error_string(error));
@@ -221,12 +221,12 @@ xsample(int first)
int mib[2];
mach_msg_type_number_t count;
size_t len;
-
+
if(first){
sampleinit();
return;
}
-
+
sample.seq++;
sample.p_time = sample.time;
sample.time = mach_absolute_time();
@@ -234,7 +234,7 @@ xsample(int first)
sample.p_vm_stat = sample.vm_stat;
count = sizeof(sample.vm_stat) / sizeof(natural_t);
host_statistics(stat_port, HOST_VM_INFO, (host_info_t)&sample.vm_stat, &count);
-
+
if(sample.seq == 1)
sample.p_vm_stat = sample.vm_stat;
@@ -267,7 +267,7 @@ xapm(int first)
if(first)
return;
-
+
src = IOPSCopyPowerSourcesInfo();
array = IOPSCopyPowerSourcesList(src);
@@ -294,14 +294,14 @@ xnet(int first)
{
uint n;
ulong err, in, inb, out, outb;
-
+
n = sample.net_ifaces;
in = sample.net_ipackets - sample.p_net_ipackets;
out = sample.net_opackets - sample.p_net_opackets;
inb = sample.net_ibytes - sample.p_net_ibytes;
outb = sample.net_obytes - sample.p_net_obytes;
err = sample.net_errors - sample.p_net_errors;
-
+
Bprint(&bout, "etherb %lud %d\n", inb+outb, n*1000000);
Bprint(&bout, "ether %lud %d\n", in+out, n*1000);
Bprint(&bout, "ethererr %lud %d\n", err, n*1000);
@@ -347,7 +347,7 @@ xvm(int first)
+ sample.vm_stat.active_count
+ sample.vm_stat.inactive_count
+ sample.vm_stat.wire_count;
-
+
active = sample.vm_stat.active_count
+ sample.vm_stat.inactive_count
+ sample.vm_stat.wire_count;
@@ -357,10 +357,10 @@ xvm(int first)
Bprint(&bout, "context %lld 1000\n", (vlong)sample.csw);
Bprint(&bout, "syscall %lld 1000\n", (vlong)sample.syscalls_mach+sample.syscalls_unix);
- Bprint(&bout, "intr %lld 1000\n",
+ Bprint(&bout, "intr %lld 1000\n",
isys("vm.stats.sys.v_intr")
+isys("vm.stats.sys.v_trap"));
-
+
Bprint(&bout, "fault %lld 1000\n", sample.vm_stat.faults);
Bprint(&bout, "fork %lld 1000\n",
isys("vm.stats.vm.v_rforks")
@@ -388,7 +388,7 @@ xcpu(int first)
sample.p_cpu.cpu_ticks[CPU_STATE_USER];
nice = sample.cpu.cpu_ticks[CPU_STATE_NICE] -
sample.p_cpu.cpu_ticks[CPU_STATE_NICE];
-
+
t = sys+idle+user+nice;
Bprint(&bout, "user =%lud %lud\n", user, t);
@@ -418,8 +418,8 @@ xswap(int first)
#ifdef VM_SWAPUSAGE
if(sample.xsu_valid)
- Bprint(&bout, "swap %lld %lld\n",
- (vlong)sample.xsu.xsu_used,
+ Bprint(&bout, "swap %lld %lld\n",
+ (vlong)sample.xsu.xsu_used,
(vlong)sample.xsu.xsu_total);
#endif
}
diff --git a/src/cmd/auxstats/DragonFly.c b/src/cmd/auxstats/DragonFly.c
index ec931044..33ebdedc 100644
--- a/src/cmd/auxstats/DragonFly.c
+++ b/src/cmd/auxstats/DragonFly.c
@@ -3,8 +3,7 @@
#include <bio.h>
#include "dat.h"
-void (*statfn[])(int) =
+void (*statfn[])(int) =
{
0
};
-
diff --git a/src/cmd/auxstats/FreeBSD.c b/src/cmd/auxstats/FreeBSD.c
index 2497fe35..2cc82879 100644
--- a/src/cmd/auxstats/FreeBSD.c
+++ b/src/cmd/auxstats/FreeBSD.c
@@ -203,8 +203,8 @@ xsysctl(int first)
pgsize = 4096;
}
- Bprint(&bout, "mem =%lld %lld\n",
- isys("vm.stats.vm.v_active_count")*pgsize,
+ Bprint(&bout, "mem =%lld %lld\n",
+ isys("vm.stats.vm.v_active_count")*pgsize,
isys("vm.stats.vm.v_page_count")*pgsize);
Bprint(&bout, "context %lld 1000\n", isys("vm.stats.sys.v_swtch"));
Bprint(&bout, "syscall %lld 1000\n", isys("vm.stats.sys.v_syscall"));
@@ -284,4 +284,3 @@ xswap(int first)
Bprint(&bout, "swap =%lld %lld\n", s.ksw_used*(vlong)pgsize, s.ksw_total*(vlong)pgsize);
}
-
diff --git a/src/cmd/auxstats/Linux.c b/src/cmd/auxstats/Linux.c
index 64c86a26..7bc4b720 100644
--- a/src/cmd/auxstats/Linux.c
+++ b/src/cmd/auxstats/Linux.c
@@ -39,12 +39,12 @@ xapm(int first)
readfile(fd);
tokens(0);
curr = atoi(tok[0]);
-
+
if(curr != -1)
Bprint(&bout, "battery =%d 100\n", curr);
}
-
+
void
xloadavg(int first)
{
@@ -236,7 +236,7 @@ xwireless(int first)
{
static int fd = -1;
int i;
-
+
if(first){
fd = open("/proc/net/wireless", OREAD);
return;
diff --git a/src/cmd/auxstats/NetBSD.c b/src/cmd/auxstats/NetBSD.c
index ec931044..33ebdedc 100644
--- a/src/cmd/auxstats/NetBSD.c
+++ b/src/cmd/auxstats/NetBSD.c
@@ -3,8 +3,7 @@
#include <bio.h>
#include "dat.h"
-void (*statfn[])(int) =
+void (*statfn[])(int) =
{
0
};
-
diff --git a/src/cmd/auxstats/SunOS.c b/src/cmd/auxstats/SunOS.c
index ec931044..33ebdedc 100644
--- a/src/cmd/auxstats/SunOS.c
+++ b/src/cmd/auxstats/SunOS.c
@@ -3,8 +3,7 @@
#include <bio.h>
#include "dat.h"
-void (*statfn[])(int) =
+void (*statfn[])(int) =
{
0
};
-
diff --git a/src/cmd/auxstats/main.c b/src/cmd/auxstats/main.c
index d1c35561..3fd77ac4 100644
--- a/src/cmd/auxstats/main.c
+++ b/src/cmd/auxstats/main.c
@@ -120,4 +120,3 @@ tokens(int i)
}
ntok = tokenize(line[i], tok, nelem(tok));
}
-