summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/kern/kern_tc.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c
index c84054b..6409842 100644
--- a/sys/kern/kern_tc.c
+++ b/sys/kern/kern_tc.c
@@ -103,6 +103,7 @@ static int timestepwarnings;
SYSCTL_INT(_kern_timecounter, OID_AUTO, stepwarnings, CTLFLAG_RW,
&timestepwarnings, 0, "");
+#ifdef TC_COUNTERS
#define TC_STATS(foo) \
static u_int foo; \
SYSCTL_UINT(_kern_timecounter, OID_AUTO, foo, CTLFLAG_RD, &foo, 0, "");\
@@ -114,7 +115,11 @@ TC_STATS(ngetbinuptime); TC_STATS(ngetnanouptime); TC_STATS(ngetmicrouptime);
TC_STATS(ngetbintime); TC_STATS(ngetnanotime); TC_STATS(ngetmicrotime);
TC_STATS(nsetclock);
+#define TC_COUNT(var) var++
#undef TC_STATS
+#else
+#define TC_COUNT(var) /* nothing */
+#endif /* TC_COUNTERS */
static void tc_windup(void);
static void cpu_tick_calibrate(int);
@@ -180,7 +185,7 @@ binuptime(struct bintime *bt)
struct timehands *th;
u_int gen;
- nbinuptime++;
+ TC_COUNT(nbinuptime);
do {
th = timehands;
gen = th->th_generation;
@@ -194,7 +199,7 @@ nanouptime(struct timespec *tsp)
{
struct bintime bt;
- nnanouptime++;
+ TC_COUNT(nnanouptime);
binuptime(&bt);
bintime2timespec(&bt, tsp);
}
@@ -204,7 +209,7 @@ microuptime(struct timeval *tvp)
{
struct bintime bt;
- nmicrouptime++;
+ TC_COUNT(nmicrouptime);
binuptime(&bt);
bintime2timeval(&bt, tvp);
}
@@ -213,7 +218,7 @@ void
bintime(struct bintime *bt)
{
- nbintime++;
+ TC_COUNT(nbintime);
binuptime(bt);
bintime_add(bt, &boottimebin);
}
@@ -223,7 +228,7 @@ nanotime(struct timespec *tsp)
{
struct bintime bt;
- nnanotime++;
+ TC_COUNT(nnanotime);
bintime(&bt);
bintime2timespec(&bt, tsp);
}
@@ -233,7 +238,7 @@ microtime(struct timeval *tvp)
{
struct bintime bt;
- nmicrotime++;
+ TC_COUNT(nmicrotime);
bintime(&bt);
bintime2timeval(&bt, tvp);
}
@@ -244,7 +249,7 @@ getbinuptime(struct bintime *bt)
struct timehands *th;
u_int gen;
- ngetbinuptime++;
+ TC_COUNT(ngetbinuptime);
do {
th = timehands;
gen = th->th_generation;
@@ -258,7 +263,7 @@ getnanouptime(struct timespec *tsp)
struct timehands *th;
u_int gen;
- ngetnanouptime++;
+ TC_COUNT(ngetnanouptime);
do {
th = timehands;
gen = th->th_generation;
@@ -272,7 +277,7 @@ getmicrouptime(struct timeval *tvp)
struct timehands *th;
u_int gen;
- ngetmicrouptime++;
+ TC_COUNT(ngetmicrouptime);
do {
th = timehands;
gen = th->th_generation;
@@ -286,7 +291,7 @@ getbintime(struct bintime *bt)
struct timehands *th;
u_int gen;
- ngetbintime++;
+ TC_COUNT(ngetbintime);
do {
th = timehands;
gen = th->th_generation;
@@ -301,7 +306,7 @@ getnanotime(struct timespec *tsp)
struct timehands *th;
u_int gen;
- ngetnanotime++;
+ TC_COUNT(ngetnanotime);
do {
th = timehands;
gen = th->th_generation;
@@ -315,7 +320,7 @@ getmicrotime(struct timeval *tvp)
struct timehands *th;
u_int gen;
- ngetmicrotime++;
+ TC_COUNT(ngetmicrotime);
do {
th = timehands;
gen = th->th_generation;
@@ -406,7 +411,7 @@ tc_setclock(struct timespec *ts)
struct bintime bt, bt2;
cpu_tick_calibrate(1);
- nsetclock++;
+ TC_COUNT(nsetclock);
nanotime(&tbef);
timespec2bintime(ts, &bt);
binuptime(&bt2);
OpenPOWER on IntegriCloud