Exection time monitor added (printf the result)

This commit is contained in:
Kiss-Vamosi Gabor
2017-06-17 09:08:54 +02:00
parent a13259d3f9
commit 95b6a2193f

View File

@@ -16,7 +16,11 @@
/********************* /*********************
* DEFINES * DEFINES
*********************/ *********************/
#define MONITOR_EXEC_TIME 1
#if MONITOR_EXEC_TIME != 0
#include <time.h>
#include <stdio.h>
#endif
/********************** /**********************
* TYPEDEFS * TYPEDEFS
**********************/ **********************/
@@ -187,7 +191,11 @@ static void lv_refr_join_area(void)
static void lv_refr_areas(void) static void lv_refr_areas(void)
{ {
uint32_t i; uint32_t i;
#if MONITOR_EXEC_TIME != 0
clock_t start = clock();
#endif
for(i = 0; i < inv_buf_p; i++) { for(i = 0; i < inv_buf_p; i++) {
/*Refresh the unjoined areas*/ /*Refresh the unjoined areas*/
if(inv_buf[i].joined == 0) { if(inv_buf[i].joined == 0) {
@@ -198,9 +206,16 @@ static void lv_refr_areas(void)
/*If VDB is used...*/ /*If VDB is used...*/
lv_refr_area_with_vdb(&inv_buf[i].area); lv_refr_area_with_vdb(&inv_buf[i].area);
#endif #endif
} }
} }
#if MONITOR_EXEC_TIME != 0
if(inv_buf_p != 0) {
clock_t end = clock();
float time_spent = (float)(end - start) / CLOCKS_PER_SEC;
printf("Exec time: %08f ms\n", (float)time_spent * 1000);
}
#endif
} }
#if LV_VDB_SIZE == 0 #if LV_VDB_SIZE == 0