- return (pscanf("/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq",
- "%i", &freq) == 1) ?
- bprintf("%d", (freq + 500) / 1000) : NULL;
- }
-
- const char *
- cpu_perc(void)
- {
- int perc;
- static long double a[7];
- static int valid;
- long double b[7];
-
- memcpy(b, a, sizeof(b));
- if (pscanf("/proc/stat", "%*s %Lf %Lf %Lf %Lf %Lf %Lf %Lf",
- &a[0], &a[1], &a[2], &a[3], &a[4], &a[5], &a[6]) != 7) {
- return NULL;
- }
- if (!valid) {
- valid = 1;
+ /* in kHz */
+ if (pscanf("/sys/devices/system/cpu/cpu0/cpufreq/"
+ "scaling_cur_freq", "%ju", &freq) != 1) {