View | Details | Raw Unified | Return to bug 92412
Collapse All | Expand All

(-)rstat_proc.c (-29 / +32 lines)
Lines 125-130 Link Here
125
    if (! stat_is_init)
125
    if (! stat_is_init)
126
        stat_init();
126
        stat_init();
127
    sincelastreq = 0;
127
    sincelastreq = 0;
128
    stats_all.s2.if_opackets = stats_all.s3.if_opackets;
128
    return(&stats_all.s2);
129
    return(&stats_all.s2);
129
}
130
}
130
131
Lines 134-139 Link Here
134
    if (! stat_is_init)
135
    if (! stat_is_init)
135
        stat_init();
136
        stat_init();
136
    sincelastreq = 0;
137
    sincelastreq = 0;
138
    stats_all.s1.if_opackets = stats_all.s3.if_opackets;
137
    return(&stats_all.s1);
139
    return(&stats_all.s1);
138
}
140
}
139
141
Lines 205-217 Link Here
205
		exit(1);
207
		exit(1);
206
	}
208
	}
207
	for(i = 0; i < RSTAT_CPUSTATES ; i++)
209
	for(i = 0; i < RSTAT_CPUSTATES ; i++)
208
		stats_all.s1.cp_time[i] = bsd_cp_time[cp_time_xlat[i]];
210
		stats_all.s3.cp_time[i] = bsd_cp_time[cp_time_xlat[i]];
209
211
210
        (void)getloadavg(avrun, sizeof(avrun) / sizeof(avrun[0]));
212
        (void)getloadavg(avrun, sizeof(avrun) / sizeof(avrun[0]));
211
213
212
	stats_all.s2.avenrun[0] = avrun[0] * FSCALE;
214
	stats_all.s3.avenrun[0] = avrun[0] * FSCALE;
213
	stats_all.s2.avenrun[1] = avrun[1] * FSCALE;
215
	stats_all.s3.avenrun[1] = avrun[1] * FSCALE;
214
	stats_all.s2.avenrun[2] = avrun[2] * FSCALE;
216
	stats_all.s3.avenrun[2] = avrun[2] * FSCALE;
215
217
216
	mib[0] = CTL_KERN;
218
	mib[0] = CTL_KERN;
217
	mib[1] = KERN_BOOTTIME;
219
	mib[1] = KERN_BOOTTIME;
Lines 221-233 Link Here
221
		exit(1);
223
		exit(1);
222
	}
224
	}
223
225
224
	stats_all.s2.boottime.tv_sec = btm.tv_sec;
226
	stats_all.s3.boottime.tv_sec = btm.tv_sec;
225
	stats_all.s2.boottime.tv_usec = btm.tv_usec;
227
	stats_all.s3.boottime.tv_usec = btm.tv_usec;
226
228
227
229
228
#ifdef DEBUG
230
#ifdef DEBUG
229
	fprintf(stderr, "%d %d %d %d\n", stats_all.s1.cp_time[0],
231
	fprintf(stderr, "%d %d %d %d\n", stats_all.s3.cp_time[0],
230
	    stats_all.s1.cp_time[1], stats_all.s1.cp_time[2], stats_all.s1.cp_time[3]);
232
	    stats_all.s3.cp_time[1], stats_all.s3.cp_time[2], stats_all.s3.cp_time[3]);
231
#endif
233
#endif
232
234
233
#define	FETCH_CNT(stat, cnt) do {					\
235
#define	FETCH_CNT(stat, cnt) do {					\
Lines 238-252 Link Here
238
	}								\
240
	}								\
239
} while (0)
241
} while (0)
240
242
241
	FETCH_CNT(stats_all.s1.v_pgpgin, vm.v_vnodepgsin);
243
	FETCH_CNT(stats_all.s3.v_pgpgin, vm.v_vnodepgsin);
242
	FETCH_CNT(stats_all.s1.v_pgpgout, vm.v_vnodepgsout);
244
	FETCH_CNT(stats_all.s3.v_pgpgout, vm.v_vnodepgsout);
243
	FETCH_CNT(stats_all.s1.v_pswpin, vm.v_swappgsin);
