com.apple.PerfPowerServices is a component or service provided by Apple that is related to power management and performance monitoring on Apple devices. So I believe the cause of your iMac restarting is due to power-related issues.
Try resetting SMC (System Management Controller) to resolve problems relevant to power management, battery charging, and other hardware functions after unplugging unnecessary peripherals. If it doesn't work, format your Mac and reinstall macOS.
Remember to back up your Mac if you decide to do a fresh install, as formatting will remove all data on your Mac. If you can't log into your Mac, use data recovery in Recovery Mode to restore the files.