Run the command: $dtrace -o /tmp/log -n open:entry'{@[copyinstr(arg0)] = count()}'
And in another command shell run: $make buildworld && make buildkernel && make installkernel
When the build completes, type Ctrl-C in the dtrace window and look at /tmp/log
So which 3 files were opened the most often and how many times?
Answer (last 1000 lines of the 16 MB output file):
/usr/obj/freebsd2/u2/p4/dtrace/src/tmp/usr/include/sys/ioccom.h 4604 ./sys/unistd.h 4651 /usr/obj/freebsd2/u2/p4/dtrace/src/tmp/usr/include/netinet/in.h 4723 /usr/obj/freebsd2/u2/p4/dtrace/src/tmp/usr/include/netinet6/in6.h 4723 ./sys/limits.h 4789 ./errno.h 4845 ./stdarg.h 4925 @/sys/systm.h 4946 /usr/obj/freebsd2/u2/p4/dtrace/src/tmp/usr/include/sys/socket.h 5111 ./sys/queue.h 5174 /usr/obj/freebsd2/u2/p4/dtrace/src/tmp/usr/include/sys/stat.h 5285 ./sys/stdint.h 5368 /usr/obj/freebsd2/u2/p4/dtrace/src/tmp/usr/include/sys/_iovec.h 5377 ./stdio.h 5442 ./machine/_stdint.h 5524 /usr/obj/freebsd2/u2/p4/dtrace/src/tmp/usr/include/fcntl.h 5651 ./stdlib.h 5754 ./string.h 5806 ./strings.h 5806 ./sys/signal.h 5839 ./machine/signal.h 5861 ./machine/trap.h 5907 /freebsd2/u2/p4/dtrace/src/share/mk/bsd.prog.mk 5960 ./machine/_limits.h 6113 /usr/obj/freebsd2/u2/p4/dtrace/src/tmp/usr/include/ctype.h 6594 /usr/obj/freebsd2/u2/p4/dtrace/src/tmp/usr/include/runetype.h 6646 /usr/obj/freebsd2/u2/p4/dtrace/src/tmp/usr/include/_ctype.h 6648 /freebsd2/u2/p4/dtrace/src/share/mk/bsd.man.mk 6670 /usr/obj/freebsd2/u2/p4/dtrace/src/tmp/usr/include/limits.h 7130 /usr/obj/freebsd2/u2/p4/dtrace/src/tmp/usr/include/stddef.h 7266 /usr/obj/freebsd2/u2/p4/dtrace/src/tmp/usr/include/sys/param.h 7380 ./sys/time.h 7504 ./sys/param.h 7694 /freebsd2/u2/p4/dtrace/src/share/mk/bsd.files.mk 7808 /freebsd2/u2/p4/dtrace/src/share/mk/bsd.nls.mk 7808 /freebsd2/u2/p4/dtrace/src/share/mk/bsd.incs.mk 7818 /freebsd2/u2/p4/dtrace/src/share/mk/bsd.libnames.mk 7854 .depend 7918 ./sys/syslimits.h 8513 /usr/obj/freebsd2/u2/p4/dtrace/src/tmp/usr/include/sys/time.h 9037 /usr/obj/freebsd2/u2/p4/dtrace/src/tmp/usr/include/sys/signal.h 9183 ./machine/param.h 9231 ./sys/_timeval.h 9923 ./sys/select.h 9923 ./sys/types.h 9923 ./sys/_pthreadtypes.h 9927 ./sys/_sigset.h 9945 ./machine/endian.h 9987 /usr/obj/freebsd2/u2/p4/dtrace/src/tmp/usr/include/machine/trap.h 10034 /usr/obj/freebsd2/u2/p4/dtrace/src/tmp/usr/include/machine/signal.h 10068 /freebsd2/u2/p4/dtrace/src/share/mk/bsd.links.mk 10098 /freebsd2/u2/p4/dtrace/src/share/mk/bsd.dep.mk 10144 /freebsd2/u2/p4/dtrace/src/share/mk/bsd.sys.mk 10144 ./sys/timespec.h 10163 /usr/obj/freebsd2/u2/p4/dtrace/src/tmp/usr/include/stdarg.h 10377 ./sys/_null.h 10404 ./sys/_types.h 10516 ./sys/cdefs.h 10546 ./machine/_types.h 10580 /usr/obj/freebsd2/u2/p4/dtrace/src/tmp/usr/include/sys/syslimits.h 10581 /usr/obj/freebsd2/u2/p4/dtrace/src/tmp/usr/include/sys/limits.h 10613 /freebsd2/u2/p4/dtrace/src/share/mk/bsd.obj.mk 10717 /usr/obj/freebsd2/u2/p4/dtrace/src/tmp/usr/include/time.h 11240 /freebsd2/u2/p4/dtrace/src/share/mk/bsd.subdir.mk 11487 /freebsd2/u2/p4/dtrace/src/share/mk/bsd.cpu.mk 11513 /freebsd2/u2/p4/dtrace/src/share/mk/bsd.dtrace.mk 11513 /freebsd2/u2/p4/dtrace/src/share/mk 11519 /freebsd2/u2/p4/dtrace/src/share/mk/sys.mk 11519 /etc/make.conf 11559 /usr/obj/freebsd2/u2/p4/dtrace/src/tmp/usr/include/unistd.h 11568 /usr/obj/freebsd2/u2/p4/dtrace/src/tmp/usr/include/sys/unistd.h 12111 /usr/obj/freebsd2/u2/p4/dtrace/src/tmp/usr/include/errno.h 12651 . 13434 /usr/obj/freebsd2/u2/p4/dtrace/src/tmp/usr/include/machine/param.h 13948 /usr/obj/freebsd2/u2/p4/dtrace/src/tmp/usr/include/machine/_limits.h 14460 /usr/obj/freebsd2/u2/p4/dtrace/src/tmp/usr/include/stdlib.h 15081 /usr/obj/freebsd2/u2/p4/dtrace/src/tmp/usr/include/stdio.h 15354 /usr/obj/freebsd2/u2/p4/dtrace/src/tmp/usr/include/string.h 15452 /usr/obj/freebsd2/u2/p4/dtrace/src/tmp/usr/include/strings.h 15539 /usr/obj/freebsd2/u2/p4/dtrace/src/tmp/usr/include/sys/select.h 17189 /usr/obj/freebsd2/u2/p4/dtrace/src/tmp/usr/include/sys/_timeval.h 17250 /usr/obj/freebsd2/u2/p4/dtrace/src/tmp/usr/include/sys/_sigset.h 17398 /usr/obj/freebsd2/u2/p4/dtrace/src/tmp/usr/include/sys/types.h 17477 /usr/obj/freebsd2/u2/p4/dtrace/src/tmp/usr/include/sys/_pthreadtypes.h 17557 /usr/obj/freebsd2/u2/p4/dtrace/src/tmp/usr/include/sys/timespec.h 17764 /usr/obj/freebsd2/u2/p4/dtrace/src/tmp/usr/include/machine/endian.h 19359 /usr/obj/freebsd2/u2/p4/dtrace/src/tmp/usr/include/sys/_null.h 19673 /usr/obj/freebsd2/u2/p4/dtrace/src/tmp/usr/include/sys/_types.h 20937 /freebsd2/u2/p4/dtrace/src/share/mk/bsd.init.mk 22220 /usr/obj/freebsd2/u2/p4/dtrace/src/tmp/usr/include/sys/cdefs.h 22728 /usr/obj/freebsd2/u2/p4/dtrace/src/tmp/usr/include/machine/_types.h 22765 /freebsd2/u2/p4/dtrace/src/share/mk/bsd.compat.mk 23000 /freebsd2/u2/p4/dtrace/src/share/mk/bsd.own.mk 25172 /lib/libedit.so.5 27266 /lib/libncurses.so.6 27365 /usr/obj/freebsd2/u2/p4/dtrace/src/tmp/usr/include/openssl/e_os2.h 30120 /usr/obj/freebsd2/u2/p4/dtrace/src/tmp/usr/include/openssl/opensslconf.h 45805 /etc/libmap.conf 53930 /lib/libc.so.6 53930 /var/run/ld-elf.so.hints 53930