zephyr/subsys/net/lib
Nicolas Pitre bd3ed97230 subsys/net: zperf_udp_uploader: Remove sys_clock_timeout_end_calc() usage
The initial goal was to remove sys_clock_timeout_end_calc(). However,
several related issues have been fixed as well.

First this:

    int64_t print_interval = sys_clock_timeout_end_calc(K_SECONDS(1));
    /* Print log every seconds */
    int64_t print_info = print_interval - k_uptime_ticks();

    if (print_info <= 0) {
        [...]
    }

The above condition will simply never be true.

Then there is lots of back-and-forth time conversions using expensive
base-10 divisions for each loop iterations which is likely to impact
performance.

Let's do the time conversion only once outside the loop and track
everything in terms of ticks within the loop. Also the various timeouts
are open-coded based on the absolute uptime tick so to sample it only
once per round. Using sys_timepoint_calc() and sys_timepoint_timeout()
would have introduced additional uptime tick sampling which implies the
overhead of a downstream lock each time for no gain. For those reasons,
open coding those timeouts bears more benefits in this particular case
compared to using the timepoint API.

Then this:

    secs = k_ticks_to_ms_ceil32(loop_time) / 1000U;
    usecs = k_ticks_to_us_ceil32(loop_time) - secs * USEC_PER_SEC;

The above should round down not up to work accurately. And the usecs
value will become garbage past 1.2 hour of runtime due to overflows.

And no need to clamp the wait period which is on the microsec scale
using the total duration argument being on the millisec scale. That's
yet more loop overhead that can be omitted. The actual duration is
recorded at the end anyway.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2023-07-25 09:12:26 +02:00
..
capture
coap net: lib: coap: CoAP client, multiple request handling 2023-06-28 15:19:34 +02:00
config net: config: Add VLAN identifier as network initial configuration 2023-06-21 09:32:41 +02:00
dns net: dns_sd: Prevent dead code in query parsing 2023-06-03 04:13:46 -04:00
http net: http: define http service and resource iterable sections 2023-03-08 13:57:13 +00:00
lwm2m net: lwm2m: Update next event timestamp on PMAX change 2023-07-05 11:16:06 +02:00
mqtt net: mqtt: close tcp socket after websocket_disconnect 2023-06-19 09:18:45 +01:00
mqtt_sn net: mqtt-sn: fix port in mqtt-sn debug message 2023-06-06 09:40:52 -04:00
sntp net: sntp: support building without NET_SOCKETS_POSIX_NAMES 2023-04-24 09:23:17 -04:00
sockets subsys/net/lib/socket: move to timepoint API 2023-07-25 09:12:26 +02:00
socks
tftp net: tftp: Add client context 2023-02-28 10:29:30 +01:00
tls_credentials net: lib: tls_credentials: earlier initialisation 2023-07-12 14:50:09 +02:00
utils net: sntp: support building without NET_SOCKETS_POSIX_NAMES 2023-04-24 09:23:17 -04:00
websocket subsys/net/lib/socket: move to timepoint API 2023-07-25 09:12:26 +02:00
zperf subsys/net: zperf_udp_uploader: Remove sys_clock_timeout_end_calc() usage 2023-07-25 09:12:26 +02:00
CMakeLists.txt net: conn_mgr: Reorganize files 2023-05-11 12:15:44 +02:00
Kconfig net: conn_mgr: Reorganize files 2023-05-11 12:15:44 +02:00