summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2003-01-21 20:33:27 +0000
committerdes <des@FreeBSD.org>2003-01-21 20:33:27 +0000
commitae16fa6bfbfaf715077a5d782daf4132d071619d (patch)
treefbc019089a29d0e0474d16aa8dfa07eac2f97946
parent95173465f516a70d32ad373849f753432ebd94dd (diff)
downloadFreeBSD-src-ae16fa6bfbfaf715077a5d782daf4132d071619d.zip
FreeBSD-src-ae16fa6bfbfaf715077a5d782daf4132d071619d.tar.gz
There's absolutely no need for a struct-within-a-struct, so move the
counters out of the inner struct and remove it.
-rw-r--r--sys/kern/kern_mutex.c26
-rw-r--r--sys/kern/subr_turnstile.c26
2 files changed, 24 insertions, 28 deletions
diff --git a/sys/kern/kern_mutex.c b/sys/kern/kern_mutex.c
index 1a32471..b9a9099 100644
--- a/sys/kern/kern_mutex.c
+++ b/sys/kern/kern_mutex.c
@@ -218,11 +218,9 @@ struct mutex_prof {
const char *name;
const char *file;
int line;
- struct {
- uintmax_t max;
- uintmax_t tot;
- uintmax_t cur;
- } cnt;
+ uintmax_t cnt_max;
+ uintmax_t cnt_tot;
+ uintmax_t cnt_cur;
struct mutex_prof *next;
};
@@ -294,11 +292,11 @@ dump_mutex_prof_stats(SYSCTL_HANDLER_ARGS)
mtx_lock_spin(&mprof_mtx);
for (i = 0; i < first_free_mprof_buf; ++i)
sbuf_printf(sb, "%6ju %12ju %11ju %5ju %s:%d (%s)\n",
- mprof_buf[i].cnt.max / 1000,
- mprof_buf[i].cnt.tot / 1000,
- mprof_buf[i].cnt.cur,
- mprof_buf[i].cnt.cur == 0 ? (uintmax_t)0 :
- mprof_buf[i].cnt.tot / (mprof_buf[i].cnt.cur * 1000),
+ mprof_buf[i].cnt_max / 1000,
+ mprof_buf[i].cnt_tot / 1000,
+ mprof_buf[i].cnt_cur,
+ mprof_buf[i].cnt_cur == 0 ? (uintmax_t)0 :
+ mprof_buf[i].cnt_tot / (mprof_buf[i].cnt_cur * 1000),
mprof_buf[i].file, mprof_buf[i].line, mprof_buf[i].name);
mtx_unlock_spin(&mprof_mtx);
sbuf_finish(sb);
@@ -393,10 +391,10 @@ _mtx_unlock_flags(struct mtx *m, int opts, const char *file, int line)
* Record if the mutex has been held longer now than ever
* before.
*/
- if (now - acqtime > mpp->cnt.max)
- mpp->cnt.max = now - acqtime;
- mpp->cnt.tot += now - acqtime;
- mpp->cnt.cur++;
+ if (now - acqtime > mpp->cnt_max)
+ mpp->cnt_max = now - acqtime;
+ mpp->cnt_tot += now - acqtime;
+ mpp->cnt_cur++;
unlock:
mtx_unlock_spin(&mprof_mtx);
}
diff --git a/sys/kern/subr_turnstile.c b/sys/kern/subr_turnstile.c
index 1a32471..b9a9099 100644
--- a/sys/kern/subr_turnstile.c
+++ b/sys/kern/subr_turnstile.c
@@ -218,11 +218,9 @@ struct mutex_prof {
const char *name;
const char *file;
int line;
- struct {
- uintmax_t max;
- uintmax_t tot;
- uintmax_t cur;
- } cnt;
+ uintmax_t cnt_max;
+ uintmax_t cnt_tot;
+ uintmax_t cnt_cur;
struct mutex_prof *next;
};
@@ -294,11 +292,11 @@ dump_mutex_prof_stats(SYSCTL_HANDLER_ARGS)
mtx_lock_spin(&mprof_mtx);
for (i = 0; i < first_free_mprof_buf; ++i)
sbuf_printf(sb, "%6ju %12ju %11ju %5ju %s:%d (%s)\n",
- mprof_buf[i].cnt.max / 1000,
- mprof_buf[i].cnt.tot / 1000,
- mprof_buf[i].cnt.cur,
- mprof_buf[i].cnt.cur == 0 ? (uintmax_t)0 :
- mprof_buf[i].cnt.tot / (mprof_buf[i].cnt.cur * 1000),
+ mprof_buf[i].cnt_max / 1000,
+ mprof_buf[i].cnt_tot / 1000,
+ mprof_buf[i].cnt_cur,
+ mprof_buf[i].cnt_cur == 0 ? (uintmax_t)0 :
+ mprof_buf[i].cnt_tot / (mprof_buf[i].cnt_cur * 1000),
mprof_buf[i].file, mprof_buf[i].line, mprof_buf[i].name);
mtx_unlock_spin(&mprof_mtx);
sbuf_finish(sb);
@@ -393,10 +391,10 @@ _mtx_unlock_flags(struct mtx *m, int opts, const char *file, int line)
* Record if the mutex has been held longer now than ever
* before.
*/
- if (now - acqtime > mpp->cnt.max)
- mpp->cnt.max = now - acqtime;
- mpp->cnt.tot += now - acqtime;
- mpp->cnt.cur++;
+ if (now - acqtime > mpp->cnt_max)
+ mpp->cnt_max = now - acqtime;
+ mpp->cnt_tot += now - acqtime;
+ mpp->cnt_cur++;
unlock:
mtx_unlock_spin(&mprof_mtx);
}
OpenPOWER on IntegriCloud