Instrument thread creations for the the benefit of the TSLOG framework.

This assists in tracking time spent while the boot is being "held" waiting
for something to happen.
This commit is contained in:
Colin Percival 2017-12-31 09:24:11 +00:00
parent 8b8a7c43a9
commit 49a4e3b4b4

View File

@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$");
#include <sys/unistd.h> #include <sys/unistd.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <sys/sched.h> #include <sys/sched.h>
#include <sys/tslog.h>
#include <vm/vm.h> #include <vm/vm.h>
#include <vm/vm_extern.h> #include <vm/vm_extern.h>
@ -124,6 +125,7 @@ kproc_create(void (*func)(void *), void *arg,
#ifdef KTR #ifdef KTR
sched_clear_tdname(td); sched_clear_tdname(td);
#endif #endif
TSTHREAD(td, td->td_name);
/* call the processes' main()... */ /* call the processes' main()... */
cpu_fork_kthread_handler(td, func, arg); cpu_fork_kthread_handler(td, func, arg);
@ -283,6 +285,8 @@ kthread_add(void (*func)(void *), void *arg, struct proc *p,
vsnprintf(newtd->td_name, sizeof(newtd->td_name), fmt, ap); vsnprintf(newtd->td_name, sizeof(newtd->td_name), fmt, ap);
va_end(ap); va_end(ap);
TSTHREAD(newtd, newtd->td_name);
newtd->td_proc = p; /* needed for cpu_copy_thread */ newtd->td_proc = p; /* needed for cpu_copy_thread */
/* might be further optimized for kthread */ /* might be further optimized for kthread */
cpu_copy_thread(newtd, oldtd); cpu_copy_thread(newtd, oldtd);