Lines 1-15
Link Here
|
1 |
--- src/stats-bsd.c.orig Wed Dec 18 01:01:17 2002 |
1 |
--- src/stats-bsd.c.orig Tue May 27 09:03:43 2003 |
2 |
+++ src/stats-bsd.c Mon Feb 3 20:20:12 2003 |
2 |
+++ src/stats-bsd.c Wed Jun 11 23:48:40 2003 |
3 |
@@ -64,6 +64,8 @@ |
3 |
@@ -73,6 +73,8 @@ |
4 |
|
4 |
|
5 |
#include "locale.h" /* gettext */ |
5 |
#include "locale.h" /* gettext */ |
6 |
|
6 |
|
7 |
+void logcalc(char *, char *); |
7 |
+void logcalc(char *, char *); |
8 |
+ |
8 |
+ |
9 |
/** |
9 |
/** |
10 |
* @desc Verbose level 2 logging of calulations |
10 |
* @desc Verbose level 3 logging of calulations |
11 |
*/ |
11 |
*/ |
12 |
@@ -81,12 +83,13 @@ |
12 |
@@ -90,12 +92,13 @@ |
13 |
void |
13 |
void |
14 |
initCPU(char *cpu) |
14 |
initCPU(char *cpu) |
15 |
{ |
15 |
{ |
Lines 26-48
Link Here
|
26 |
initialized = 1; |
26 |
initialized = 1; |
27 |
|
27 |
|
28 |
mib[0] = CTL_HW; |
28 |
mib[0] = CTL_HW; |
29 |
@@ -98,7 +101,6 @@ |
29 |
@@ -180,19 +183,18 @@ |
30 |
|
|
|
31 |
if (sysctl(mib, 2, buf, &size, NULL, 0) == -1) { |
32 |
uplog(LOG_WARNING, "sysctl: hw.model"); |
33 |
- /* warn("sysctl: hw.model"); */ |
34 |
} |
35 |
strlcpy(cpu, buf, CPU_SIZE); |
36 |
logcalc(_("CPU"), cpu); |
37 |
@@ -154,7 +156,6 @@ |
38 |
err(1, "sysctl: kern.boottime"); |
39 |
} |
40 |
boottimesecs = boottime.tv_sec; |
41 |
- /* logcalc(_("boot time"), boottimesecs); */ |
42 |
#if defined DEBUG |
43 |
uplog(LOG_DEBUG, "initBoottime() initialized %d", boottimesecs); |
44 |
#endif /* DEBUG */ |
45 |
@@ -173,19 +174,18 @@ |
46 |
_("%s %s not implemented for this operating system %s"), |
30 |
_("%s %s not implemented for this operating system %s"), |
47 |
_("WARNING:"), _("Load-average"), strerror(errno)); |
31 |
_("WARNING:"), _("Load-average"), strerror(errno)); |
48 |
cfg_SendUsage = 0; |
32 |
cfg_SendUsage = 0; |
Lines 67-73
Link Here
|
67 |
} |
51 |
} |
68 |
|
52 |
|
69 |
#if !defined __MACH__ /* Mach kernel stuff is in stats-mach.c */ |
53 |
#if !defined __MACH__ /* Mach kernel stuff is in stats-mach.c */ |
70 |
@@ -259,6 +259,10 @@ |
54 |
@@ -266,6 +268,10 @@ |
71 |
/* store values for next calculation interval */ |
55 |
/* store values for next calculation interval */ |
72 |
for (state = 0; state < CPUSTATES; state++) |
56 |
for (state = 0; state < CPUSTATES; state++) |
73 |
stime[state] = ctime[state]; |
57 |
stime[state] = ctime[state]; |
Lines 78-84
Link Here
|
78 |
} |
62 |
} |
79 |
} |
63 |
} |
80 |
else { |
64 |
else { |
81 |
@@ -269,17 +273,13 @@ |
65 |
@@ -276,17 +282,13 @@ |
82 |
cfg_SendUsage = 0; |
66 |
cfg_SendUsage = 0; |
83 |
cfg_SendIdle = 0; |
67 |
cfg_SendIdle = 0; |
84 |
} |
68 |
} |
Lines 97-103
Link Here
|
97 |
|
81 |
|
98 |
boottimesecs = initBoottime(); |
82 |
boottimesecs = initBoottime(); |
99 |
|
83 |
|
100 |
@@ -294,7 +294,7 @@ |
84 |
@@ -301,7 +303,7 @@ |
101 |
#endif /* DEBUG */ |
85 |
#endif /* DEBUG */ |
102 |
} |
86 |
} |
103 |
else { |
87 |
else { |
Lines 106-112
Link Here
|
106 |
"getUptime() boottime.tv_sec"); |
90 |
"getUptime() boottime.tv_sec"); |
107 |
} |
91 |
} |
108 |
} |
92 |
} |
109 |
@@ -307,19 +307,18 @@ |
93 |
@@ -314,21 +316,20 @@ |
110 |
double *IdlePercent, char *osname, char *osversion, char *cpu, |
94 |
double *IdlePercent, char *osname, char *osversion, char *cpu, |
111 |
double *loadavg) |
95 |
double *loadavg) |
112 |
{ |
96 |
{ |
Lines 123-134
Link Here
|
123 |
|
107 |
|
124 |
if (cfg_sendcpu) |
108 |
if (cfg_sendcpu) |
125 |
- initCPU(&*cpu); |
109 |
- initCPU(&*cpu); |
126 |
- |
|
|
127 |
- /* if (cfg_sendloadavg) */ |
128 |
- getLoadavg(&*loadavg); |
129 |
+ initCPU(cpu); |
110 |
+ initCPU(cpu); |
130 |
|
111 |
|
131 |
+ if (cfg_sendloadavg) |
112 |
/* WARNING: loadavg is not implemented on Wonko server! */ |
|
|
113 |
/* cfg_SendUsage is implemented instead. (i.e. only CPU usage % a la `top`) */ |
114 |
- /* if (cfg_sendloadavg) */ |
115 |
- getLoadavg(&*loadavg); |
116 |
- |
117 |
+ if (cfg_sendloadavg) |
132 |
+ getLoadavg(loadavg); |
118 |
+ getLoadavg(loadavg); |
133 |
} |
119 |
} |
134 |
#endif /* PLATFORM_BSD */ |
120 |
#endif /* PLATFORM_BSD */ |