<p style="white-space: pre-wrap; word-wrap: break-word;">{ struct timespec last; struct timer_list timer; }</p><p style="white-space: pre-wrap; word-wrap: break-word;">1- Last channel is allocated:</p><ul><li>clock_gettime(last); timer_schedule(cb_func);</li></ul><p style="white-space: pre-wrap; word-wrap: break-word;">2- cb_func triggers:</p><ul><li>clock_gettime(now), osmo_stat_item_add(st, now - last); last = now; timer_schedule(cb_func);</li></ul><p style="white-space: pre-wrap; word-wrap: break-word;">3- A channel is freed:</p><ul><li>if (time_is_pending(timer)) { clock_gettime(now), osmo_stat_item_add(st, now - last); timer_stop(timer); }</li></ul><p style="white-space: pre-wrap; word-wrap: break-word;">"counting" is not even needed, the timer_is_pending() is enough to see if it is counting or not. Is there a problem with this approach? AFAIU this would track time even if its under granularity of the timer.</p><p><a href="https://gerrit.osmocom.org/c/osmo-bsc/+/25973">View Change</a></p><ul style="list-style: none; padding: 0;"></ul><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-bsc/+/25973">change 25973</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/osmo-bsc/+/25973"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: osmo-bsc </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Icdd36f27cb54b2e1b940c9e6404ba9dd3692a310 </div>
<div style="display:none"> Gerrit-Change-Number: 25973 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: neels <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-CC: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-CC: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-Comment-Date: Tue, 02 Nov 2021 16:45:21 +0000 </div>
<div style="display:none"> Gerrit-HasComments: No </div>
<div style="display:none"> Gerrit-Has-Labels: No </div>
<div style="display:none"> Gerrit-MessageType: comment </div>