Date: Thu, 27 Feb 2003 11:39:40 -0800 (PST) From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 26023 for review Message-ID: <200302271939.h1RJdeQw005780@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=26023 Change 26023 by jhb@jhb_laptop on 2003/02/27 11:39:18 Add KTR traces for eventhandlers. Affected files ... .. //depot/projects/smpng/sys/kern/subr_eventhandler.c#11 edit .. //depot/projects/smpng/sys/sys/eventhandler.h#11 edit .. //depot/projects/smpng/sys/sys/ktr.h#12 edit Differences ... ==== //depot/projects/smpng/sys/kern/subr_eventhandler.c#11 (text+ko) ==== @@ -98,6 +98,7 @@ if (list != NULL) { free(new_list, M_EVENTHANDLER); } else { + CTR2(KTR_EVH, "%s: creating list %s", __func__, name); list = new_list; list->el_flags = 0; bzero(&list->el_lock, sizeof(list->el_lock)); @@ -124,6 +125,8 @@ ("%s: handler for %s registered with dead priority", __func__, name)); /* sort it into the list */ + CTR4(KTR_EVH, "%s: adding item %p (function %p) to list %s", __func__, eg, + func, name); EHL_LOCK(list); TAILQ_FOREACH(ep, &list->el_entries, ee_link) { if (eg->ee.ee_priority < ep->ee_priority) { @@ -146,19 +149,29 @@ if (ep != NULL) { /* remove just this entry */ if (list->el_runcount == 0) { + CTR3(KTR_EVH, "%s: removing item %p from list %s", __func__, ep, + name); TAILQ_REMOVE(&list->el_entries, ep, ee_link); free(ep, M_EVENTHANDLER); - } else + } else { + CTR3(KTR_EVH, "%s: marking item %p from list %s as dead", __func__, + ep, name); ep->ee_priority = EHE_DEAD_PRIORITY; + } } else { /* remove entire list */ if (list->el_runcount == 0) { + CTR2(KTR_EVH, "%s: removing all items from list %s", __func__, + name); + TAILQ_REMOVE(&list->el_entries, ep, ee_link); while (!TAILQ_EMPTY(&list->el_entries)) { ep = TAILQ_FIRST(&list->el_entries); TAILQ_REMOVE(&list->el_entries, ep, ee_link); free(ep, M_EVENTHANDLER); } } else { + CTR2(KTR_EVH, "%s: marking all items from list %s as dead", + __func__, name); TAILQ_FOREACH(ep, &list->el_entries, ee_link) ep->ee_priority = EHE_DEAD_PRIORITY; } @@ -179,6 +192,10 @@ if (!strcmp(name, list->el_name)) break; } + if (list != NULL) + CTR3(KTR_EVH, "%s: found list \"%s\" (%p)", __func__, name, list); + else + CTR2(KTR_EVH, "%s: did not find list \"%s\"", __func__, name); return (list); } @@ -210,6 +227,7 @@ { struct eventhandler_entry *ep, *en; + CTR2(KTR_EVH, "%s: pruning list \"%s\"", __func__, list->el_name); EHL_LOCK_ASSERT(list, MA_OWNED); ep = TAILQ_FIRST(&list->el_entries); while (ep != NULL) { ==== //depot/projects/smpng/sys/sys/eventhandler.h#11 (text+ko) ==== @@ -30,6 +30,7 @@ #define SYS_EVENTHANDLER_H #include <sys/lock.h> +#include <sys/ktr.h> #include <sys/mutex.h> #include <sys/queue.h> @@ -69,10 +70,13 @@ (list)->el_runcount++; \ KASSERT((list)->el_runcount > 0, \ ("eventhandler_invoke: runcount overflow")); \ + CTR0(KTR_EVH, "eventhandler_invoke(" __STRING(name) ")"); \ TAILQ_FOREACH(_ep, &((list)->el_entries), ee_link) { \ if (!(_ep->ee_priority != EHE_DEAD_PRIORITY)) { \ EHL_UNLOCK((list)); \ _t = (struct eventhandler_entry_ ## name *)_ep; \ + CTR1(KTR_EVH, "eh_invoke: executing %p", \ + (void *)_t->eh_func); \ _t->eh_func(_ep->ee_arg , __VA_ARGS__); \ EHL_LOCK((list)); \ } \ ==== //depot/projects/smpng/sys/sys/ktr.h#12 (text+ko) ==== @@ -72,7 +72,8 @@ #define KTR_WITNESS 0x00200000 #define KTR_RUNQ 0x00400000 /* Run queue */ #define KTR_CONTENTION 0x00800000 /* Lock contention */ -#define KTR_ALL 0x00ffffff +#define KTR_EVH 0x01000000 /* Eventhandler */ +#define KTR_ALL 0x01ffffff /* * Trace classes which can be assigned to particular use at compile time To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200302271939.h1RJdeQw005780>