mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-28 10:45:22 +00:00
Revert "Revert "Scale timer for emulator""
This reverts commit c58c01b14c.
Let's add time scaling back, but keep the default scale to 1. The
emulator behavior should be entirely the same. If a test need to be
speeded up, the scale can then be set for that test only.
BUG=chrome-os-partner:19235
TEST=Pass all tests.
BRANCH=None
Change-Id: I648780577a1ae2f964c30c71077ccf9bf38b9735
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/51550
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This commit is contained in:
@@ -28,7 +28,8 @@ CFLAGS_DEBUG= -g
|
||||
CFLAGS_INCLUDE=$(foreach i,$(includes),-I$(i) )
|
||||
CFLAGS_TEST=$(if $(TEST_BUILD),-DTEST_BUILD \
|
||||
-DTEST_TASKFILE=$(PROJECT).tasklist,) \
|
||||
$(if $(EMU_BUILD),-DEMU_BUILD)
|
||||
$(if $(EMU_BUILD),-DEMU_BUILD) \
|
||||
$(if $($(PROJECT)-scale),-DTEST_TIME_SCALE=$($(PROJECT)-scale))
|
||||
CFLAGS_DEFINE=-DOUTDIR=$(out) -DCHIP=$(CHIP) -DBOARD_TASKFILE=ec.tasklist \
|
||||
-DBOARD=$(BOARD) -DBOARD_$(BOARD) -DCORE=$(CORE) \
|
||||
-DCHIP_$(CHIP) -DCHIP_VARIANT=$(CHIP_VARIANT) \
|
||||
|
||||
@@ -12,6 +12,15 @@
|
||||
#include "task.h"
|
||||
#include "timer.h"
|
||||
|
||||
/*
|
||||
* For test that need to test for longer than 10 seconds, adjust
|
||||
* its time scale in test/build.mk by specifying
|
||||
* <test_name>-scale=<new scale>.
|
||||
*/
|
||||
#ifndef TEST_TIME_SCALE
|
||||
#define TEST_TIME_SCALE 1
|
||||
#endif
|
||||
|
||||
static timestamp_t boot_time;
|
||||
|
||||
void usleep(unsigned us)
|
||||
@@ -24,7 +33,8 @@ timestamp_t _get_time(void)
|
||||
struct timespec ts;
|
||||
timestamp_t ret;
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
ret.val = 1000000 * (uint64_t)ts.tv_sec + ts.tv_nsec / 1000;
|
||||
ret.val = (1000000000 * (uint64_t)ts.tv_sec + ts.tv_nsec) *
|
||||
TEST_TIME_SCALE / 1000;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user