Module Name: src Committed By: maxv Date: Fri Jul 13 07:56:29 UTC 2018
Modified Files: src/sys/arch/x86/x86: tprof_amdpmi.c tprof_pmi.c src/sys/dev/tprof: tprof.c tprof.h tprof_ioctl.h tprof_types.h src/usr.sbin/tprof: Makefile tprof.8 tprof.c Added Files: src/usr.sbin/tprof: tprof.h src/usr.sbin/tprof/arch: tprof_noarch.c tprof_x86.c Removed Files: src/usr.sbin/tprof: README tpann.sh tpfmt.sh Log Message: Revamp tprof. Rewrite the Intel backend to use the generic PMC interface, which is available on all Intel CPUs. Synchronize the AMD backend with the new interface. The kernel identifies the PMC interface, and gives its id to userland. Userland then queries the events itself (via cpuid etc). These events depend on the PMC interface. The tprof utility is rewritten to allow the user to choose which event to count (which was not possible until now, the event was hardcoded in the backend). The command line format is based on usr.bin/pmc, eg: tprof -e llc-misses:k -o output sleep 20 The man page is updated too, but the arguments will likely change soon anyway so it doesn't matter a lot. The tprof utility has three tables: Intel Architectural Version 1 Intel Skylake/Kabylake AMD Family 10h A CPU can support a combination of tables. For example Kabylake has Intel-Architectural-Version-1 and its own Intel-Kabylake table. For now the Intel Skylake/Kabylake table contains only one event, just to demonstrate that the combination of tables works. Tested on an Intel Core i5 Kabylake. The code for AMD Family 10h is taken from the code I had written for usr.bin/pmc. I haven't tested it yet, but it's the same as pmc(1), so I guess it works as-is. The whole thing is written in such a way that (I think) it is not complicated to add more CPU models, and more architectures (other than x86). To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/arch/x86/x86/tprof_amdpmi.c cvs rdiff -u -r1.14 -r1.15 src/sys/arch/x86/x86/tprof_pmi.c cvs rdiff -u -r1.13 -r1.14 src/sys/dev/tprof/tprof.c cvs rdiff -u -r1.5 -r1.6 src/sys/dev/tprof/tprof.h cvs rdiff -u -r1.3 -r1.4 src/sys/dev/tprof/tprof_ioctl.h cvs rdiff -u -r1.2 -r1.3 src/sys/dev/tprof/tprof_types.h cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/tprof/Makefile \ src/usr.sbin/tprof/tprof.8 cvs rdiff -u -r1.9 -r0 src/usr.sbin/tprof/README cvs rdiff -u -r1.2 -r0 src/usr.sbin/tprof/tpann.sh cvs rdiff -u -r1.3 -r0 src/usr.sbin/tprof/tpfmt.sh cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/tprof/tprof.c cvs rdiff -u -r0 -r1.1 src/usr.sbin/tprof/tprof.h cvs rdiff -u -r0 -r1.1 src/usr.sbin/tprof/arch/tprof_noarch.c \ src/usr.sbin/tprof/arch/tprof_x86.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.