Lines Matching defs:timecounter
42 * https://papers.freebsd.org/2002/phk-timecounters.files/timecounter.pdf
79 * Implement a dummy timecounter which we can use until we get a real one
85 dummy_get_timecount(struct timecounter *tc)
92 static struct timecounter dummy_timecounter = {
103 struct timecounter *th_counter; /* active timecounter */
137 struct timecounter *timecounter = &dummy_timecounter;
138 static struct timecounter *timecounters = &dummy_timecounter;
278 struct timecounter *newtc, *tc;
280 tc = timecounter;
306 /* Warm up new timecounter. */
309 timecounter = newtc;
324 struct timecounter *tc;
368 SYSCTL_SETUP(sysctl_timecounter_setup, "sysctl timecounter setup")
374 CTLTYPE_NODE, "timecounter",
406 EVCNT_INITIALIZER(EVCNT_TYPE_MISC, NULL, "timecounter", #name); \
428 struct timecounter *tc;
453 * We record the number of timecounter removals before accessing
454 * timecounter state. Note that the LWP can be using multiple
703 * Initialize a new timecounter and possibly use it.
706 tc_init(struct timecounter *tc)
710 KASSERTMSG(tc->tc_next == NULL, "timecounter %s already initialised",
720 "timecounter: Timecounter \"%s\" frequency %ju Hz",
725 "timecounter: Timecounter \"%s\" frequency %ju Hz "
735 * Never automatically use a timecounter with negative quality.
737 * worse since this timecounter may not be monotonous.
739 if (tc->tc_quality >= 0 && (tc->tc_quality > timecounter->tc_quality ||
740 (tc->tc_quality == timecounter->tc_quality &&
741 tc->tc_frequency > timecounter->tc_frequency))) {
744 timecounter = tc;
751 * Pick a new timecounter due to the existing counter going bad.
756 struct timecounter *best, *tc;
770 timecounter = best;
774 * A timecounter has gone bad, arrange to pick a new one at the next
778 tc_gonebad(struct timecounter *tc)
787 * Stop using a timecounter and remove it from the timecounters list.
790 tc_detach(struct timecounter *target)
792 struct timecounter *tc;
793 struct timecounter **tcp = NULL;
797 /* First, find the timecounter. */
812 if (timecounter == target) {
822 * making use of this timecounter.
825 * then scan all LWPs in the system looking at each's timecounter
827 * using a timecounter) or a value greater than our removal value.
832 * accessing timecounter state. All we do need is one clean
834 * old timecounter state.
843 * Not using timecounter or old timecounter
853 * If the timecounter is still in use, wait at least 10ms
866 /* Report the frequency of the current timecounter. */
910 * timecounter and/or do seconds processing in NTP. Slightly magic.
940 * Capture a timecounter delta on the current timecounter and if
941 * changing timecounters, a counter value from the new timecounter.
945 if (th->th_counter != timecounter)
946 ncount = timecounter->tc_get_timecount(timecounter);
997 if (th->th_counter != timecounter) {
998 th->th_counter = timecounter;
1226 /* If the timecounter was wound up underneath us, bail out. */
1308 * If the timecounter changed, we cannot compare the count values, so
1363 /* If the timecounter was wound up underneath us, bail out. */
1504 /* An existing timecounter has gone bad, pick a new one. */
1506 if (timecounter->tc_quality < 0) {
1534 aprint_verbose("timecounter: Timecounters tick every %d.%03u msec\n",
1537 /* warm up new timecounter (again) and get rolling. */
1538 (void)timecounter->tc_get_timecount(timecounter);
1539 (void)timecounter->tc_get_timecount(timecounter);