metrics: Access scaling_cur_freq through the cpu's cpufreq symlink

cpufreq policies are usually created one per CPU, resulting in a policyN
directory in cpufreq for each CPU in sysfs. However, some CPUs share a
policy, and hence only one policy is created for each group of CPUs that
share that policy. For example, on mt8173, the clusters of little and
big CPUs share a policy. CPUs 0,1 (little) share policy0, and CPUs 2,3
(big) share policy2.

We can see this on elm-kernelnext (mt8173, 4.19):
% ls /sys/devices/system/cpu/cpufreq
policy0  policy2

Aside from an error in syslog, this also results in a misreporting of
the CPU frequency in vmlog:
time pgmajfault pgmajfault_f pgmajfault_a pswpin pswpout cpuusage cpufreq0 cpufreq1
[0803/040506] 834 834 0 0 0 0.73 1001000 2106000

Note that 'cpufreq1' is actually cpufreq[23] since it reports policy2
which are the big cores.

Instead of accessing scaling_cur_freq directly from the cpufreq policy
directory, access scaling_cur_freq using the cpufreq symlink that is
created in each cpu directory.

BUG=b:161933388
TEST=Open vmlog and see cpufreq[0-3] on elm-kernelnext

Change-Id: I9f3327196b17539bf74a3395d6de013b79200a13
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/2334766
Reviewed-by: Ian Barkley-Yeung <iby@chromium.org>
Tested-by: Anand K Mistry <amistry@chromium.org>
Commit-Queue: Anand K Mistry <amistry@chromium.org>
diff --git a/metrics/vmlog_writer.cc b/metrics/vmlog_writer.cc
index 6b44831..60b0cd2 100644
--- a/metrics/vmlog_writer.cc
+++ b/metrics/vmlog_writer.cc
@@ -526,8 +526,7 @@
 
   for (auto cpu : *online_cpus) {
     std::ostringstream path;
-    path << "/sys/devices/system/cpu/cpufreq/policy" << cpu
-         << "/scaling_cur_freq";
+    path << "/sys/devices/system/cpu/cpu" << cpu << "/cpufreq/scaling_cur_freq";
     std::ifstream cpufreq_stream(path.str());
     if (cpufreq_stream) {
       cpufreq_streams_.push_back(std::move(cpufreq_stream));