timer (simple periodic task) works now

parent 976f861a
......@@ -22,5 +22,11 @@ pub fn sys_get_time_ns() -> i64 {
);
}
(timestamp.tv_nsec as i64) + (1_000_000_000 * (timestamp.tv_sec as i64))
let res = (timestamp.tv_nsec as i64) + (1_000_000_000 * (timestamp.tv_sec as i64));
if cfg!(debug_assertions) {
debug!("sys_get_time_ns: {}", res);
}
res
}
#!/usr/bin/env bash
export MU_ZEBU=$PWD/../../../mu-impl-fast/
export ZEBU_BUILD=release
export ZEBU_BUILD=debug
export DYLD_LIBRARY_PATH=$PWD
export LD_LIBRARY_PATH=$MU_ZEBU/target/$ZEBU_BUILD/deps/:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$PWD/emit/:$LD_LIBRARY_PATH
......
......@@ -257,10 +257,9 @@ logger = AnsiLogger('rt_rpython_tests')
# assert False
@may_spawn_proc
def test_get_time():
def test_simple_timer():
from rpython.dev.dev_timer import test_simple_timer
logger.info('going to build the test function')
# exec_path = executable_from_rpy_func(test_gettime, [rffi.SIGNED, rffi.SIGNED], rffi.SIGNED)
exec_path = executable_from_rpy_func(test_simple_timer, [], rffi.SIGNED)
logger.info('going to run the test function')
......@@ -270,14 +269,19 @@ def test_get_time():
# subprocess.check_output([fn()])
import subprocess
import os
start = time.time()
res = subprocess.call('sudo LD_LIBRARY_PATH=$PWD/emit %s' % exec_path, shell=True)
res = subprocess.call(
'sudo LD_LIBRARY_PATH=$PWD/emit:$LD_LIBRARY_PATH MU_LOG_LEVEL=debug %s' % exec_path, shell=True)
end = time.time()
logger.info("Test took: ")
logger.info(end-start)
logger.info('returned result: %s' % res)
logger.info('returned res = %d' % res)
assert False
# assert False
assert 0 <= res <= 50
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment