jolly has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/35672?usp=email )
Change subject: Prevent poll() in select.c to timeout too early
......................................................................
Prevent poll() in select.c to timeout too early
Adjust osmo_timers_nearest_ms() to round up the remaining time.
Note that poll() has a granularity of 1 millisecond.
Previously, when rounding down the remaining time, osmo_select_main()
would return too early, before the nearest timer timed out.
Consequently, the main loop repeatedly called osmo_select_main() until
the timer actually timed out, resulting in excessive CPU usage.
By modifying osmo_timers_nearest_ms() to round up the remaining time,
we ensure accurate timeout calculations, preventing unnecessary CPU
consumption during the main loop.
Related: OS#6339
Change-Id: I79de77c79af4d50d1eb9ca0c5417123ff760dca3
---
M src/core/timer.c
1 file changed, 28 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/72/35672/1
diff --git a/src/core/timer.c b/src/core/timer.c
index 20d87a0..4229c5a 100644
--- a/src/core/timer.c
+++ b/src/core/timer.c
@@ -190,8 +190,13 @@
if (!nearest_p)
return -1;
+ /* By adding 999 milliseconds, we ensure rounding up to the nearest
+ * whole millisecond. This approach prevents the return of 0 when the
+ * timer is still active, and it guarantees that the calling process
+ * does not wait for a duration shorter than the time remaining on the
+ * timer. */
nearest_ms = nearest_p->tv_sec * 1000;
- nearest_ms += nearest_p->tv_usec / 1000;
+ nearest_ms += (nearest_p->tv_usec + 999) / 1000;
return nearest_ms;
}
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/35672?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I79de77c79af4d50d1eb9ca0c5417123ff760dca3
Gerrit-Change-Number: 35672
Gerrit-PatchSet: 1
Gerrit-Owner: jolly <andreas(a)eversberg.eu>
Gerrit-MessageType: newchange
Attention is currently required from: pespin.
fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/35653?usp=email )
Change subject: GSUP: Fix build of IEs in f_gen_tr_ies(), add PdpInfo(Compl) IEs to it
......................................................................
Patch Set 2: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/35653?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Iaad47b1ec7e2a7477fa554df9caeb866ffa594eb
Gerrit-Change-Number: 35653
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 24 Jan 2024 14:07:00 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/35652?usp=email )
Change subject: GSUP: Fix missing and wrongly sorted IEs in ts_GSUP_IE_PdpInfo
......................................................................
Patch Set 2:
(1 comment)
Patchset:
PS2:
> I don't think so. Proof of it is that TTCN3, erlang and libosmocore all used different orders. […]
Not sure about Erlang projects, but the current TTCN-3 implementation definitely requires specific ordering of TLVs; otherwise the templates won't match. We could change definition of `GSUP_IEs` as follows:
```
-type record of GSUP_IE GSUP_IEs;
+type set of GSUP_IE GSUP_IEs;
```
This would simplify things a bit.
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/35652?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I65e586187d7230f122644c101f8467becae6e204
Gerrit-Change-Number: 35652
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 24 Jan 2024 14:01:07 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: laforge <laforge(a)osmocom.org>
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: comment