procfs: cleanup /proc/idle format

This commit is contained in:
K. Lange 2021-09-05 14:16:15 +09:00
parent 3a08644de6
commit 42146f042c
2 changed files with 2 additions and 5 deletions

View File

@ -395,11 +395,8 @@ static void get_cpu_info(int cpus[]) {
char * buffer = buf;
for (int i = 0; i < cpu_count; ++i) {
char * a = strchr(buffer, ':');
a += 2;
char * b = strchr(a, ' ');
char * b = strchr(buffer, ':');
b++;
cpus[i] = 1000 - atoi(b);
if (cpus[i] < 0) cpus[i] = 0;
buffer = strchr(b, '\n');

View File

@ -653,7 +653,7 @@ static ssize_t idle_func(fs_node_t *node, off_t offset, size_t size, uint8_t *bu
unsigned int soffset = 0;
for (int i = 0; i < processor_count; ++i) {
soffset += snprintf(&buf[soffset], 100, "%d: %4d %4d %d %4d\n",
soffset += snprintf(&buf[soffset], 100, "%d: %4d %4d %4d %4d\n",
i,
processor_local_data[i].kernel_idle_task->usage[0],
processor_local_data[i].kernel_idle_task->usage[1],