Support reference timestamp
An issue due to timing happens when applying scenarios on applications. The first event is directly treated, even if the recorder waited a few seconds without any action. The reason is that Exactness saves in the .rec file a timestamp that is the uptime value, i.e an absolute value. A better choice would have been to save the number of ms relative to the launch of the application. Because of this, Exactness doesnt have any way to know when the first event has to be treated and consumes it whenever possible, i.e at the beginning. This patch adds to the recording file a timestamp reference, corresponding to the uptime at ecore_init. When applying the scenario, this timestamp is checked and gives an idea of a delay to wait before consuming the first event.
This commit is contained in:
parent
b5900b27af
commit
4effc37ab0
|
@ -8,6 +8,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/sysinfo.h>
|
||||
#include <dlfcn.h>
|
||||
#include "tsuite_file_data.h"
|
||||
#include "exactness_private.h"
|
||||
|
@ -152,7 +153,15 @@ tsuite_evas_hook_init(void)
|
|||
if (!shot_key) shot_key = SHOT_KEY_STR;
|
||||
|
||||
if (!vr_list)
|
||||
{
|
||||
struct sysinfo s_info;
|
||||
sysinfo(&s_info);
|
||||
vr_list = calloc(1, sizeof(*vr_list));
|
||||
vr_list->first_timestamp = s_info.uptime * 1000;
|
||||
#ifdef DEBUG_TSUITE
|
||||
printf("Uptime=<%u>\n", vr_list->first_timestamp);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
EAPI void
|
||||
|
@ -612,16 +621,38 @@ ecore_main_loop_begin(void)
|
|||
|
||||
if (!_hook_setting->recording && _hook_setting->file_name)
|
||||
{
|
||||
double diff_time = 0; /* Time to wait before feeding the first event */
|
||||
ts.td = calloc(1, sizeof(Timer_Data));
|
||||
#ifdef DEBUG_TSUITE
|
||||
printf("<%s> rec file is <%s>\n", __func__, _hook_setting->file_name);
|
||||
#endif
|
||||
vr_list = read_events(_hook_setting->file_name, ts.td);
|
||||
if (ts.td->current_event)
|
||||
{ /* Got first event in list, run test */
|
||||
{
|
||||
/* Got first event in list, run test */
|
||||
|
||||
/* Calculate the time to wait before feeding the first event */
|
||||
unsigned int current_event_time = evt_time_get(0, eina_list_data_get(ts.td->current_event));
|
||||
if (current_event_time > vr_list->first_timestamp)
|
||||
diff_time = (current_event_time - vr_list->first_timestamp) / 1000.0;
|
||||
|
||||
#ifdef DEBUG_TSUITE
|
||||
printf("%s first_time_stamp=<%u> current_event_time=<%u>\n", __func__, vr_list->first_timestamp, current_event_time);
|
||||
#endif
|
||||
|
||||
if (diff_time)
|
||||
{
|
||||
#ifdef DEBUG_TSUITE
|
||||
printf(" Waiting <%f>\n", diff_time);
|
||||
#endif
|
||||
ecore_timer_add(diff_time, tsuite_feed_event, ts.td);
|
||||
}
|
||||
else
|
||||
{
|
||||
tsuite_feed_event(ts.td);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return _ecore_main_loop_begin();
|
||||
}
|
||||
|
|
|
@ -803,6 +803,8 @@ data_desc *_data_descriptors_init(void)
|
|||
EET_DATA_DESCRIPTOR_ADD_VARIANT(desc->_variant_descriptor,
|
||||
Variant_st, "data", data, t, desc->_variant_unified_descriptor);
|
||||
|
||||
EET_DATA_DESCRIPTOR_ADD_BASIC(desc->_lists_descriptor,
|
||||
Lists_st, "first_timestamp", first_timestamp, EET_T_UINT);
|
||||
EET_DATA_DESCRIPTOR_ADD_LIST(desc->_lists_descriptor,
|
||||
Lists_st, "variant_list", variant_list, desc->_variant_descriptor);
|
||||
|
||||
|
|
|
@ -177,6 +177,7 @@ typedef struct _mouse_in_mouse_out take_screenshot;
|
|||
struct _Lists_st
|
||||
{
|
||||
Eina_List *variant_list;
|
||||
unsigned int first_timestamp;
|
||||
};
|
||||
typedef struct _Lists_st Lists_st;
|
||||
|
||||
|
|
Loading…
Reference in New Issue