Change in libosmocore[master]: add osmo_use_count API
gerrit-no-reply at lists.osmocom.org
Tue Mar 5 09:55:34 UTC 2019
Harald Welte has posted comments on this change. ( https://gerrit.osmocom.org/13121 )
Change subject: add osmo_use_count API
Patch Set 2:
I don't want to discourage you, but I cannot help if something less generic might be upt to the task. This quickly unfolds in tons of heap allocations and even more linear list traversals than I would normally like to see.
Wouldn't it also be an otpion to have a limited set (array) of 'entry' inside the use count itself? That way we can avoid dynamic allocations for every 'entry' and the linear list iterations on lookup. And since the use_counter and all of its entries are then one big structure, that one could actually be statically part of a larger object of the user, avoiding any heap allocations at all?
If you don't think it's possible to make a good fixed guess on the number of 'entries' (use counter buckets/classes is what I'd call them), then one could still make a compromise: use a  sized array at the end of the counter, and once you allocate the counter, you pass in the number of entries/classes/buckets that shall be allocated as part of the counter? That way we have dynamic number of entries at the expense of one heap allocation for the entire use_count?
PS2, Line 133: talloc_object
naming issue: this is basically just some opaque void * pointer, right? If nothing in the libosmocore use_count implementation actually treats this as 'talloc' object or context, then we should just call it 'priv', 'data', or 'user data'. Uers may then choose to store a talloc context or whatever else they may want to store.
PS2, Line 150: count
I think it's rather difficult to understand that a given "entry" or "token" can have multiple "counts". I understand that it's something that's handy in the context of osmo-msc and the "multiple CM service requests".
To view, visit https://gerrit.osmocom.org/13121
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-CC: Harald Welte <laforge at gnumonks.org>
Gerrit-Comment-Date: Tue, 05 Mar 2019 09:55:34 +0000
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the gerrit-log