Cannot append perf to file

Solution 1:

perf stat writes to stderr by default, you're redirecting stdout.

Use the --output and --append options to specify where the results should be written.

perf stat -a --output power.log --append -e power/energy-cores/,power/energy-gpu/,power/energy-pkg/, power/energy-ram sleep 1