aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/auxstats
diff options
context:
space:
mode:
authorRuss Cox <rsc@swtch.com>2009-06-09 09:26:13 -0700
committerRuss Cox <rsc@swtch.com>2009-06-09 09:26:13 -0700
commit77ac35832191e456a5d9a3ccff667ab262838303 (patch)
tree495044d1e4ad5c4d20cdde4cf187dfa24333ce33 /src/cmd/auxstats
parentfc9f53d45420e17afd9d1492615ab0038161f405 (diff)
parentfc9f53d45420e17afd9d1492615ab0038161f405 (diff)
downloadplan9port-77ac35832191e456a5d9a3ccff667ab262838303.tar.gz
plan9port-77ac35832191e456a5d9a3ccff667ab262838303.tar.bz2
plan9port-77ac35832191e456a5d9a3ccff667ab262838303.zip
merge
Diffstat (limited to 'src/cmd/auxstats')
-rw-r--r--src/cmd/auxstats/FreeBSD.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/cmd/auxstats/FreeBSD.c b/src/cmd/auxstats/FreeBSD.c
index 19ae96b1..a6b7a8d6 100644
--- a/src/cmd/auxstats/FreeBSD.c
+++ b/src/cmd/auxstats/FreeBSD.c
@@ -238,27 +238,27 @@ void
xcpu(int first)
{
static int stathz;
- ulong x[20];
- struct clockinfo *ci;
+ union {
+ ulong x[20];
+ struct clockinfo ci;
+ } u;
int n;
if(first){
- if(rsys("kern.clockrate", (char*)&x, sizeof x) < sizeof ci)
+ if(rsys("kern.clockrate", (char*)u.x, sizeof u.x) < sizeof u.ci)
stathz = 128;
- else{
- ci = (struct clockinfo*)x;
- stathz = ci->stathz;
- }
+ else
+ stathz = u.ci.stathz;
return;
}
- if((n=rsys("kern.cp_time", (char*)x, sizeof x)) < 5*sizeof(ulong))
+ if((n=rsys("kern.cp_time", (char*)u.x, sizeof u.x)) < 5*sizeof(ulong))
return;
- Bprint(&bout, "user %lud %d\n", x[CP_USER]+x[CP_NICE], stathz);
- Bprint(&bout, "sys %lud %d\n", x[CP_SYS], stathz);
- Bprint(&bout, "cpu %lud %d\n", x[CP_USER]+x[CP_NICE]+x[CP_SYS], stathz);
- Bprint(&bout, "idle %lud %d\n", x[CP_IDLE], stathz);
+ Bprint(&bout, "user %lud %d\n", u.x[CP_USER]+u.x[CP_NICE], stathz);
+ Bprint(&bout, "sys %lud %d\n", u.x[CP_SYS], stathz);
+ Bprint(&bout, "cpu %lud %d\n", u.x[CP_USER]+u.x[CP_NICE]+u.x[CP_SYS], stathz);
+ Bprint(&bout, "idle %lud %d\n", u.x[CP_IDLE], stathz);
}
void