kern_tc.c (4f8cb019ea42f36fd35519ec98f1446d10593094) kern_tc.c (e7fa55af89be8c37ee53245d7a18070ae56326b2)
1/*-
2 * ----------------------------------------------------------------------------
3 * "THE BEER-WARE LICENSE" (Revision 42):
4 * <phk@FreeBSD.ORG> wrote this file. As long as you retain this notice you
5 * can do whatever you want with this stuff. If we meet some day, and you think
6 * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
7 * ----------------------------------------------------------------------------
8 *

--- 633 unchanged lines hidden (view full) ---

642 * counter from overflowing. Updating also recalculates the cached values
643 * used by the get*() family of functions, so their precision depends on
644 * the update frequency.
645 */
646
647static int tc_tick;
648SYSCTL_INT(_kern_timecounter, OID_AUTO, tick, CTLFLAG_RD, &tick, 0, "");
649
1/*-
2 * ----------------------------------------------------------------------------
3 * "THE BEER-WARE LICENSE" (Revision 42):
4 * <phk@FreeBSD.ORG> wrote this file. As long as you retain this notice you
5 * can do whatever you want with this stuff. If we meet some day, and you think
6 * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
7 * ----------------------------------------------------------------------------
8 *

--- 633 unchanged lines hidden (view full) ---

642 * counter from overflowing. Updating also recalculates the cached values
643 * used by the get*() family of functions, so their precision depends on
644 * the update frequency.
645 */
646
647static int tc_tick;
648SYSCTL_INT(_kern_timecounter, OID_AUTO, tick, CTLFLAG_RD, &tick, 0, "");
649
650static void
651tc_ticktock(void *dummy)
650void
651tc_ticktock(void)
652{
652{
653 static int count;
653
654
655 if (++count < tc_tick)
656 return;
657 count = 0;
654 tc_windup();
658 tc_windup();
655 timeout(tc_ticktock, NULL, tc_tick);
656}
657
658static void
659inittimecounter(void *dummy)
660{
661 u_int p;
662
663 /*

--- 9 unchanged lines hidden (view full) ---

673 else
674 tc_tick = 1;
675 p = (tc_tick * 1000000) / hz;
676 printf("Timecounters tick every %d.%03u msec\n", p / 1000, p % 1000);
677
678 /* warm up new timecounter (again) and get rolling. */
679 (void)timecounter->tc_get_timecount(timecounter);
680 (void)timecounter->tc_get_timecount(timecounter);
659}
660
661static void
662inittimecounter(void *dummy)
663{
664 u_int p;
665
666 /*

--- 9 unchanged lines hidden (view full) ---

676 else
677 tc_tick = 1;
678 p = (tc_tick * 1000000) / hz;
679 printf("Timecounters tick every %d.%03u msec\n", p / 1000, p % 1000);
680
681 /* warm up new timecounter (again) and get rolling. */
682 (void)timecounter->tc_get_timecount(timecounter);
683 (void)timecounter->tc_get_timecount(timecounter);
681 tc_ticktock(NULL);
682}
683
684SYSINIT(timecounter, SI_SUB_CLOCKS, SI_ORDER_FIRST, inittimecounter, NULL)
684}
685
686SYSINIT(timecounter, SI_SUB_CLOCKS, SI_ORDER_FIRST, inittimecounter, NULL)