aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/vfs_lookup.c
diff options
context:
space:
mode:
authorColin Percival <cperciva@FreeBSD.org>2021-10-16 18:47:34 +0000
committerColin Percival <cperciva@FreeBSD.org>2021-10-16 18:47:34 +0000
commit46dd801acb2318c8464b185893bb111f09b71138 (patch)
tree1e7b6bf14951cf4cd199706dc27430ac41895486 /sys/kern/vfs_lookup.c
parent498cca14836da0408841cca8101e481e32151886 (diff)
downloadsrc-46dd801acb2318c8464b185893bb111f09b71138.tar.gz
src-46dd801acb2318c8464b185893bb111f09b71138.zip
Add userland boot profiling to TSLOG
On kernels compiled with 'options TSLOG', record for each process ID: * The timestamp of the fork() which creates it and the parent process ID, * The first path passed to execve(), if any, * The first path resolved by namei, if any, and * The timestamp of the exit() which terminates the process. Expose this information via a new sysctl, debug.tslog_user. On kernels lacking 'options TSLOG' (the default), no information is recorded and the sysctl does not exist. Note that recording namei is needed in order to obtain the names of rc.d scripts being launched, as the rc system sources them in a subshell rather than execing the scripts. With this commit it is now possible to generate flamecharts of the entire boot process from the start of the loader to the end of /etc/rc. The code needed to perform this processing is currently found in github: https://github.com/cperciva/freebsd-boot-profiling Reviewed by: mhorne Sponsored by: https://www.patreon.com/cperciva Differential Revision: https://reviews.freebsd.org/D32493
Diffstat (limited to 'sys/kern/vfs_lookup.c')
-rw-r--r--sys/kern/vfs_lookup.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c
index c1cefae543da..9e10c3092f5a 100644
--- a/sys/kern/vfs_lookup.c
+++ b/sys/kern/vfs_lookup.c
@@ -611,6 +611,7 @@ namei(struct nameidata *ndp)
ktrnamei(cnp->cn_pnbuf);
}
#endif
+ TSNAMEI(curthread->td_proc->p_pid, cnp->cn_pnbuf);
/*
* First try looking up the target without locking any vnodes.