API explosion (Re: [RFC/RFT] calloutng)
Alexander Motin
mav at FreeBSD.org
Mon Dec 17 21:03:59 UTC 2012
Hi.
> I would instead do the following:
I also don't very like the wide API and want to hear fresh ideas, but
approaches to time measurement there are too different to do what you
are proposing. Main problem is that while ticks value is relative,
bintime is absolute. It is not easy to make conversion between them fast
and precise. I've managed to do it, but the only function that does it
now is _callout_reset_on(). All other functions are just passing values
down. I am not sure I want to duplicate that code in each place, though
doing it at least for for callout may be a good idea.
Creating sets of three functions I had three different goals:
- callout_reset() -- it is legacy variant required to keep API
compatibility;
- callout_reset_flags() -- it is for cases where custom precision
specification needs to be added to the existing code, or where direct
callout execution is needed. Conversion to bintime would additionally
complicate consumer code, that I would try to avoid.
- callout_reset_bt() -- API for the new code, which needs high
precision and doesn't mind to operate bintime. Now there is only three
such places in kernel now, and I don't think there will be much more.
Respectively, these three options are replicated to other APIs where
time intervals are used.
PS: Please keep me in CC.
--
Alexander Motin
More information about the freebsd-current
mailing list