test/timeout: configurable fast-polling buffers

On some platforms (foc+pbxa9, hw+imx53_qsb_tz, hw+rpi) the default buffer size
is to much for the RAM available on the board. Thus, decrease the buffer size
and therefore the number of polls for these platforms only.

Fixes #3354
This commit is contained in:
Martin Stein 2019-05-15 16:17:20 +02:00 committed by Christian Helmuth
parent 8af81668ea
commit 8eecb39792
2 changed files with 26 additions and 10 deletions

View File

@ -2,6 +2,17 @@
# Build
#
#
# The size of the result buffers in the fast-time-polling test
#
proc fast_polling_buf_size { } {
if {[expr [have_spec pbxa9] && [have_spec foc]]} { return 40000000 }
if {[expr [have_spec imx53_qsb_tz] && [have_spec hw]]} { return 40000000 }
if {[expr [have_spec rpi] && [have_spec hw]]} { return 40000000 }
return 80000000
}
#
# Wether the platform allows for timeouts that trigger with a precision < 50 milliseconds
#
@ -99,7 +110,8 @@ append config {
<resource name="RAM" quantum="250M"/>
<config precise_time="} [precise_time] {"
precise_ref_time="} [precise_ref_time] {"
precise_timeouts="} [precise_timeouts] {"/>
precise_timeouts="} [precise_timeouts] {"
fast_polling_buf_size="} [fast_polling_buf_size] {"/>
</start>
</config>
}

View File

@ -389,7 +389,6 @@ struct Fast_polling : Test
enum { NR_OF_ROUNDS = 4 };
enum { MIN_ROUND_DURATION_MS = 2500 };
enum { MAX_NR_OF_POLLS = 10000000 };
enum { MIN_NR_OF_POLLS = 1000 };
enum { STACK_SIZE = 4 * 1024 * sizeof(addr_t) };
enum { MIN_TIME_COMPARISONS = 100 };
@ -397,15 +396,17 @@ struct Fast_polling : Test
enum { MAX_DELAY_ERR_US = 2000 };
enum { MAX_AVG_DELAY_ERR_US = 20 };
enum { MAX_POLL_LATENCY_US = 1000 };
enum { BUF_SIZE = MAX_NR_OF_POLLS * sizeof(uint64_t) };
struct Result_buffer
{
Env &env;
Attached_ram_dataspace ram { env.ram(), env.rm(), BUF_SIZE };
Attached_ram_dataspace ram;
uint64_t volatile *value { ram.local_addr<uint64_t>() };
Result_buffer(Env &env) : env(env) { }
Result_buffer(Env &env,
size_t size)
:
ram { env.ram(), env.rm(), size }
{ }
private:
@ -426,9 +427,12 @@ struct Fast_polling : Test
uint64_t const timer_diff_us { timer_2_delayed ?
timer_2_us - timer_us :
timer_us - timer_2_us };
Result_buffer local_us_1_buf { env };
Result_buffer local_us_2_buf { env };
Result_buffer remote_us_buf { env };
size_t const buf_size { config.xml().attribute_value("fast_polling_buf_size", (size_t)80000000) };
size_t const max_nr_of_polls { buf_size / sizeof(uint64_t) };
Result_buffer local_us_1_buf { env, buf_size };
Result_buffer local_us_2_buf { env, buf_size };
Result_buffer remote_us_buf { env, buf_size };
uint64_t max_avg_time_err_us { config.xml().attribute_value("precise_ref_time", true) ?
(uint64_t)1000 : (uint64_t)2000 };
@ -542,7 +546,7 @@ struct Fast_polling : Test
unsigned long volatile delay_loops = 0;
unsigned long nr_of_polls = MAX_NR_OF_POLLS;
unsigned long nr_of_polls = max_nr_of_polls;
unsigned long delay_loops_per_poll_ = delay_loops_per_poll[round];
uint64_t end_remote_us = timer_2.elapsed_us() +
MIN_ROUND_DURATION_MS * 1000;