These are the source and make files for the Raspberry Pi performance counter kernel module. Don’t forget to do all of the preparation steps that are needed to perform an out-of-tree kernel module build! The make file will not build the kernel module without kernel header files and the rest of the steps.
As always, do things at the kernel level at your own peril. No warranties expressed, implied, or guaranteed.