245
	FETCH_CNT(stats_all.s3.v_pswpin, vm.v_swappgsin);
244
	FETCH_CNT(stats_all.s1.v_pswpout, vm.v_swappgsout);
246
	FETCH_CNT(stats_all.s3.v_pswpout, vm.v_swappgsout);
245
	FETCH_CNT(stats_all.s1.v_intr, sys.v_intr);
247
	FETCH_CNT(stats_all.s3.v_intr, sys.v_intr);
246
	FETCH_CNT(stats_all.s2.v_swtch, sys.v_swtch);
248
	FETCH_CNT(stats_all.s3.v_swtch, sys.v_swtch);
247
	gettimeofday(&tm, (struct timezone *) 0);
248
	stats_all.s1.v_intr -= hz*(tm.tv_sec - btm.tv_sec) +
249
	    hz*(tm.tv_usec - btm.tv_usec)/1000000;
250
249
251
	/* update disk transfers */
250
	/* update disk transfers */
252
	updatexfers(RSTAT_DK_NDRIVE, stats_all.s1.dk_xfer);
251
	updatexfers(RSTAT_DK_NDRIVE, stats_all.s1.dk_xfer);
Lines 262-272 Link Here
262
		exit(1);
261
		exit(1);
263
	}
262
	}
264
263
265
	stats_all.s1.if_ipackets = 0;
264
	stats_all.s3.if_ipackets = 0;
266
	stats_all.s1.if_opackets = 0;
265
	stats_all.s3.if_opackets = 0;
267
	stats_all.s1.if_ierrors = 0;
266
	stats_all.s3.if_ierrors = 0;
268
	stats_all.s1.if_oerrors = 0;
267
	stats_all.s3.if_oerrors = 0;
269
	stats_all.s1.if_collisions = 0;
268
	stats_all.s3.if_collisions = 0;
270
	for (i = 1; i <= ifcount; i++) {
269
	for (i = 1; i <= ifcount; i++) {
271
		len = sizeof ifmd;
270
		len = sizeof ifmd;
272
		mib[3] = IFMIB_IFDATA;
271
		mib[3] = IFMIB_IFDATA;
Lines 281-294 Link Here
281
			exit(1);
280
			exit(1);
282
		}
281
		}
283
282
284
		stats_all.s1.if_ipackets += ifmd.ifmd_data.ifi_ipackets;
283
		stats_all.s3.if_ipackets += ifmd.ifmd_data.ifi_ipackets;
285
		stats_all.s1.if_opackets += ifmd.ifmd_data.ifi_opackets;
284
		stats_all.s3.if_opackets += ifmd.ifmd_data.ifi_opackets;
286
		stats_all.s1.if_ierrors += ifmd.ifmd_data.ifi_ierrors;
285
		stats_all.s3.if_ierrors += ifmd.ifmd_data.ifi_ierrors;
287
		stats_all.s1.if_oerrors += ifmd.ifmd_data.ifi_oerrors;
286
		stats_all.s3.if_oerrors += ifmd.ifmd_data.ifi_oerrors;
288
		stats_all.s1.if_collisions += ifmd.ifmd_data.ifi_collisions;
287
		stats_all.s3.if_collisions += ifmd.ifmd_data.ifi_collisions;
289
	}
288
	}
290
	gettimeofday((struct timeval *)&stats_all.s3.curtime,
289
	gettimeofday(&tm, (struct timezone *) 0);
291
		(struct timezone *) 0);
290
	stats_all.s3.v_intr -= hz*(tm.tv_sec - btm.tv_sec) +
291
	    hz*(tm.tv_usec - btm.tv_usec)/1000000;
292
	stats_all.s3.curtime.tv_sec = tm.tv_sec;
293
	stats_all.s3.curtime.tv_usec = tm.tv_usec;
292
	alarm(1);
294
	alarm(1);
293
}
295
}
294
296
Lines 474-476 Link Here
474
        if (from_inetd)
476
        if (from_inetd)
475
                exit(0);
477
                exit(0);
476
}
478
}
479

Return to bug 92412