Module Name: src
Committed By: matt
Date: Fri Jan 7 01:11:13 UTC 2011
Modified Files:
src/sys/kern [matt-nb5-pq3]: kern_clock.c
src/sys/sys [matt-nb5-pq3]: cpu_data.h
Log Message:
Accumulate syscall, context switch, and other uvmexp counts in cpu_data
and merge into uvmexp. (smaller less impact change than the one for HEAD).
To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.126.20.1 src/sys/kern/kern_clock.c
cvs rdiff -u -r1.27 -r1.27.20.1 src/sys/sys/cpu_data.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/kern/kern_clock.c
diff -u src/sys/kern/kern_clock.c:1.126 src/sys/kern/kern_clock.c:1.126.20.1
--- src/sys/kern/kern_clock.c:1.126 Sun Oct 5 21:57:20 2008
+++ src/sys/kern/kern_clock.c Fri Jan 7 01:11:13 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_clock.c,v 1.126 2008/10/05 21:57:20 pooka Exp $ */
+/* $NetBSD: kern_clock.c,v 1.126.20.1 2011/01/07 01:11:13 matt Exp $ */
/*-
* Copyright (c) 2000, 2004, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -69,7 +69,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_clock.c,v 1.126 2008/10/05 21:57:20 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_clock.c,v 1.126.20.1 2011/01/07 01:11:13 matt Exp $");
#include "opt_ntp.h"
#include "opt_perfctrs.h"
@@ -321,13 +321,23 @@
ci = l->l_cpu;
- /* Accumulate syscall and context switch counts. */
+ /*
+ * Accumulate syscall, context switch, and other uvmexp counts. There
+ * is a small window where we could loose an counter increment but
+ * the overhead just isn't worth it to have perfect statistics.
+ */
atomic_add_int((unsigned *)&uvmexp.swtch, ci->ci_data.cpu_nswtch);
ci->ci_data.cpu_nswtch = 0;
atomic_add_int((unsigned *)&uvmexp.syscalls, ci->ci_data.cpu_nsyscall);
ci->ci_data.cpu_nsyscall = 0;
atomic_add_int((unsigned *)&uvmexp.traps, ci->ci_data.cpu_ntrap);
ci->ci_data.cpu_ntrap = 0;
+ atomic_add_int((unsigned *)&uvmexp.intrs, ci->ci_data.cpu_nintr);
+ ci->ci_data.cpu_nintr = 0;
+ atomic_add_int((unsigned *)&uvmexp.softs, ci->ci_data.cpu_nsoft);
+ ci->ci_data.cpu_nsoft = 0;
+ atomic_add_int((unsigned *)&uvmexp.faults, ci->ci_data.cpu_nfault);
+ ci->ci_data.cpu_nfault = 0;
if ((l->l_flag & LW_IDLE) != 0)
return;
Index: src/sys/sys/cpu_data.h
diff -u src/sys/sys/cpu_data.h:1.27 src/sys/sys/cpu_data.h:1.27.20.1
--- src/sys/sys/cpu_data.h:1.27 Tue Jun 3 15:50:22 2008
+++ src/sys/sys/cpu_data.h Fri Jan 7 01:11:13 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_data.h,v 1.27 2008/06/03 15:50:22 ad Exp $ */
+/* $NetBSD: cpu_data.h,v 1.27.20.1 2011/01/07 01:11:13 matt Exp $ */
/*-
* Copyright (c) 2004, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -86,6 +86,9 @@
u_int cpu_nsyscall; /* syscall counter */
u_int cpu_ntrap; /* trap counter */
u_int cpu_nswtch; /* context switch counter */
+ u_int cpu_nintr; /* interrupt count */
+ u_int cpu_nsoft; /* soft interrupt count */
+ u_int cpu_nfault; /* pagefault counter */
void *cpu_uvm; /* uvm per-cpu data */
void *cpu_softcpu; /* soft interrupt table */
TAILQ_HEAD(,buf) cpu_biodone; /* finished block xfers */