Merge pull request #7294 from jeromecoutant/PR_GREENTEA_STAT

Add CPU stats for greentea tests
pull/7332/merge
Cruz Monrreal 2018-06-29 19:57:42 -05:00 committed by GitHub
commit f10bb88b97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 0 deletions

View File

@ -39,6 +39,10 @@ static char buf[128];
static SingletonPtr<CircularBuffer<thread_info_t, THREAD_BUF_COUNT> > queue;
#endif
#if defined(MBED_CPU_STATS_ENABLED)
static void send_CPU_info(void);
#endif
static void send_heap_info(void);
#if defined(MBED_STACK_STATS_ENABLED) && MBED_STACK_STATS_ENABLED
static void send_stack_info(void);
@ -65,8 +69,24 @@ void greentea_metrics_report()
send_stack_info();
Thread::attach_terminate_hook(NULL);
#endif
#if defined(MBED_CPU_STATS_ENABLED)
send_CPU_info();
#endif
}
#if defined(MBED_CPU_STATS_ENABLED)
static void send_CPU_info()
{
mbed_stats_cpu_t stats;
mbed_stats_cpu_get(&stats);
greentea_send_kv("__cpu_info up time", stats.uptime);
greentea_send_kv("__cpu_info sleep time", stats.sleep_time);
greentea_send_kv("__cpu_info deepsleep time", stats.deep_sleep_time);
greentea_send_kv("__cpu_info % sleep/deep", (stats.sleep_time * 100) / stats.uptime, (stats.deep_sleep_time * 100) / stats.uptime);
}
#endif
static void send_heap_info()
{
mbed_stats_heap_t heap_stats;