Report CPU in integer milliseconds, makes it a bit easier to process.

This commit is contained in:
Oliver Jowett 2015-01-23 02:03:57 +00:00
parent df5e41363a
commit c07e45a4c8

View file

@ -876,6 +876,11 @@ static char * appendStatsJson(char *p,
p += snprintf(p, end-p, "},\"http_requests\":%u", st->http_requests);
}
{
uint64_t demod_cpu_millis = (uint64_t)st->demod_cpu.tv_sec*1000UL + st->demod_cpu.tv_nsec/1000000UL;
uint64_t reader_cpu_millis = (uint64_t)st->reader_cpu.tv_sec*1000UL + st->reader_cpu.tv_nsec/1000000UL;
uint64_t background_cpu_millis = (uint64_t)st->background_cpu.tv_sec*1000UL + st->background_cpu.tv_nsec/1000000UL;
p += snprintf(p, end-p,
",\"cpr\":{\"global_ok\":%u"
",\"global_bad\":%u"
@ -883,7 +888,7 @@ static char * appendStatsJson(char *p,
",\"local_ok\":%u"
",\"local_skipped\":%u"
",\"filtered\":%u}"
",\"cpu\":{\"demod\":%d.%09ld,\"reader\":%d.%09ld,\"background\":%d.%09ld}"
",\"cpu\":{\"demod\":%llu,\"reader\":%llu,\"background\":%llu}"
",\"messages\":%u}",
st->cpr_global_ok,
st->cpr_global_bad,
@ -891,9 +896,9 @@ static char * appendStatsJson(char *p,
st->cpr_local_ok,
st->cpr_local_skipped,
st->cpr_filtered,
(int)st->demod_cpu.tv_sec, (long)st->demod_cpu.tv_nsec,
(int)st->reader_cpu.tv_sec, (long)st->reader_cpu.tv_nsec,
(int)st->background_cpu.tv_sec, (long)st->background_cpu.tv_nsec,
(unsigned long long)demod_cpu_millis,
(unsigned long long)reader_cpu_millis,
(unsigned long long)background_cpu_millis,
st->messages_total);
return p;