aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_ktr.c
diff options
context:
space:
mode:
authorJulian Elischer <julian@FreeBSD.org>2010-04-14 21:42:29 +0000
committerJulian Elischer <julian@FreeBSD.org>2010-04-14 21:42:29 +0000
commit94a04272dd05c37153769d2283b6d189fbfbf60d (patch)
treeea732b88e170def7983ba783a0ca5803bdd51185 /sys/kern/kern_ktr.c
parent9b00b6e1ee532360ba70ef40fe80232e3719b699 (diff)
downloadsrc-94a04272dd05c37153769d2283b6d189fbfbf60d.tar.gz
src-94a04272dd05c37153769d2283b6d189fbfbf60d.zip
Change the semantics of the debug.ktr.alq_enable control so that when you
disable alq, it acts as if alq had not been enabled in the build. in other words, the rest of ktr is still available for use. If you really don't want that as well, set the mask to 0. MFC after:3 weeks
Notes
Notes: svn path=/head/; revision=206632
Diffstat (limited to 'sys/kern/kern_ktr.c')
-rw-r--r--sys/kern/kern_ktr.c54
1 files changed, 30 insertions, 24 deletions
diff --git a/sys/kern/kern_ktr.c b/sys/kern/kern_ktr.c
index 6117cd6cbba6..9586ae652784 100644
--- a/sys/kern/kern_ktr.c
+++ b/sys/kern/kern_ktr.c
@@ -199,9 +199,8 @@ ktr_tracepoint(u_int mask, const char *file, int line, const char *format,
struct ktr_entry *entry;
#ifdef KTR_ALQ
struct ale *ale = NULL;
-#else
- int newindex, saveindex;
#endif
+ int newindex, saveindex;
#if defined(KTR_VERBOSE) || defined(KTR_ALQ)
struct thread *td;
#endif
@@ -221,27 +220,30 @@ ktr_tracepoint(u_int mask, const char *file, int line, const char *format,
td->td_pflags |= TDP_INKTR;
#endif
#ifdef KTR_ALQ
- if (ktr_alq_enabled &&
- td->td_critnest == 0 &&
- (td->td_flags & TDF_IDLETD) == 0 &&
- td != ald_thread) {
- if (ktr_alq_max && ktr_alq_cnt > ktr_alq_max)
- goto done;
- if ((ale = alq_get(ktr_alq, ALQ_NOWAIT)) == NULL) {
- ktr_alq_failed++;
+ if (ktr_alq_enabled) {
+ if (td->td_critnest == 0 &&
+ (td->td_flags & TDF_IDLETD) == 0 &&
+ td != ald_thread) {
+ if (ktr_alq_max && ktr_alq_cnt > ktr_alq_max)
+ goto done;
+ if ((ale = alq_get(ktr_alq, ALQ_NOWAIT)) == NULL) {
+ ktr_alq_failed++;
+ goto done;
+ }
+ ktr_alq_cnt++;
+ entry = (struct ktr_entry *)ale->ae_data;
+ } else {
goto done;
}
- ktr_alq_cnt++;
- entry = (struct ktr_entry *)ale->ae_data;
} else
- goto done;
-#else
- do {
- saveindex = ktr_idx;
- newindex = (saveindex + 1) & (KTR_ENTRIES - 1);
- } while (atomic_cmpset_rel_int(&ktr_idx, saveindex, newindex) == 0);
- entry = &ktr_buf[saveindex];
#endif
+ {
+ do {
+ saveindex = ktr_idx;
+ newindex = (saveindex + 1) & (KTR_ENTRIES - 1);
+ } while (atomic_cmpset_rel_int(&ktr_idx, saveindex, newindex) == 0);
+ entry = &ktr_buf[saveindex];
+ }
entry->ktr_timestamp = KTR_TIME;
entry->ktr_cpu = cpu;
entry->ktr_thread = curthread;
@@ -271,7 +273,7 @@ ktr_tracepoint(u_int mask, const char *file, int line, const char *format,
entry->ktr_parms[4] = arg5;
entry->ktr_parms[5] = arg6;
#ifdef KTR_ALQ
- if (ale)
+ if (ktr_alq_enabled && ale)
alq_post(ktr_alq, ale);
done:
#endif
@@ -295,7 +297,9 @@ DB_SHOW_COMMAND(ktr, db_ktr_all)
tstate.cur = (ktr_idx - 1) & (KTR_ENTRIES - 1);
tstate.first = -1;
- db_ktr_verbose = index(modif, 'v') != NULL;
+ db_ktr_verbose = 0;
+ db_ktr_verbose |= (index(modif, 'v') != NULL) ? 2 : 0;
+ db_ktr_verbose |= (index(modif, 'V') != NULL) ? 1 : 0; /* just timestap please */
if (index(modif, 'a') != NULL) {
db_disable_pager();
while (cncheckc() != -1)
@@ -329,9 +333,11 @@ db_mach_vtrace(void)
db_printf(":cpu%d", kp->ktr_cpu);
#endif
db_printf(")");
- if (db_ktr_verbose) {
- db_printf(" %10.10lld %s.%d", (long long)kp->ktr_timestamp,
- kp->ktr_file, kp->ktr_line);
+ if (db_ktr_verbose >= 1) {
+ db_printf(" %10.10lld", (long long)kp->ktr_timestamp);
+ }
+ if (db_ktr_verbose >= 2) {
+ db_printf(" %s.%d", kp->ktr_file, kp->ktr_line);
}
db_printf(": ");
db_printf(kp->ktr_desc, kp->ktr_parms[0], kp->ktr_parms[1],