antirez/redis — Issue #131: System/user CPU accounting in INFO is wrong
Author: dspezia
Created: 2011-10-10 12:11:53+00:00
State: open

I think there is a minor issue in the statistics returned by the INFO command:
the system and user CPU values are reversed (i.e. system CPU is put instead of user CPU
and vice versa).

In redis.c:

"used_cpu_sys:%.2f\r\n"
"used_cpu_user:%.2f\r\n"
"used_cpu_sys_children:%.2f\r\n"
"used_cpu_user_children:%.2f\r\n"
...
(float)self_ru.ru_utime.tv_sec+(float)self_ru.ru_utime.tv_usec/1000000,
(float)self_ru.ru_stime.tv_sec+(float)self_ru.ru_stime.tv_usec/1000000,
(float)c_ru.ru_utime.tv_sec+(float)c_ru.ru_utime.tv_usec/1000000,
(float)c_ru.ru_stime.tv_sec+(float)c_ru.ru_stime.tv_usec/1000000,

Suggested fix:
just reorder the rusage values, so that the order of the returned fields is kept as it is today
(but with their correct values).

Regards,
Didier.