This implementation does not use assembly because it is intended for use in Go, which does not support inline assembly—working with assembly in Go would be cumbersome. Additionally, performance is not a critical concern for the project, so we directly Get pre-computed values from the kernel via command-line access.
On Raspbian, CPU information is stored in the /sys/devices/system/cpu/ directory, which contains the following contents:
$ ls /sys/devices/system/cpu/
cpu0 cpu2 cpufreq isolated modalias online power uevent
cpu1 cpu3 cpuidle kernel_max offline possible present vulnerabilities
To get the frequency of a specific CPU core (e.g., the first core, cpu0), use this command:
$ sudo cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq
600000
For an overall reference of the CPU frequency, use this method instead:
$ sudo cat /sys/devices/system/cpu/cpufreq/policy0/cpuinfo_cur_freq
800000
The second path is a bit unusual and worth noting.
I hope these will help someone in need~