diff options
author | Micael Karlberg <[email protected]> | 2019-06-19 15:49:29 +0200 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2019-06-27 18:35:26 +0200 |
commit | 0781183c6802e0993dd954a03ee4631b4270301c (patch) | |
tree | b94651b0db339858cacc868e313dd96f89394b03 /lib/snmp | |
parent | 7be6efd4ca4865c5be76dc35d880832ac02eda5b (diff) | |
download | otp-0781183c6802e0993dd954a03ee4631b4270301c.tar.gz otp-0781183c6802e0993dd954a03ee4631b4270301c.tar.bz2 otp-0781183c6802e0993dd954a03ee4631b4270301c.zip |
[snmp|agent|test] Try to figure out how "fast" a machine is
A very simple way to calculate how long the request timeout
shall be. Previously it was simply a constant (3.5 seconds).
We assume that the number of schedulers matters...
Diffstat (limited to 'lib/snmp')
-rw-r--r-- | lib/snmp/test/snmp_agent_test_lib.erl | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/snmp/test/snmp_agent_test_lib.erl b/lib/snmp/test/snmp_agent_test_lib.erl index 931616edf9..783bb3b4bf 100644 --- a/lib/snmp/test/snmp_agent_test_lib.erl +++ b/lib/snmp/test/snmp_agent_test_lib.erl @@ -984,10 +984,22 @@ expect2(Mod, Line, F) -> %% ---------------------------------------------------------------------- -get_timeout() -> - get_timeout(os:type()). +-define(BASE_REQ_TIMEOUT, 3500). -get_timeout(_) -> 3500. +get_timeout() -> + %% Try to figure out how "fast" a machine is. + %% We assume that the number of schedulers + %% (which depends on the number of core:s) + %% effect the performance of the host... + %% This is obviously not enough. The network + %% also matterns, clock freq or the CPU, ... + %% But its better than what we had before... + case erlang:system_info(schedulers) of + N when is_integer(N) -> + ?BASE_REQ_TIMEOUT + timer:seconds(10 div N); + _ -> + ?BASE_REQ_TIMEOUT + end. receive_pdu(To) -> receive |