\hypertarget{kern__tc_8c_source}{}\doxysection{kern\+\_\+tc.\+c}
\label{kern__tc_8c_source}\index{kern/kern\_tc.c@{kern/kern\_tc.c}}
\mbox{\hyperlink{kern__tc_8c}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00001}00001 \textcolor{comment}{/*-\/}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00002}00002 \textcolor{comment}{ * SPDX-\/License-\/Identifier: Beerware}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00003}00003 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00004}00004 \textcolor{comment}{ * -\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00005}00005 \textcolor{comment}{ * "{}THE BEER-\/WARE LICENSE"{} (Revision 42):}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00006}00006 \textcolor{comment}{ * <phk@FreeBSD.ORG> wrote this file.  As long as you retain this notice you}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00007}00007 \textcolor{comment}{ * can do whatever you want with this stuff. If we meet some day, and you think}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00008}00008 \textcolor{comment}{ * this stuff is worth it, you can buy me a beer in return.   Poul-\/Henning Kamp}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00009}00009 \textcolor{comment}{ * -\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00010}00010 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00011}00011 \textcolor{comment}{ * Copyright (c) 2011, 2015, 2016 The FreeBSD Foundation}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00012}00012 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00013}00013 \textcolor{comment}{ * Portions of this software were developed by Julien Ridoux at the University}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00014}00014 \textcolor{comment}{ * of Melbourne under sponsorship from the FreeBSD Foundation.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00015}00015 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00016}00016 \textcolor{comment}{ * Portions of this software were developed by Konstantin Belousov}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00017}00017 \textcolor{comment}{ * under sponsorship from the FreeBSD Foundation.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00018}00018 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00019}00019 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00020}00020 \textcolor{preprocessor}{\#include <sys/cdefs.h>}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00021}\mbox{\hyperlink{kern__tc_8c_a8c3ef283470a68cd30afe9b8a72cb60f}{00021}} \mbox{\hyperlink{kern__tc_8c_a8c3ef283470a68cd30afe9b8a72cb60f}{\_\_FBSDID}}(\textcolor{stringliteral}{"{}\$FreeBSD\$"{}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00022}00022 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00023}00023 \textcolor{preprocessor}{\#include "{}opt\_ntp.h"{}}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00024}00024 \textcolor{preprocessor}{\#include "{}opt\_ffclock.h"{}}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00025}00025 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00026}00026 \textcolor{preprocessor}{\#include <sys/param.h>}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00027}00027 \textcolor{preprocessor}{\#include <sys/kernel.h>}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00028}00028 \textcolor{preprocessor}{\#include <sys/limits.h>}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00029}00029 \textcolor{preprocessor}{\#include <sys/lock.h>}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00030}00030 \textcolor{preprocessor}{\#include <sys/mutex.h>}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00031}00031 \textcolor{preprocessor}{\#include <sys/proc.h>}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00032}00032 \textcolor{preprocessor}{\#include <sys/sbuf.h>}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00033}00033 \textcolor{preprocessor}{\#include <sys/sleepqueue.h>}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00034}00034 \textcolor{preprocessor}{\#include <sys/sysctl.h>}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00035}00035 \textcolor{preprocessor}{\#include <sys/syslog.h>}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00036}00036 \textcolor{preprocessor}{\#include <sys/systm.h>}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00037}00037 \textcolor{preprocessor}{\#include <sys/timeffc.h>}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00038}00038 \textcolor{preprocessor}{\#include <sys/timepps.h>}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00039}00039 \textcolor{preprocessor}{\#include <sys/timetc.h>}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00040}00040 \textcolor{preprocessor}{\#include <sys/timex.h>}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00041}00041 \textcolor{preprocessor}{\#include <sys/vdso.h>}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00042}00042 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00043}00043 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00044}00044 \textcolor{comment}{ * A large step happens on boot.  This constant detects such steps.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00045}00045 \textcolor{comment}{ * It is relatively small so that ntp\_update\_second gets called enough}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00046}00046 \textcolor{comment}{ * in the typical 'missed a couple of seconds' case, but doesn't loop}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00047}00047 \textcolor{comment}{ * forever when the time step is large.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00048}00048 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00049}\mbox{\hyperlink{kern__tc_8c_aeb15779f518ed87371f3a0aed6ca2f55}{00049}} \textcolor{preprocessor}{\#define LARGE\_STEP      200}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00050}00050 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00051}00051 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00052}00052 \textcolor{comment}{ * Implement a dummy timecounter which we can use until we get a real one}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00053}00053 \textcolor{comment}{ * in the air.  This allows the console and other early stuff to use}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00054}00054 \textcolor{comment}{ * time services.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00055}00055 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00056}00056 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00057}00057 \textcolor{keyword}{static} u\_int}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00058}\mbox{\hyperlink{kern__tc_8c_aa4a4a18857a9dd1830386978fae89b8d}{00058}} \mbox{\hyperlink{kern__tc_8c_aa4a4a18857a9dd1830386978fae89b8d}{dummy\_get\_timecount}}(\textcolor{keyword}{struct} \mbox{\hyperlink{kern__tc_8c_a35098fc91b751950a191213b1c2e5853}{timecounter}} *tc)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00059}00059 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00060}00060         \textcolor{keyword}{static} u\_int now;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00061}00061 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00062}00062         \textcolor{keywordflow}{return} (++now);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00063}00063 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00064}00064 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00065}\mbox{\hyperlink{kern__tc_8c_a0545acbb4697b4a0a44447c1c50efc82}{00065}} \textcolor{keyword}{static} \textcolor{keyword}{struct }\mbox{\hyperlink{kern__tc_8c_a35098fc91b751950a191213b1c2e5853}{timecounter}} \mbox{\hyperlink{kern__tc_8c_a0545acbb4697b4a0a44447c1c50efc82}{dummy\_timecounter}} = \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00066}00066         \mbox{\hyperlink{kern__tc_8c_aa4a4a18857a9dd1830386978fae89b8d}{dummy\_get\_timecount}}, 0, \string~0u, 1000000, \textcolor{stringliteral}{"{}dummy"{}}, -\/1000000}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00067}00067 \};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00068}00068 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00069}\mbox{\hyperlink{structtimehands}{00069}} \textcolor{keyword}{struct }\mbox{\hyperlink{structtimehands}{timehands}} \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00070}00070         \textcolor{comment}{/* These fields must be initialized by the driver. */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00071}\mbox{\hyperlink{structtimehands_a6e873b4aa6fa46eaad2c2b7199ed7555}{00071}}         \textcolor{keyword}{struct }\mbox{\hyperlink{kern__tc_8c_a35098fc91b751950a191213b1c2e5853}{timecounter}}   *\mbox{\hyperlink{structtimehands_a6e873b4aa6fa46eaad2c2b7199ed7555}{th\_counter}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00072}\mbox{\hyperlink{structtimehands_a8b85c0a8aa3f90feba9d4bc9cbe741b6}{00072}}         int64\_t                 \mbox{\hyperlink{structtimehands_a8b85c0a8aa3f90feba9d4bc9cbe741b6}{th\_adjustment}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00073}\mbox{\hyperlink{structtimehands_a4b079bb7849db9a6ea3abf069ad8905a}{00073}}         uint64\_t                \mbox{\hyperlink{structtimehands_a4b079bb7849db9a6ea3abf069ad8905a}{th\_scale}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00074}\mbox{\hyperlink{structtimehands_adbe021df320b1201345510bccee7bde5}{00074}}         u\_int                   \mbox{\hyperlink{structtimehands_adbe021df320b1201345510bccee7bde5}{th\_large\_delta}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00075}\mbox{\hyperlink{structtimehands_a6ef254e39c5e63cae43e7952a423064d}{00075}}         u\_int                   \mbox{\hyperlink{structtimehands_a6ef254e39c5e63cae43e7952a423064d}{th\_offset\_count}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00076}\mbox{\hyperlink{structtimehands_a8343df3d16d957ac6054336b6304d494}{00076}}         \textcolor{keyword}{struct }\mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}}           \mbox{\hyperlink{structtimehands_a8343df3d16d957ac6054336b6304d494}{th\_offset}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00077}\mbox{\hyperlink{structtimehands_a3bc3499b05913be14bf2968e7fe6ce21}{00077}}         \textcolor{keyword}{struct }\mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}}           \mbox{\hyperlink{structtimehands_a3bc3499b05913be14bf2968e7fe6ce21}{th\_bintime}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00078}\mbox{\hyperlink{structtimehands_a903e7fb963b8feed7a67c05a15cf9bfc}{00078}}         \textcolor{keyword}{struct }timeval          \mbox{\hyperlink{structtimehands_a903e7fb963b8feed7a67c05a15cf9bfc}{th\_microtime}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00079}\mbox{\hyperlink{structtimehands_a194617542b2cba6072b118b6168cff6e}{00079}}         \textcolor{keyword}{struct }timespec         \mbox{\hyperlink{structtimehands_a194617542b2cba6072b118b6168cff6e}{th\_nanotime}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00080}\mbox{\hyperlink{structtimehands_af3aa7f25829422014014889ad4ad9d5d}{00080}}         \textcolor{keyword}{struct }\mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}}           \mbox{\hyperlink{structtimehands_af3aa7f25829422014014889ad4ad9d5d}{th\_boottime}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00081}00081         \textcolor{comment}{/* Fields not to be copied in tc\_windup start with th\_generation. */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00082}\mbox{\hyperlink{structtimehands_a759f4ac823300fac1fb4b8f8108459d8}{00082}}         u\_int                   \mbox{\hyperlink{structtimehands_a759f4ac823300fac1fb4b8f8108459d8}{th\_generation}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00083}\mbox{\hyperlink{structtimehands_aacc6032d0d797b8a67a36df3ca117021}{00083}}         \textcolor{keyword}{struct }\mbox{\hyperlink{structtimehands}{timehands}}       *\mbox{\hyperlink{structtimehands_aacc6032d0d797b8a67a36df3ca117021}{th\_next}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00084}00084 \};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00085}00085 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00086}\mbox{\hyperlink{kern__tc_8c_a96f1a609fd665fa80e75908e37e2d6a7}{00086}} \textcolor{keyword}{static} \textcolor{keyword}{struct }\mbox{\hyperlink{structtimehands}{timehands}} \mbox{\hyperlink{kern__tc_8c_a96f1a609fd665fa80e75908e37e2d6a7}{ths}}[16] = \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00087}00087     [0] =  \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00088}00088         .\mbox{\hyperlink{structtimehands_a6e873b4aa6fa46eaad2c2b7199ed7555}{th\_counter}} = \&\mbox{\hyperlink{kern__tc_8c_a0545acbb4697b4a0a44447c1c50efc82}{dummy\_timecounter}},}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00089}00089         .th\_scale = (uint64\_t)-\/1 / 1000000,}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00090}00090         .\mbox{\hyperlink{structtimehands_adbe021df320b1201345510bccee7bde5}{th\_large\_delta}} = 1000000,}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00091}00091         .\mbox{\hyperlink{structtimehands_a8343df3d16d957ac6054336b6304d494}{th\_offset}} = \{ .sec = 1 \},}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00092}00092         .th\_generation = 1,}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00093}00093     \},}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00094}00094 \};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00095}00095 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00096}\mbox{\hyperlink{kern__tc_8c_a90f582e4036774428020fe41210fd9cd}{00096}} \textcolor{keyword}{static} \textcolor{keyword}{struct }\mbox{\hyperlink{structtimehands}{timehands}} *\textcolor{keyword}{volatile} \mbox{\hyperlink{structtimehands}{timehands}} = \&\mbox{\hyperlink{kern__tc_8c_a96f1a609fd665fa80e75908e37e2d6a7}{ths}}[0];}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00097}\mbox{\hyperlink{kern__tc_8c_a35098fc91b751950a191213b1c2e5853}{00097}} \textcolor{keyword}{struct }\mbox{\hyperlink{kern__tc_8c_a35098fc91b751950a191213b1c2e5853}{timecounter}} *\mbox{\hyperlink{kern__tc_8c_a35098fc91b751950a191213b1c2e5853}{timecounter}} = \&\mbox{\hyperlink{kern__tc_8c_a0545acbb4697b4a0a44447c1c50efc82}{dummy\_timecounter}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00098}\mbox{\hyperlink{kern__tc_8c_a8301e9eb233bf401378bf306f43fd446}{00098}} \textcolor{keyword}{static} \textcolor{keyword}{struct }\mbox{\hyperlink{kern__tc_8c_a35098fc91b751950a191213b1c2e5853}{timecounter}} *\mbox{\hyperlink{kern__tc_8c_a8301e9eb233bf401378bf306f43fd446}{timecounters}} = \&\mbox{\hyperlink{kern__tc_8c_a0545acbb4697b4a0a44447c1c50efc82}{dummy\_timecounter}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00099}00099 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00100}00100 \textcolor{comment}{/* Mutex to protect the timecounter list. */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00101}\mbox{\hyperlink{kern__tc_8c_a72c9ec426d6d3cd3f45c5d1e9f5088c1}{00101}} \textcolor{keyword}{static} \textcolor{keyword}{struct }\mbox{\hyperlink{uipc__ktls_8c_a7b5de10a04be6deb16c42cef5da02110}{mtx}} \mbox{\hyperlink{kern__tc_8c_a72c9ec426d6d3cd3f45c5d1e9f5088c1}{tc\_lock}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00102}00102 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00103}\mbox{\hyperlink{kern__tc_8c_a6cb013aa29d680e529bd566e9a580f99}{00103}} \textcolor{keywordtype}{int} \mbox{\hyperlink{kern__tc_8c_a6cb013aa29d680e529bd566e9a580f99}{tc\_min\_ticktock\_freq}} = 1;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00104}00104 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00105}\mbox{\hyperlink{kern__tc_8c_aa065968c4fbe4bcc3cd941cbb10619ef}{00105}} \textcolor{keyword}{volatile} time\_t \mbox{\hyperlink{kern__tc_8c_aa065968c4fbe4bcc3cd941cbb10619ef}{time\_second}} = 1;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00106}\mbox{\hyperlink{kern__tc_8c_a6dd117214f5c023a10c9b887218545d5}{00106}} \textcolor{keyword}{volatile} time\_t \mbox{\hyperlink{kern__tc_8c_a6dd117214f5c023a10c9b887218545d5}{time\_uptime}} = 1;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00107}00107 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00108}00108 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00109}00109 \textcolor{comment}{ * The system time is always computed by summing the estimated boot time and the}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00110}00110 \textcolor{comment}{ * system uptime. The timehands track boot time, but it changes when the system}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00111}00111 \textcolor{comment}{ * time is set by the user, stepped by ntpd or adjusted when resuming. It}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00112}00112 \textcolor{comment}{ * is set to new\_time -\/ uptime.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00113}00113 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00114}00114 \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{kern__tc_8c_ab84bb9fd59e621cef9ac8b0ec9fc427a}{sysctl\_kern\_boottime}}(SYSCTL\_HANDLER\_ARGS);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00115}\mbox{\hyperlink{kern__tc_8c_a471ba6ecd69584c29ffe77bab6c7fe7d}{00115}} \mbox{\hyperlink{kern__tc_8c_a471ba6ecd69584c29ffe77bab6c7fe7d}{SYSCTL\_PROC}}(\_kern, KERN\_BOOTTIME, boottime,}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00116}00116     CTLTYPE\_STRUCT | CTLFLAG\_RD | CTLFLAG\_MPSAFE, NULL, 0,}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00117}00117     \mbox{\hyperlink{kern__tc_8c_ab84bb9fd59e621cef9ac8b0ec9fc427a}{sysctl\_kern\_boottime}}, \textcolor{stringliteral}{"{}S,timeval"{}},}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00118}00118     \textcolor{stringliteral}{"{}Estimated system boottime"{}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00119}00119 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00120}\mbox{\hyperlink{kern__tc_8c_a33bb33cc93be805c3874fb4001dc007f}{00120}} \mbox{\hyperlink{kern__tc_8c_a33bb33cc93be805c3874fb4001dc007f}{SYSCTL\_NODE}}(\_kern, OID\_AUTO, \mbox{\hyperlink{kern__tc_8c_a35098fc91b751950a191213b1c2e5853}{timecounter}}, CTLFLAG\_RW | CTLFLAG\_MPSAFE, 0,}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00121}00121     \textcolor{stringliteral}{"{}"{}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00122}\mbox{\hyperlink{kern__tc_8c_aa1f0b2cf0f442a2783666a9710af4216}{00122}} \textcolor{keyword}{static} \mbox{\hyperlink{kern__tc_8c_a33bb33cc93be805c3874fb4001dc007f}{SYSCTL\_NODE}}(\_kern\_timecounter, OID\_AUTO, tc,}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00123}00123     CTLFLAG\_RW | CTLFLAG\_MPSAFE, 0,}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00124}00124     \textcolor{stringliteral}{"{}"{}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00125}00125 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00126}\mbox{\hyperlink{kern__tc_8c_a3f4cbce7a7a305c06a4ecfaca44c2546}{00126}} \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{kern__tc_8c_a3f4cbce7a7a305c06a4ecfaca44c2546}{timestepwarnings}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00127}\mbox{\hyperlink{kern__tc_8c_a5bf4904ccdc09180ec4cd7788bc1d1d1}{00127}} \mbox{\hyperlink{kern__tc_8c_a5bf4904ccdc09180ec4cd7788bc1d1d1}{SYSCTL\_INT}}(\_kern\_timecounter, OID\_AUTO, stepwarnings, CTLFLAG\_RWTUN,}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00128}00128     \&\mbox{\hyperlink{kern__tc_8c_a3f4cbce7a7a305c06a4ecfaca44c2546}{timestepwarnings}}, 0, \textcolor{stringliteral}{"{}Log time steps"{}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00129}00129 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00130}\mbox{\hyperlink{kern__tc_8c_aeb6284732160c7e55ebb1824db8c3462}{00130}} \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{kern__tc_8c_aeb6284732160c7e55ebb1824db8c3462}{timehands\_count}} = 2;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00131}\mbox{\hyperlink{kern__tc_8c_a598864626eb0a0424429c40d6f41d686}{00131}} \mbox{\hyperlink{kern__tc_8c_a5bf4904ccdc09180ec4cd7788bc1d1d1}{SYSCTL\_INT}}(\_kern\_timecounter, OID\_AUTO, \mbox{\hyperlink{kern__tc_8c_aeb6284732160c7e55ebb1824db8c3462}{timehands\_count}},}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00132}00132     CTLFLAG\_RDTUN | CTLFLAG\_NOFETCH,}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00133}00133     \&\mbox{\hyperlink{kern__tc_8c_aeb6284732160c7e55ebb1824db8c3462}{timehands\_count}}, 0, \textcolor{stringliteral}{"{}Count of timehands in rotation"{}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00134}00134 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00135}\mbox{\hyperlink{kern__tc_8c_aec1113073735ccd4c87914009bc35f9b}{00135}} \textcolor{keyword}{struct }\mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} \mbox{\hyperlink{kern__tc_8c_aec1113073735ccd4c87914009bc35f9b}{bt\_timethreshold}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00136}\mbox{\hyperlink{kern__tc_8c_a6e0462d2805ca97c64bbeaf7973e453b}{00136}} \textcolor{keyword}{struct }\mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} \mbox{\hyperlink{kern__tc_8c_a6e0462d2805ca97c64bbeaf7973e453b}{bt\_tickthreshold}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00137}\mbox{\hyperlink{kern__tc_8c_a71ae670efe8fdafc9addefffba192257}{00137}} sbintime\_t \mbox{\hyperlink{kern__tc_8c_a71ae670efe8fdafc9addefffba192257}{sbt\_timethreshold}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00138}\mbox{\hyperlink{kern__tc_8c_aa009b701b79efa61d623d434ca926398}{00138}} sbintime\_t \mbox{\hyperlink{kern__tc_8c_aa009b701b79efa61d623d434ca926398}{sbt\_tickthreshold}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00139}\mbox{\hyperlink{kern__tc_8c_a7d29c90041e517f5b69372d52805cece}{00139}} \textcolor{keyword}{struct }\mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} \mbox{\hyperlink{kern__tc_8c_a7d29c90041e517f5b69372d52805cece}{tc\_tick\_bt}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00140}\mbox{\hyperlink{kern__tc_8c_a1a43259235d891d84345bcf2140ada43}{00140}} sbintime\_t \mbox{\hyperlink{kern__tc_8c_a1a43259235d891d84345bcf2140ada43}{tc\_tick\_sbt}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00141}\mbox{\hyperlink{kern__tc_8c_a78dc54706cfbd50692ea2c3dcdb32786}{00141}} \textcolor{keywordtype}{int} \mbox{\hyperlink{kern__tc_8c_a78dc54706cfbd50692ea2c3dcdb32786}{tc\_precexp}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00142}\mbox{\hyperlink{kern__tc_8c_a3f0e2905019433f357de2eac13da43c9}{00142}} \textcolor{keywordtype}{int} \mbox{\hyperlink{kern__tc_8c_a3f0e2905019433f357de2eac13da43c9}{tc\_timepercentage}} = TC\_DEFAULTPERC;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00143}00143 \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{kern__tc_8c_a8504d0a71d51f3e9a2650a6a968309de}{sysctl\_kern\_timecounter\_adjprecision}}(SYSCTL\_HANDLER\_ARGS);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00144}\mbox{\hyperlink{kern__tc_8c_ac0ec510eee12cb92261fbe283660026e}{00144}} \mbox{\hyperlink{kern__tc_8c_a471ba6ecd69584c29ffe77bab6c7fe7d}{SYSCTL\_PROC}}(\_kern\_timecounter, OID\_AUTO, alloweddeviation,}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00145}00145     CTLTYPE\_INT | CTLFLAG\_RWTUN | CTLFLAG\_MPSAFE, 0, 0,}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00146}00146     \mbox{\hyperlink{kern__tc_8c_a8504d0a71d51f3e9a2650a6a968309de}{sysctl\_kern\_timecounter\_adjprecision}}, \textcolor{stringliteral}{"{}I"{}},}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00147}00147     \textcolor{stringliteral}{"{}Allowed time interval deviation in percents"{}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00148}00148 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00149}\mbox{\hyperlink{kern__tc_8c_a28a361b4119bc0fda1ede69d075aa621}{00149}} \textcolor{keyword}{volatile} \textcolor{keywordtype}{int} \mbox{\hyperlink{kern__tc_8c_a28a361b4119bc0fda1ede69d075aa621}{rtc\_generation}} = 1;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00150}00150 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00151}\mbox{\hyperlink{kern__tc_8c_a4c24893bb4edabd1ba114b9a942f23fd}{00151}} \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{kern__tc_8c_a4c24893bb4edabd1ba114b9a942f23fd}{tc\_chosen}};  \textcolor{comment}{/* Non-\/zero if a specific tc was chosen via sysctl. */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00152}\mbox{\hyperlink{kern__tc_8c_a908d1ad161fecd877fe78a3ce4174e73}{00152}} \textcolor{keyword}{static} \textcolor{keywordtype}{char} \mbox{\hyperlink{kern__tc_8c_a908d1ad161fecd877fe78a3ce4174e73}{tc\_from\_tunable}}[16];}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00153}00153 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00154}00154 \textcolor{keyword}{static} \textcolor{keywordtype}{void} \mbox{\hyperlink{kern__tc_8c_a1c0ca4641e0c89396367d12d1ddfc9e8}{tc\_windup}}(\textcolor{keyword}{struct} \mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} *new\_boottimebin);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00155}00155 \textcolor{keyword}{static} \textcolor{keywordtype}{void} \mbox{\hyperlink{kern__tc_8c_a4c41c76d31bf0a9205130acc4cf3d8b6}{cpu\_tick\_calibrate}}(\textcolor{keywordtype}{int});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00156}00156 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00157}00157 \textcolor{keywordtype}{void} \mbox{\hyperlink{kern__tc_8c_a35753be524f85e82e9358662261b98c1}{dtrace\_getnanotime}}(\textcolor{keyword}{struct} timespec *tsp);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00158}00158 \textcolor{keywordtype}{void} \mbox{\hyperlink{kern__tc_8c_a635a7118ebe20b1e6ef057a9b2fb472d}{dtrace\_getnanouptime}}(\textcolor{keyword}{struct} timespec *tsp);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00159}00159 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00160}00160 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00161}\mbox{\hyperlink{kern__tc_8c_ab84bb9fd59e621cef9ac8b0ec9fc427a}{00161}} \mbox{\hyperlink{kern__tc_8c_ab84bb9fd59e621cef9ac8b0ec9fc427a}{sysctl\_kern\_boottime}}(SYSCTL\_HANDLER\_ARGS)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00162}00162 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00163}00163         \textcolor{keyword}{struct }timeval boottime;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00164}00164 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00165}00165         \mbox{\hyperlink{kern__tc_8c_a75c4aa2c1e0951b53133f5224e724673}{getboottime}}(\&boottime);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00166}00166 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00167}00167 \textcolor{comment}{/* i386 is the only arch which uses a 32bits time\_t */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00168}00168 \textcolor{preprocessor}{\#ifdef \_\_amd64\_\_}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00169}00169 \textcolor{preprocessor}{\#ifdef SCTL\_MASK32}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00170}00170         \textcolor{keywordtype}{int} tv[2];}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00171}00171 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00172}00172         \textcolor{keywordflow}{if} (req-\/>flags \& SCTL\_MASK32) \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00173}00173                 tv[0] = boottime.tv\_sec;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00174}00174                 tv[1] = boottime.tv\_usec;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00175}00175                 \textcolor{keywordflow}{return} (SYSCTL\_OUT(req, tv, \textcolor{keyword}{sizeof}(tv)));}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00176}00176         \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00177}00177 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00178}00178 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00179}00179         \textcolor{keywordflow}{return} (SYSCTL\_OUT(req, \&boottime, \textcolor{keyword}{sizeof}(boottime)));}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00180}00180 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00181}00181 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00182}00182 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00183}\mbox{\hyperlink{kern__tc_8c_adaac76ad284c642dc1bf829a5fa1237f}{00183}} \mbox{\hyperlink{kern__tc_8c_adaac76ad284c642dc1bf829a5fa1237f}{sysctl\_kern\_timecounter\_get}}(SYSCTL\_HANDLER\_ARGS)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00184}00184 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00185}00185         u\_int ncount;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00186}00186         \textcolor{keyword}{struct }\mbox{\hyperlink{kern__tc_8c_a35098fc91b751950a191213b1c2e5853}{timecounter}} *tc = arg1;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00187}00187 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00188}00188         ncount = tc-\/>tc\_get\_timecount(tc);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00189}00189         \textcolor{keywordflow}{return} (\mbox{\hyperlink{kern__sysctl_8c_aab82ede27ea5d6975c4e91eb6c6111b7}{sysctl\_handle\_int}}(oidp, \&ncount, 0, req));}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00190}00190 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00191}00191 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00192}00192 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00193}\mbox{\hyperlink{kern__tc_8c_ab22a1fb3cbd3d9d528a905ae50ffe9a2}{00193}} \mbox{\hyperlink{kern__tc_8c_ab22a1fb3cbd3d9d528a905ae50ffe9a2}{sysctl\_kern\_timecounter\_freq}}(SYSCTL\_HANDLER\_ARGS)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00194}00194 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00195}00195         uint64\_t freq;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00196}00196         \textcolor{keyword}{struct }\mbox{\hyperlink{kern__tc_8c_a35098fc91b751950a191213b1c2e5853}{timecounter}} *tc = arg1;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00197}00197 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00198}00198         freq = tc-\/>tc\_frequency;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00199}00199         \textcolor{keywordflow}{return} (\mbox{\hyperlink{kern__sysctl_8c_a5f3ec2df222f22f947f174050375c7dd}{sysctl\_handle\_64}}(oidp, \&freq, 0, req));}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00200}00200 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00201}00201 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00202}00202 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00203}00203 \textcolor{comment}{ * Return the difference between the timehands' counter value now and what}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00204}00204 \textcolor{comment}{ * was when we copied it to the timehands' offset\_count.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00205}00205 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00206}00206 \textcolor{keyword}{static} \_\_inline u\_int}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00207}\mbox{\hyperlink{kern__tc_8c_a9f364f93dac9a6972f68cd9e6449d971}{00207}} \mbox{\hyperlink{kern__tc_8c_a9f364f93dac9a6972f68cd9e6449d971}{tc\_delta}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structtimehands}{timehands}} *th)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00208}00208 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00209}00209         \textcolor{keyword}{struct }\mbox{\hyperlink{kern__tc_8c_a35098fc91b751950a191213b1c2e5853}{timecounter}} *tc;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00210}00210 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00211}00211         tc = th-\/>\mbox{\hyperlink{structtimehands_a6e873b4aa6fa46eaad2c2b7199ed7555}{th\_counter}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00212}00212         \textcolor{keywordflow}{return} ((tc-\/>tc\_get\_timecount(tc) -\/ th-\/>\mbox{\hyperlink{structtimehands_a6ef254e39c5e63cae43e7952a423064d}{th\_offset\_count}}) \&}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00213}00213             tc-\/>tc\_counter\_mask);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00214}00214 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00215}00215 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00216}00216 \textcolor{keyword}{static} \_\_inline \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00217}\mbox{\hyperlink{kern__tc_8c_a337fff48624c756075b8a9e220045212}{00217}} \mbox{\hyperlink{kern__tc_8c_a337fff48624c756075b8a9e220045212}{bintime\_add\_tc\_delta}}(\textcolor{keyword}{struct} \mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} *\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, uint64\_t scale,}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00218}00218     uint64\_t large\_delta, uint64\_t delta)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00219}00219 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00220}00220         uint64\_t x;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00221}00221 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00222}00222         \textcolor{keywordflow}{if} (\_\_predict\_false(delta >= large\_delta)) \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00223}00223                 \textcolor{comment}{/* Avoid overflow for scale * delta. */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00224}00224                 x = (scale >> 32) * delta;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00225}00225                 \mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}-\/>sec += x >> 32;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00226}00226                 bintime\_addx(\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, x << 32);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00227}00227                 bintime\_addx(\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, (scale \& 0xffffffff) * delta);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00228}00228         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00229}00229                 bintime\_addx(\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, scale * delta);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00230}00230         \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00231}00231 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00232}00232 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00233}00233 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00234}00234 \textcolor{comment}{ * Functions for reading the time.  We have to loop until we are sure that}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00235}00235 \textcolor{comment}{ * the timehands that we operated on was not updated under our feet.  See}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00236}00236 \textcolor{comment}{ * the comment in <sys/time.h> for a description of these 12 functions.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00237}00237 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00238}00238 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00239}00239 \textcolor{keyword}{static} \_\_inline \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00240}\mbox{\hyperlink{kern__tc_8c_a0829b5841a356bad90c2e7ecd67f75d7}{00240}} \mbox{\hyperlink{kern__tc_8c_a0829b5841a356bad90c2e7ecd67f75d7}{bintime\_off}}(\textcolor{keyword}{struct} \mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} *\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, u\_int off)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00241}00241 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00242}00242         \textcolor{keyword}{struct }\mbox{\hyperlink{structtimehands}{timehands}} *th;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00243}00243         \textcolor{keyword}{struct }\mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} *btp;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00244}00244         uint64\_t scale;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00245}00245         u\_int delta, gen, large\_delta;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00246}00246 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00247}00247         \textcolor{keywordflow}{do} \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00248}00248                 th = \mbox{\hyperlink{kern__tc_8c_a90f582e4036774428020fe41210fd9cd}{timehands}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00249}00249                 gen = atomic\_load\_acq\_int(\&th-\/>\mbox{\hyperlink{structtimehands_a759f4ac823300fac1fb4b8f8108459d8}{th\_generation}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00250}00250                 btp = (\textcolor{keyword}{struct }\mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} *)((vm\_offset\_t)th + off);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00251}00251                 *\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}} = *btp;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00252}00252                 scale = th-\/>\mbox{\hyperlink{structtimehands_a4b079bb7849db9a6ea3abf069ad8905a}{th\_scale}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00253}00253                 delta = \mbox{\hyperlink{kern__tc_8c_a9f364f93dac9a6972f68cd9e6449d971}{tc\_delta}}(th);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00254}00254                 large\_delta = th-\/>\mbox{\hyperlink{structtimehands_adbe021df320b1201345510bccee7bde5}{th\_large\_delta}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00255}00255                 atomic\_thread\_fence\_acq();}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00256}00256         \} \textcolor{keywordflow}{while} (gen == 0 || gen != th-\/>\mbox{\hyperlink{structtimehands_a759f4ac823300fac1fb4b8f8108459d8}{th\_generation}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00257}00257 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00258}00258         \mbox{\hyperlink{kern__tc_8c_a337fff48624c756075b8a9e220045212}{bintime\_add\_tc\_delta}}(\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, scale, large\_delta, delta);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00259}00259 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00260}\mbox{\hyperlink{kern__tc_8c_a7f671bdfbd4e9478eb3f8aa941710b60}{00260}} \textcolor{preprocessor}{\#define GETTHBINTIME(dst, member)                                       \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00261}00261 \textcolor{preprocessor}{do \{                                                                    \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00262}00262 \textcolor{preprocessor}{        \_Static\_assert(\_Generic(((struct timehands *)NULL)-\/>member,     \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00263}00263 \textcolor{preprocessor}{            struct bintime: 1, default: 0) == 1,                        \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00264}00264 \textcolor{preprocessor}{            "{}struct timehands member is not of struct bintime type"{}});   \(\backslash\)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00265}00265         bintime\_off(dst, \_\_offsetof(struct timehands, member));         \(\backslash\)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00266}00266 \} while (0)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00267}00267 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00268}00268 \textcolor{keyword}{static} \_\_inline \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00269}\mbox{\hyperlink{kern__tc_8c_a49d679037e12eb9174d682203a74d57b}{00269}} \mbox{\hyperlink{kern__tc_8c_a49d679037e12eb9174d682203a74d57b}{getthmember}}(\textcolor{keywordtype}{void} *out, \textcolor{keywordtype}{size\_t} out\_size, u\_int off)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00270}00270 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00271}00271         \textcolor{keyword}{struct }\mbox{\hyperlink{structtimehands}{timehands}} *th;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00272}00272         u\_int gen;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00273}00273 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00274}00274         \textcolor{keywordflow}{do} \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00275}00275                 th = \mbox{\hyperlink{kern__tc_8c_a90f582e4036774428020fe41210fd9cd}{timehands}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00276}00276                 gen = atomic\_load\_acq\_int(\&th-\/>\mbox{\hyperlink{structtimehands_a759f4ac823300fac1fb4b8f8108459d8}{th\_generation}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00277}00277                 memcpy(out, (\textcolor{keywordtype}{char} *)th + off, out\_size);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00278}00278                 atomic\_thread\_fence\_acq();}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00279}00279         \} \textcolor{keywordflow}{while} (gen == 0 || gen != th-\/>\mbox{\hyperlink{structtimehands_a759f4ac823300fac1fb4b8f8108459d8}{th\_generation}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00280}00280 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00281}\mbox{\hyperlink{kern__tc_8c_a4a19274b449ffcd79400ff5b3980a2b2}{00281}} \textcolor{preprocessor}{\#define GETTHMEMBER(dst, member)                                        \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00282}00282 \textcolor{preprocessor}{do \{                                                                    \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00283}00283 \textcolor{preprocessor}{        \_Static\_assert(\_Generic(*dst,                                   \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00284}00284 \textcolor{preprocessor}{            \_\_typeof(((struct timehands *)NULL)-\/>member): 1,            \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00285}00285 \textcolor{preprocessor}{            default: 0) == 1,                                           \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00286}00286 \textcolor{preprocessor}{            "{}*dst and struct timehands member have different types"{}});   \(\backslash\)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00287}00287         getthmember(dst, sizeof(*dst), \_\_offsetof(struct timehands,     \(\backslash\)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00288}00288             member));                                                   \(\backslash\)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00289}00289 \} while (0)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00290}00290 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00291}00291 \textcolor{preprocessor}{\#ifdef FFCLOCK}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00292}00292 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00293}00293 fbclock\_binuptime(\textcolor{keyword}{struct} \mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} *\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}})}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00294}00294 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00295}00295 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00296}00296         \mbox{\hyperlink{kern__tc_8c_a7f671bdfbd4e9478eb3f8aa941710b60}{GETTHBINTIME}}(\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, \mbox{\hyperlink{structtimehands_a8343df3d16d957ac6054336b6304d494}{th\_offset}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00297}00297 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00298}00298 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00299}00299 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00300}00300 fbclock\_nanouptime(\textcolor{keyword}{struct} timespec *tsp)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00301}00301 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00302}00302         \textcolor{keyword}{struct }\mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} \mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00303}00303 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00304}00304         fbclock\_binuptime(\&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00305}00305         bintime2timespec(\&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, tsp);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00306}00306 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00307}00307 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00308}00308 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00309}00309 fbclock\_microuptime(\textcolor{keyword}{struct} timeval *tvp)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00310}00310 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00311}00311         \textcolor{keyword}{struct }\mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} \mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00312}00312 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00313}00313         fbclock\_binuptime(\&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00314}00314         bintime2timeval(\&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, tvp);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00315}00315 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00316}00316 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00317}00317 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00318}00318 fbclock\_bintime(\textcolor{keyword}{struct} \mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} *\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}})}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00319}00319 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00320}00320 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00321}00321         \mbox{\hyperlink{kern__tc_8c_a7f671bdfbd4e9478eb3f8aa941710b60}{GETTHBINTIME}}(\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, th\_bintime);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00322}00322 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00323}00323 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00324}00324 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00325}00325 fbclock\_nanotime(\textcolor{keyword}{struct} timespec *tsp)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00326}00326 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00327}00327         \textcolor{keyword}{struct }\mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} \mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00328}00328 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00329}00329         fbclock\_bintime(\&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00330}00330         bintime2timespec(\&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, tsp);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00331}00331 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00332}00332 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00333}00333 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00334}00334 fbclock\_microtime(\textcolor{keyword}{struct} timeval *tvp)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00335}00335 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00336}00336         \textcolor{keyword}{struct }\mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} \mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00337}00337 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00338}00338         fbclock\_bintime(\&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00339}00339         bintime2timeval(\&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, tvp);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00340}00340 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00341}00341 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00342}00342 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00343}00343 fbclock\_getbinuptime(\textcolor{keyword}{struct} \mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} *\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}})}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00344}00344 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00345}00345 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00346}00346         \mbox{\hyperlink{kern__tc_8c_a4a19274b449ffcd79400ff5b3980a2b2}{GETTHMEMBER}}(\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, th\_offset);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00347}00347 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00348}00348 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00349}00349 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00350}00350 fbclock\_getnanouptime(\textcolor{keyword}{struct} timespec *tsp)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00351}00351 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00352}00352         \textcolor{keyword}{struct }\mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} \mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00353}00353 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00354}00354         \mbox{\hyperlink{kern__tc_8c_a4a19274b449ffcd79400ff5b3980a2b2}{GETTHMEMBER}}(\&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, th\_offset);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00355}00355         bintime2timespec(\&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, tsp);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00356}00356 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00357}00357 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00358}00358 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00359}00359 fbclock\_getmicrouptime(\textcolor{keyword}{struct} timeval *tvp)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00360}00360 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00361}00361         \textcolor{keyword}{struct }\mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} \mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00362}00362 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00363}00363         \mbox{\hyperlink{kern__tc_8c_a4a19274b449ffcd79400ff5b3980a2b2}{GETTHMEMBER}}(\&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, th\_offset);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00364}00364         bintime2timeval(\&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, tvp);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00365}00365 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00366}00366 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00367}00367 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00368}00368 fbclock\_getbintime(\textcolor{keyword}{struct} \mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} *\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}})}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00369}00369 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00370}00370 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00371}00371         \mbox{\hyperlink{kern__tc_8c_a4a19274b449ffcd79400ff5b3980a2b2}{GETTHMEMBER}}(\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, th\_bintime);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00372}00372 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00373}00373 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00374}00374 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00375}00375 fbclock\_getnanotime(\textcolor{keyword}{struct} timespec *tsp)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00376}00376 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00377}00377 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00378}00378         \mbox{\hyperlink{kern__tc_8c_a4a19274b449ffcd79400ff5b3980a2b2}{GETTHMEMBER}}(tsp, th\_nanotime);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00379}00379 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00380}00380 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00381}00381 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00382}00382 fbclock\_getmicrotime(\textcolor{keyword}{struct} timeval *tvp)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00383}00383 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00384}00384 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00385}00385         \mbox{\hyperlink{kern__tc_8c_a4a19274b449ffcd79400ff5b3980a2b2}{GETTHMEMBER}}(tvp, th\_microtime);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00386}00386 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00387}00387 \textcolor{preprocessor}{\#else }\textcolor{comment}{/* !FFCLOCK */}\textcolor{preprocessor}{}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00388}00388 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00389}00389 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00390}\mbox{\hyperlink{kern__tc_8c_a8ec04a6cda605cfc3cebfbd49e5ece3e}{00390}} \mbox{\hyperlink{kern__tc_8c_a8ec04a6cda605cfc3cebfbd49e5ece3e}{binuptime}}(\textcolor{keyword}{struct} \mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} *\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}})}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00391}00391 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00392}00392 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00393}00393         \mbox{\hyperlink{kern__tc_8c_a7f671bdfbd4e9478eb3f8aa941710b60}{GETTHBINTIME}}(\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, th\_offset);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00394}00394 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00395}00395 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00396}00396 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00397}\mbox{\hyperlink{kern__tc_8c_a3e18bf3ba0f838bb89fc66ecbfff9cb4}{00397}} \mbox{\hyperlink{kern__tc_8c_a3e18bf3ba0f838bb89fc66ecbfff9cb4}{nanouptime}}(\textcolor{keyword}{struct} timespec *tsp)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00398}00398 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00399}00399         \textcolor{keyword}{struct }\mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} \mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00400}00400 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00401}00401         \mbox{\hyperlink{kern__tc_8c_a8ec04a6cda605cfc3cebfbd49e5ece3e}{binuptime}}(\&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00402}00402         bintime2timespec(\&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, tsp);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00403}00403 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00404}00404 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00405}00405 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00406}\mbox{\hyperlink{kern__tc_8c_ad2ee9cc3eb46aca2703cc3c5945c6c2d}{00406}} \mbox{\hyperlink{kern__tc_8c_ad2ee9cc3eb46aca2703cc3c5945c6c2d}{microuptime}}(\textcolor{keyword}{struct} timeval *tvp)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00407}00407 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00408}00408         \textcolor{keyword}{struct }\mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} \mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00409}00409 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00410}00410         \mbox{\hyperlink{kern__tc_8c_a8ec04a6cda605cfc3cebfbd49e5ece3e}{binuptime}}(\&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00411}00411         bintime2timeval(\&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, tvp);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00412}00412 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00413}00413 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00414}00414 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00415}\mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{00415}} \mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}}(\textcolor{keyword}{struct} \mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} *\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}})}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00416}00416 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00417}00417 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00418}00418         \mbox{\hyperlink{kern__tc_8c_a7f671bdfbd4e9478eb3f8aa941710b60}{GETTHBINTIME}}(\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, th\_bintime);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00419}00419 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00420}00420 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00421}00421 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00422}\mbox{\hyperlink{kern__tc_8c_af53cad09abe604da7bf227343569b0e4}{00422}} \mbox{\hyperlink{kern__tc_8c_af53cad09abe604da7bf227343569b0e4}{nanotime}}(\textcolor{keyword}{struct} timespec *tsp)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00423}00423 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00424}00424         \textcolor{keyword}{struct }\mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} \mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00425}00425 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00426}00426         \mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}}(\&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00427}00427         bintime2timespec(\&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, tsp);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00428}00428 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00429}00429 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00430}00430 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00431}\mbox{\hyperlink{kern__tc_8c_ad01043987c883e8e248bc36c6a9fb200}{00431}} \mbox{\hyperlink{kern__tc_8c_ad01043987c883e8e248bc36c6a9fb200}{microtime}}(\textcolor{keyword}{struct} timeval *tvp)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00432}00432 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00433}00433         \textcolor{keyword}{struct }\mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} \mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00434}00434 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00435}00435         \mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}}(\&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00436}00436         bintime2timeval(\&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, tvp);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00437}00437 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00438}00438 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00439}00439 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00440}\mbox{\hyperlink{kern__tc_8c_a318fd9f982a1e77dedca21fc5d321ebb}{00440}} \mbox{\hyperlink{kern__tc_8c_a318fd9f982a1e77dedca21fc5d321ebb}{getbinuptime}}(\textcolor{keyword}{struct} \mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} *\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}})}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00441}00441 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00442}00442 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00443}00443         \mbox{\hyperlink{kern__tc_8c_a4a19274b449ffcd79400ff5b3980a2b2}{GETTHMEMBER}}(\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, th\_offset);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00444}00444 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00445}00445 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00446}00446 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00447}\mbox{\hyperlink{kern__tc_8c_a72625f715f1ac2c44b7f54d2aa5771a6}{00447}} \mbox{\hyperlink{kern__tc_8c_a72625f715f1ac2c44b7f54d2aa5771a6}{getnanouptime}}(\textcolor{keyword}{struct} timespec *tsp)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00448}00448 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00449}00449         \textcolor{keyword}{struct }\mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} \mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00450}00450 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00451}00451         \mbox{\hyperlink{kern__tc_8c_a4a19274b449ffcd79400ff5b3980a2b2}{GETTHMEMBER}}(\&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, th\_offset);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00452}00452         bintime2timespec(\&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, tsp);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00453}00453 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00454}00454 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00455}00455 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00456}\mbox{\hyperlink{kern__tc_8c_abadefbffd93a8bdafb42e027ba3e79cc}{00456}} \mbox{\hyperlink{kern__tc_8c_abadefbffd93a8bdafb42e027ba3e79cc}{getmicrouptime}}(\textcolor{keyword}{struct} timeval *tvp)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00457}00457 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00458}00458         \textcolor{keyword}{struct }\mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} \mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00459}00459 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00460}00460         \mbox{\hyperlink{kern__tc_8c_a4a19274b449ffcd79400ff5b3980a2b2}{GETTHMEMBER}}(\&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, th\_offset);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00461}00461         bintime2timeval(\&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, tvp);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00462}00462 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00463}00463 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00464}00464 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00465}\mbox{\hyperlink{kern__tc_8c_ac6bc418452e03039f3b2d959d9100519}{00465}} \mbox{\hyperlink{kern__tc_8c_ac6bc418452e03039f3b2d959d9100519}{getbintime}}(\textcolor{keyword}{struct} \mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} *\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}})}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00466}00466 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00467}00467 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00468}00468         \mbox{\hyperlink{kern__tc_8c_a4a19274b449ffcd79400ff5b3980a2b2}{GETTHMEMBER}}(\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, th\_bintime);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00469}00469 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00470}00470 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00471}00471 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00472}\mbox{\hyperlink{kern__tc_8c_acf14beeb98d876bad86da88a91370dea}{00472}} \mbox{\hyperlink{kern__tc_8c_acf14beeb98d876bad86da88a91370dea}{getnanotime}}(\textcolor{keyword}{struct} timespec *tsp)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00473}00473 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00474}00474 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00475}00475         \mbox{\hyperlink{kern__tc_8c_a4a19274b449ffcd79400ff5b3980a2b2}{GETTHMEMBER}}(tsp, th\_nanotime);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00476}00476 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00477}00477 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00478}00478 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00479}\mbox{\hyperlink{kern__tc_8c_afa0a7beb7cab706ffb16c48c8694e3c6}{00479}} \mbox{\hyperlink{kern__tc_8c_afa0a7beb7cab706ffb16c48c8694e3c6}{getmicrotime}}(\textcolor{keyword}{struct} timeval *tvp)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00480}00480 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00481}00481 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00482}00482         \mbox{\hyperlink{kern__tc_8c_a4a19274b449ffcd79400ff5b3980a2b2}{GETTHMEMBER}}(tvp, th\_microtime);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00483}00483 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00484}00484 \textcolor{preprocessor}{\#endif }\textcolor{comment}{/* FFCLOCK */}\textcolor{preprocessor}{}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00485}00485 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00486}00486 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00487}\mbox{\hyperlink{kern__tc_8c_a75c4aa2c1e0951b53133f5224e724673}{00487}} \mbox{\hyperlink{kern__tc_8c_a75c4aa2c1e0951b53133f5224e724673}{getboottime}}(\textcolor{keyword}{struct} timeval *boottime)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00488}00488 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00489}00489         \textcolor{keyword}{struct }\mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} boottimebin;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00490}00490 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00491}00491         \mbox{\hyperlink{kern__tc_8c_a405c56b4e142038fb3d2c072a964ee50}{getboottimebin}}(\&boottimebin);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00492}00492         bintime2timeval(\&boottimebin, boottime);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00493}00493 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00494}00494 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00495}00495 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00496}\mbox{\hyperlink{kern__tc_8c_a405c56b4e142038fb3d2c072a964ee50}{00496}} \mbox{\hyperlink{kern__tc_8c_a405c56b4e142038fb3d2c072a964ee50}{getboottimebin}}(\textcolor{keyword}{struct} \mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} *boottimebin)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00497}00497 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00498}00498 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00499}00499         \mbox{\hyperlink{kern__tc_8c_a4a19274b449ffcd79400ff5b3980a2b2}{GETTHMEMBER}}(boottimebin, th\_boottime);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00500}00500 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00501}00501 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00502}00502 \textcolor{preprocessor}{\#ifdef FFCLOCK}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00503}00503 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00504}00504 \textcolor{comment}{ * Support for feed-\/forward synchronization algorithms. This is heavily inspired}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00505}00505 \textcolor{comment}{ * by the timehands mechanism but kept independent from it. *\_windup() functions}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00506}00506 \textcolor{comment}{ * have some connection to avoid accessing the timecounter hardware more than}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00507}00507 \textcolor{comment}{ * necessary.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00508}00508 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00509}00509 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00510}00510 \textcolor{comment}{/* Feed-\/forward clock estimates kept updated by the synchronization daemon. */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00511}00511 \textcolor{keyword}{struct }ffclock\_estimate ffclock\_estimate;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00512}00512 \textcolor{keyword}{struct }\mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} ffclock\_boottime; \textcolor{comment}{/* Feed-\/forward boot time estimate. */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00513}00513 uint32\_t ffclock\_status;                \textcolor{comment}{/* Feed-\/forward clock status. */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00514}00514 int8\_t ffclock\_updated;                 \textcolor{comment}{/* New estimates are available. */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00515}00515 \textcolor{keyword}{struct }\mbox{\hyperlink{uipc__ktls_8c_a7b5de10a04be6deb16c42cef5da02110}{mtx}} ffclock\_mtx;                      \textcolor{comment}{/* Mutex on ffclock\_estimate. */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00516}00516 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00517}00517 \textcolor{keyword}{struct }fftimehands \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00518}00518         \textcolor{keyword}{struct }ffclock\_estimate cest;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00519}00519         \textcolor{keyword}{struct }\mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}}           tick\_time;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00520}00520         \textcolor{keyword}{struct }\mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}}           tick\_time\_lerp;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00521}00521         ffcounter               tick\_ffcount;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00522}00522         uint64\_t                period\_lerp;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00523}00523         \textcolor{keyword}{volatile} uint8\_t        gen;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00524}00524         \textcolor{keyword}{struct }fftimehands      *next;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00525}00525 \};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00526}00526 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00527}00527 \textcolor{preprocessor}{\#define NUM\_ELEMENTS(x) (sizeof(x) / sizeof(*x))}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00528}00528 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00529}00529 \textcolor{keyword}{static} \textcolor{keyword}{struct }fftimehands ffth[10];}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00530}00530 \textcolor{keyword}{static} \textcolor{keyword}{struct }fftimehands *\textcolor{keyword}{volatile} fftimehands = ffth;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00531}00531 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00532}00532 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00533}00533 ffclock\_init(\textcolor{keywordtype}{void})}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00534}00534 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00535}00535         \textcolor{keyword}{struct }fftimehands *cur;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00536}00536         \textcolor{keyword}{struct }fftimehands *last;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00537}00537 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00538}00538         memset(ffth, 0, \textcolor{keyword}{sizeof}(ffth));}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00539}00539 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00540}00540         last = ffth + NUM\_ELEMENTS(ffth) -\/ 1;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00541}00541         \textcolor{keywordflow}{for} (cur = ffth; cur < last; cur++)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00542}00542                 cur-\/>next = cur + 1;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00543}00543         last-\/>next = ffth;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00544}00544 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00545}00545         ffclock\_updated = 0;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00546}00546         ffclock\_status = FFCLOCK\_STA\_UNSYNC;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00547}00547         mtx\_init(\&ffclock\_mtx, \textcolor{stringliteral}{"{}ffclock lock"{}}, NULL, MTX\_DEF);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00548}00548 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00549}00549 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00550}00550 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00551}00551 \textcolor{comment}{ * Reset the feed-\/forward clock estimates. Called from inittodr() to get things}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00552}00552 \textcolor{comment}{ * kick started and uses the timecounter nominal frequency as a first period}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00553}00553 \textcolor{comment}{ * estimate. Note: this function may be called several time just after boot.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00554}00554 \textcolor{comment}{ * Note: this is the only function that sets the value of boot time for the}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00555}00555 \textcolor{comment}{ * monotonic (i.e. uptime) version of the feed-\/forward clock.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00556}00556 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00557}00557 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00558}00558 ffclock\_reset\_clock(\textcolor{keyword}{struct} timespec *\mbox{\hyperlink{clock__if_8m_a919cc4bfd342c5574101ab9d56c4092a}{ts}})}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00559}00559 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00560}00560         \textcolor{keyword}{struct }\mbox{\hyperlink{kern__tc_8c_a35098fc91b751950a191213b1c2e5853}{timecounter}} *tc;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00561}00561         \textcolor{keyword}{struct }ffclock\_estimate cest;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00562}00562 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00563}00563         tc = \mbox{\hyperlink{structtimehands}{timehands}}-\/>\mbox{\hyperlink{structtimehands_a6e873b4aa6fa46eaad2c2b7199ed7555}{th\_counter}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00564}00564         memset(\&cest, 0, \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} ffclock\_estimate));}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00565}00565 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00566}00566         timespec2bintime(\mbox{\hyperlink{clock__if_8m_a919cc4bfd342c5574101ab9d56c4092a}{ts}}, \&ffclock\_boottime);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00567}00567         timespec2bintime(\mbox{\hyperlink{clock__if_8m_a919cc4bfd342c5574101ab9d56c4092a}{ts}}, \&(cest.update\_time));}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00568}00568         ffclock\_read\_counter(\&cest.update\_ffcount);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00569}00569         cest.leapsec\_next = 0;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00570}00570         cest.period = ((1ULL << 63) / tc-\/>tc\_frequency) << 1;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00571}00571         cest.errb\_abs = 0;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00572}00572         cest.errb\_rate = 0;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00573}00573         cest.status = FFCLOCK\_STA\_UNSYNC;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00574}00574         cest.leapsec\_total = 0;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00575}00575         cest.leapsec = 0;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00576}00576 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00577}00577         mtx\_lock(\&ffclock\_mtx);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00578}00578         bcopy(\&cest, \&ffclock\_estimate, \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} ffclock\_estimate));}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00579}00579         ffclock\_updated = INT8\_MAX;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00580}00580         mtx\_unlock(\&ffclock\_mtx);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00581}00581 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00582}00582         \mbox{\hyperlink{subr__prf_8c_a55f3d956bb2ba20b5059e9e25484a47f}{printf}}(\textcolor{stringliteral}{"{}ffclock reset: \%s (\%llu Hz), time = \%ld.\%09lu\(\backslash\)n"{}}, tc-\/>tc\_name,}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00583}00583             (\textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{long} \textcolor{keywordtype}{long})tc-\/>tc\_frequency, (\textcolor{keywordtype}{long})\mbox{\hyperlink{clock__if_8m_a919cc4bfd342c5574101ab9d56c4092a}{ts}}-\/>tv\_sec,}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00584}00584             (\textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{long})\mbox{\hyperlink{clock__if_8m_a919cc4bfd342c5574101ab9d56c4092a}{ts}}-\/>tv\_nsec);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00585}00585 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00586}00586 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00587}00587 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00588}00588 \textcolor{comment}{ * Sub-\/routine to convert a time interval measured in RAW counter units to time}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00589}00589 \textcolor{comment}{ * in seconds stored in bintime format.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00590}00590 \textcolor{comment}{ * NOTE: bintime\_mul requires u\_int, but the value of the ffcounter may be}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00591}00591 \textcolor{comment}{ * larger than the max value of u\_int (on 32 bit architecture). Loop to consume}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00592}00592 \textcolor{comment}{ * extra cycles.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00593}00593 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00594}00594 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00595}00595 ffclock\_convert\_delta(ffcounter ffdelta, uint64\_t period, \textcolor{keyword}{struct} \mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} *\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}})}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00596}00596 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00597}00597         \textcolor{keyword}{struct }\mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} bt2;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00598}00598         ffcounter delta, delta\_max;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00599}00599 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00600}00600         delta\_max = (1ULL << (8 * \textcolor{keyword}{sizeof}(\textcolor{keywordtype}{unsigned} int))) -\/ 1;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00601}00601         bintime\_clear(\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00602}00602         \textcolor{keywordflow}{do} \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00603}00603                 \textcolor{keywordflow}{if} (ffdelta > delta\_max)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00604}00604                         delta = delta\_max;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00605}00605                 \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00606}00606                         delta = ffdelta;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00607}00607                 bt2.sec = 0;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00608}00608                 bt2.frac = period;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00609}00609                 bintime\_mul(\&bt2, (\textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int})delta);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00610}00610                 bintime\_add(\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, \&bt2);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00611}00611                 ffdelta -\/= delta;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00612}00612         \} \textcolor{keywordflow}{while} (ffdelta > 0);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00613}00613 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00614}00614 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00615}00615 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00616}00616 \textcolor{comment}{ * Update the fftimehands.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00617}00617 \textcolor{comment}{ * Push the tick ffcount and time(s) forward based on current clock estimate.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00618}00618 \textcolor{comment}{ * The conversion from ffcounter to bintime relies on the difference clock}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00619}00619 \textcolor{comment}{ * principle, whose accuracy relies on computing small time intervals. If a new}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00620}00620 \textcolor{comment}{ * clock estimate has been passed by the synchronisation daemon, make it}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00621}00621 \textcolor{comment}{ * current, and compute the linear interpolation for monotonic time if needed.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00622}00622 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00623}00623 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00624}00624 ffclock\_windup(\textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} delta)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00625}00625 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00626}00626         \textcolor{keyword}{struct }ffclock\_estimate *cest;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00627}00627         \textcolor{keyword}{struct }fftimehands *ffth;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00628}00628         \textcolor{keyword}{struct }\mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} \mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, gap\_lerp;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00629}00629         ffcounter ffdelta;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00630}00630         uint64\_t frac;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00631}00631         \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} polling;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00632}00632         uint8\_t forward\_jump, ogen;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00633}00633 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00634}00634         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00635}00635 \textcolor{comment}{         * Pick the next timehand, copy current ffclock estimates and move tick}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00636}00636 \textcolor{comment}{         * times and counter forward.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00637}00637 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00638}00638         forward\_jump = 0;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00639}00639         ffth = fftimehands-\/>next;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00640}00640         ogen = ffth-\/>gen;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00641}00641         ffth-\/>gen = 0;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00642}00642         cest = \&ffth-\/>cest;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00643}00643         bcopy(\&fftimehands-\/>cest, cest, \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} ffclock\_estimate));}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00644}00644         ffdelta = (ffcounter)delta;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00645}00645         ffth-\/>period\_lerp = fftimehands-\/>period\_lerp;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00646}00646 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00647}00647         ffth-\/>tick\_time = fftimehands-\/>tick\_time;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00648}00648         ffclock\_convert\_delta(ffdelta, cest-\/>period, \&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00649}00649         bintime\_add(\&ffth-\/>tick\_time, \&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00650}00650 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00651}00651         ffth-\/>tick\_time\_lerp = fftimehands-\/>tick\_time\_lerp;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00652}00652         ffclock\_convert\_delta(ffdelta, ffth-\/>period\_lerp, \&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00653}00653         bintime\_add(\&ffth-\/>tick\_time\_lerp, \&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00654}00654 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00655}00655         ffth-\/>tick\_ffcount = fftimehands-\/>tick\_ffcount + ffdelta;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00656}00656 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00657}00657         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00658}00658 \textcolor{comment}{         * Assess the status of the clock, if the last update is too old, it is}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00659}00659 \textcolor{comment}{         * likely the synchronisation daemon is dead and the clock is free}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00660}00660 \textcolor{comment}{         * running.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00661}00661 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00662}00662         \textcolor{keywordflow}{if} (ffclock\_updated == 0) \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00663}00663                 ffdelta = ffth-\/>tick\_ffcount -\/ cest-\/>update\_ffcount;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00664}00664                 ffclock\_convert\_delta(ffdelta, cest-\/>period, \&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00665}00665                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}.sec > 2 * FFCLOCK\_SKM\_SCALE)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00666}00666                         ffclock\_status |= FFCLOCK\_STA\_UNSYNC;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00667}00667         \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00668}00668 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00669}00669         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00670}00670 \textcolor{comment}{         * If available, grab updated clock estimates and make them current.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00671}00671 \textcolor{comment}{         * Recompute time at this tick using the updated estimates. The clock}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00672}00672 \textcolor{comment}{         * estimates passed the feed-\/forward synchronisation daemon may result}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00673}00673 \textcolor{comment}{         * in time conversion that is not monotonically increasing (just after}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00674}00674 \textcolor{comment}{         * the update). time\_lerp is a particular linear interpolation over the}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00675}00675 \textcolor{comment}{         * synchronisation algo polling period that ensures monotonicity for the}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00676}00676 \textcolor{comment}{         * clock ids requesting it.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00677}00677 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00678}00678         \textcolor{keywordflow}{if} (ffclock\_updated > 0) \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00679}00679                 bcopy(\&ffclock\_estimate, cest, \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} ffclock\_estimate));}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00680}00680                 ffdelta = ffth-\/>tick\_ffcount -\/ cest-\/>update\_ffcount;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00681}00681                 ffth-\/>tick\_time = cest-\/>update\_time;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00682}00682                 ffclock\_convert\_delta(ffdelta, cest-\/>period, \&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00683}00683                 bintime\_add(\&ffth-\/>tick\_time, \&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00684}00684 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00685}00685                 \textcolor{comment}{/* ffclock\_reset sets ffclock\_updated to INT8\_MAX */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00686}00686                 \textcolor{keywordflow}{if} (ffclock\_updated == INT8\_MAX)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00687}00687                         ffth-\/>tick\_time\_lerp = ffth-\/>tick\_time;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00688}00688 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00689}00689                 \textcolor{keywordflow}{if} (bintime\_cmp(\&ffth-\/>tick\_time, \&ffth-\/>tick\_time\_lerp, >))}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00690}00690                         forward\_jump = 1;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00691}00691                 \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00692}00692                         forward\_jump = 0;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00693}00693 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00694}00694                 bintime\_clear(\&gap\_lerp);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00695}00695                 \textcolor{keywordflow}{if} (forward\_jump) \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00696}00696                         gap\_lerp = ffth-\/>tick\_time;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00697}00697                         bintime\_sub(\&gap\_lerp, \&ffth-\/>tick\_time\_lerp);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00698}00698                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00699}00699                         gap\_lerp = ffth-\/>tick\_time\_lerp;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00700}00700                         bintime\_sub(\&gap\_lerp, \&ffth-\/>tick\_time);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00701}00701                 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00702}00702 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00703}00703                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00704}00704 \textcolor{comment}{                 * The reset from the RTC clock may be far from accurate, and}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00705}00705 \textcolor{comment}{                 * reducing the gap between real time and interpolated time}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00706}00706 \textcolor{comment}{                 * could take a very long time if the interpolated clock insists}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00707}00707 \textcolor{comment}{                 * on strict monotonicity. The clock is reset under very strict}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00708}00708 \textcolor{comment}{                 * conditions (kernel time is known to be wrong and}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00709}00709 \textcolor{comment}{                 * synchronization daemon has been restarted recently.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00710}00710 \textcolor{comment}{                 * ffclock\_boottime absorbs the jump to ensure boot time is}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00711}00711 \textcolor{comment}{                 * correct and uptime functions stay consistent.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00712}00712 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00713}00713                 \textcolor{keywordflow}{if} (((ffclock\_status \& FFCLOCK\_STA\_UNSYNC) == FFCLOCK\_STA\_UNSYNC) \&\&}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00714}00714                     ((cest-\/>status \& FFCLOCK\_STA\_UNSYNC) == 0) \&\&}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00715}00715                     ((cest-\/>status \& FFCLOCK\_STA\_WARMUP) == FFCLOCK\_STA\_WARMUP)) \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00716}00716                         \textcolor{keywordflow}{if} (forward\_jump)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00717}00717                                 bintime\_add(\&ffclock\_boottime, \&gap\_lerp);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00718}00718                         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00719}00719                                 bintime\_sub(\&ffclock\_boottime, \&gap\_lerp);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00720}00720                         ffth-\/>tick\_time\_lerp = ffth-\/>tick\_time;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00721}00721                         bintime\_clear(\&gap\_lerp);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00722}00722                 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00723}00723 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00724}00724                 ffclock\_status = cest-\/>status;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00725}00725                 ffth-\/>period\_lerp = cest-\/>period;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00726}00726 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00727}00727                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00728}00728 \textcolor{comment}{                 * Compute corrected period used for the linear interpolation of}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00729}00729 \textcolor{comment}{                 * time. The rate of linear interpolation is capped to 5000PPM}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00730}00730 \textcolor{comment}{                 * (5ms/s).}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00731}00731 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00732}00732                 \textcolor{keywordflow}{if} (bintime\_isset(\&gap\_lerp)) \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00733}00733                         ffdelta = cest-\/>update\_ffcount;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00734}00734                         ffdelta -\/= fftimehands-\/>cest.update\_ffcount;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00735}00735                         ffclock\_convert\_delta(ffdelta, cest-\/>period, \&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00736}00736                         polling = \mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}.sec;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00737}00737                         \mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}.sec = 0;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00738}00738                         \mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}.frac = 5000000 * (uint64\_t)18446744073LL;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00739}00739                         bintime\_mul(\&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, polling);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00740}00740                         \textcolor{keywordflow}{if} (bintime\_cmp(\&gap\_lerp, \&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, >))}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00741}00741                                 gap\_lerp = \mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00742}00742 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00743}00743                         \textcolor{comment}{/* Approximate 1 sec by 1-\/(1/2\string^64) to ease arithmetic */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00744}00744                         frac = 0;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00745}00745                         \textcolor{keywordflow}{if} (gap\_lerp.sec > 0) \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00746}00746                                 frac -\/= 1;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00747}00747                                 frac /= ffdelta / gap\_lerp.sec;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00748}00748                         \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00749}00749                         frac += gap\_lerp.frac / ffdelta;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00750}00750 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00751}00751                         \textcolor{keywordflow}{if} (forward\_jump)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00752}00752                                 ffth-\/>period\_lerp += frac;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00753}00753                         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00754}00754                                 ffth-\/>period\_lerp -\/= frac;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00755}00755                 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00756}00756 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00757}00757                 ffclock\_updated = 0;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00758}00758         \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00759}00759         \textcolor{keywordflow}{if} (++ogen == 0)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00760}00760                 ogen = 1;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00761}00761         ffth-\/>gen = ogen;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00762}00762         fftimehands = ffth;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00763}00763 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00764}00764 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00765}00765 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00766}00766 \textcolor{comment}{ * Adjust the fftimehands when the timecounter is changed. Stating the obvious,}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00767}00767 \textcolor{comment}{ * the old and new hardware counter cannot be read simultaneously. tc\_windup()}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00768}00768 \textcolor{comment}{ * does read the two counters 'back to back', but a few cycles are effectively}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00769}00769 \textcolor{comment}{ * lost, and not accumulated in tick\_ffcount. This is a fairly radical}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00770}00770 \textcolor{comment}{ * operation for a feed-\/forward synchronization daemon, and it is its job to not}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00771}00771 \textcolor{comment}{ * pushing irrelevant data to the kernel. Because there is no locking here,}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00772}00772 \textcolor{comment}{ * simply force to ignore pending or next update to give daemon a chance to}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00773}00773 \textcolor{comment}{ * realize the counter has changed.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00774}00774 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00775}00775 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00776}00776 ffclock\_change\_tc(\textcolor{keyword}{struct} \mbox{\hyperlink{structtimehands}{timehands}} *th)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00777}00777 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00778}00778         \textcolor{keyword}{struct }fftimehands *ffth;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00779}00779         \textcolor{keyword}{struct }ffclock\_estimate *cest;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00780}00780         \textcolor{keyword}{struct }\mbox{\hyperlink{kern__tc_8c_a35098fc91b751950a191213b1c2e5853}{timecounter}} *tc;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00781}00781         uint8\_t ogen;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00782}00782 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00783}00783         tc = th-\/>\mbox{\hyperlink{structtimehands_a6e873b4aa6fa46eaad2c2b7199ed7555}{th\_counter}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00784}00784         ffth = fftimehands-\/>next;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00785}00785         ogen = ffth-\/>gen;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00786}00786         ffth-\/>gen = 0;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00787}00787 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00788}00788         cest = \&ffth-\/>cest;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00789}00789         bcopy(\&(fftimehands-\/>cest), cest, \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} ffclock\_estimate));}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00790}00790         cest-\/>period = ((1ULL << 63) / tc-\/>tc\_frequency ) << 1;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00791}00791         cest-\/>errb\_abs = 0;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00792}00792         cest-\/>errb\_rate = 0;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00793}00793         cest-\/>status |= FFCLOCK\_STA\_UNSYNC;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00794}00794 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00795}00795         ffth-\/>tick\_ffcount = fftimehands-\/>tick\_ffcount;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00796}00796         ffth-\/>tick\_time\_lerp = fftimehands-\/>tick\_time\_lerp;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00797}00797         ffth-\/>tick\_time = fftimehands-\/>tick\_time;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00798}00798         ffth-\/>period\_lerp = cest-\/>period;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00799}00799 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00800}00800         \textcolor{comment}{/* Do not lock but ignore next update from synchronization daemon. */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00801}00801         ffclock\_updated-\/-\/;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00802}00802 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00803}00803         \textcolor{keywordflow}{if} (++ogen == 0)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00804}00804                 ogen = 1;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00805}00805         ffth-\/>gen = ogen;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00806}00806         fftimehands = ffth;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00807}00807 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00808}00808 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00809}00809 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00810}00810 \textcolor{comment}{ * Retrieve feed-\/forward counter and time of last kernel tick.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00811}00811 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00812}00812 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00813}00813 ffclock\_last\_tick(ffcounter *ffcount, \textcolor{keyword}{struct} \mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} *\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, uint32\_t \mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}})}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00814}00814 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00815}00815         \textcolor{keyword}{struct }fftimehands *ffth;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00816}00816         uint8\_t gen;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00817}00817 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00818}00818         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00819}00819 \textcolor{comment}{         * No locking but check generation has not changed. Also need to make}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00820}00820 \textcolor{comment}{         * sure ffdelta is positive, i.e. ffcount > tick\_ffcount.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00821}00821 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00822}00822         \textcolor{keywordflow}{do} \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00823}00823                 ffth = fftimehands;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00824}00824                 gen = ffth-\/>gen;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00825}00825                 \textcolor{keywordflow}{if} ((\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& FFCLOCK\_LERP) == FFCLOCK\_LERP)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00826}00826                         *\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}} = ffth-\/>tick\_time\_lerp;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00827}00827                 \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00828}00828                         *\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}} = ffth-\/>tick\_time;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00829}00829                 *ffcount = ffth-\/>tick\_ffcount;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00830}00830         \} \textcolor{keywordflow}{while} (gen == 0 || gen != ffth-\/>gen);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00831}00831 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00832}00832 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00833}00833 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00834}00834 \textcolor{comment}{ * Absolute clock conversion. Low level function to convert ffcounter to}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00835}00835 \textcolor{comment}{ * bintime. The ffcounter is converted using the current ffclock period estimate}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00836}00836 \textcolor{comment}{ * or the "{}interpolated period"{} to ensure monotonicity.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00837}00837 \textcolor{comment}{ * NOTE: this conversion may have been deferred, and the clock updated since the}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00838}00838 \textcolor{comment}{ * hardware counter has been read.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00839}00839 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00840}00840 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00841}00841 ffclock\_convert\_abs(ffcounter ffcount, \textcolor{keyword}{struct} \mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} *\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, uint32\_t \mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}})}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00842}00842 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00843}00843         \textcolor{keyword}{struct }fftimehands *ffth;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00844}00844         \textcolor{keyword}{struct }\mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} bt2;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00845}00845         ffcounter ffdelta;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00846}00846         uint8\_t gen;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00847}00847 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00848}00848         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00849}00849 \textcolor{comment}{         * No locking but check generation has not changed. Also need to make}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00850}00850 \textcolor{comment}{         * sure ffdelta is positive, i.e. ffcount > tick\_ffcount.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00851}00851 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00852}00852         \textcolor{keywordflow}{do} \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00853}00853                 ffth = fftimehands;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00854}00854                 gen = ffth-\/>gen;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00855}00855                 \textcolor{keywordflow}{if} (ffcount > ffth-\/>tick\_ffcount)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00856}00856                         ffdelta = ffcount -\/ ffth-\/>tick\_ffcount;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00857}00857                 \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00858}00858                         ffdelta = ffth-\/>tick\_ffcount -\/ ffcount;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00859}00859 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00860}00860                 \textcolor{keywordflow}{if} ((\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& FFCLOCK\_LERP) == FFCLOCK\_LERP) \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00861}00861                         *\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}} = ffth-\/>tick\_time\_lerp;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00862}00862                         ffclock\_convert\_delta(ffdelta, ffth-\/>period\_lerp, \&bt2);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00863}00863                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00864}00864                         *\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}} = ffth-\/>tick\_time;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00865}00865                         ffclock\_convert\_delta(ffdelta, ffth-\/>cest.period, \&bt2);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00866}00866                 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00867}00867 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00868}00868                 \textcolor{keywordflow}{if} (ffcount > ffth-\/>tick\_ffcount)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00869}00869                         bintime\_add(\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, \&bt2);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00870}00870                 \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00871}00871                         bintime\_sub(\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, \&bt2);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00872}00872         \} \textcolor{keywordflow}{while} (gen == 0 || gen != ffth-\/>gen);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00873}00873 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00874}00874 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00875}00875 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00876}00876 \textcolor{comment}{ * Difference clock conversion.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00877}00877 \textcolor{comment}{ * Low level function to Convert a time interval measured in RAW counter units}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00878}00878 \textcolor{comment}{ * into bintime. The difference clock allows measuring small intervals much more}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00879}00879 \textcolor{comment}{ * reliably than the absolute clock.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00880}00880 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00881}00881 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00882}00882 ffclock\_convert\_diff(ffcounter ffdelta, \textcolor{keyword}{struct} \mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} *\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}})}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00883}00883 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00884}00884         \textcolor{keyword}{struct }fftimehands *ffth;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00885}00885         uint8\_t gen;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00886}00886 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00887}00887         \textcolor{comment}{/* No locking but check generation has not changed. */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00888}00888         \textcolor{keywordflow}{do} \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00889}00889                 ffth = fftimehands;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00890}00890                 gen = ffth-\/>gen;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00891}00891                 ffclock\_convert\_delta(ffdelta, ffth-\/>cest.period, \mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00892}00892         \} \textcolor{keywordflow}{while} (gen == 0 || gen != ffth-\/>gen);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00893}00893 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00894}00894 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00895}00895 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00896}00896 \textcolor{comment}{ * Access to current ffcounter value.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00897}00897 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00898}00898 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00899}00899 ffclock\_read\_counter(ffcounter *ffcount)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00900}00900 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00901}00901         \textcolor{keyword}{struct }\mbox{\hyperlink{structtimehands}{timehands}} *th;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00902}00902         \textcolor{keyword}{struct }fftimehands *ffth;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00903}00903         \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} gen, delta;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00904}00904 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00905}00905         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00906}00906 \textcolor{comment}{         * ffclock\_windup() called from tc\_windup(), safe to rely on}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00907}00907 \textcolor{comment}{         * th-\/>th\_generation only, for correct delta and ffcounter.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00908}00908 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00909}00909         \textcolor{keywordflow}{do} \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00910}00910                 th = \mbox{\hyperlink{kern__tc_8c_a90f582e4036774428020fe41210fd9cd}{timehands}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00911}00911                 gen = atomic\_load\_acq\_int(\&th-\/>\mbox{\hyperlink{structtimehands_a759f4ac823300fac1fb4b8f8108459d8}{th\_generation}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00912}00912                 ffth = fftimehands;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00913}00913                 delta = \mbox{\hyperlink{kern__tc_8c_a9f364f93dac9a6972f68cd9e6449d971}{tc\_delta}}(th);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00914}00914                 *ffcount = ffth-\/>tick\_ffcount;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00915}00915                 atomic\_thread\_fence\_acq();}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00916}00916         \} \textcolor{keywordflow}{while} (gen == 0 || gen != th-\/>\mbox{\hyperlink{structtimehands_a759f4ac823300fac1fb4b8f8108459d8}{th\_generation}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00917}00917 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00918}00918         *ffcount += delta;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00919}00919 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00920}00920 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00921}00921 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00922}00922 \mbox{\hyperlink{kern__tc_8c_a8ec04a6cda605cfc3cebfbd49e5ece3e}{binuptime}}(\textcolor{keyword}{struct} \mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} *\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}})}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00923}00923 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00924}00924 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00925}00925         binuptime\_fromclock(\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, \mbox{\hyperlink{kern__tc_8c_ad1f583c39d0019f4a95092ce94a4c677}{sysclock\_active}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00926}00926 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00927}00927 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00928}00928 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00929}00929 \mbox{\hyperlink{kern__tc_8c_a3e18bf3ba0f838bb89fc66ecbfff9cb4}{nanouptime}}(\textcolor{keyword}{struct} timespec *tsp)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00930}00930 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00931}00931 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00932}00932         nanouptime\_fromclock(tsp, \mbox{\hyperlink{kern__tc_8c_ad1f583c39d0019f4a95092ce94a4c677}{sysclock\_active}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00933}00933 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00934}00934 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00935}00935 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00936}00936 \mbox{\hyperlink{kern__tc_8c_ad2ee9cc3eb46aca2703cc3c5945c6c2d}{microuptime}}(\textcolor{keyword}{struct} timeval *tvp)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00937}00937 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00938}00938 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00939}00939         microuptime\_fromclock(tvp, \mbox{\hyperlink{kern__tc_8c_ad1f583c39d0019f4a95092ce94a4c677}{sysclock\_active}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00940}00940 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00941}00941 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00942}00942 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00943}00943 \mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}}(\textcolor{keyword}{struct} \mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} *\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}})}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00944}00944 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00945}00945 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00946}00946         bintime\_fromclock(\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, \mbox{\hyperlink{kern__tc_8c_ad1f583c39d0019f4a95092ce94a4c677}{sysclock\_active}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00947}00947 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00948}00948 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00949}00949 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00950}00950 \mbox{\hyperlink{kern__tc_8c_af53cad09abe604da7bf227343569b0e4}{nanotime}}(\textcolor{keyword}{struct} timespec *tsp)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00951}00951 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00952}00952 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00953}00953         nanotime\_fromclock(tsp, \mbox{\hyperlink{kern__tc_8c_ad1f583c39d0019f4a95092ce94a4c677}{sysclock\_active}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00954}00954 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00955}00955 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00956}00956 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00957}00957 \mbox{\hyperlink{kern__tc_8c_ad01043987c883e8e248bc36c6a9fb200}{microtime}}(\textcolor{keyword}{struct} timeval *tvp)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00958}00958 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00959}00959 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00960}00960         microtime\_fromclock(tvp, \mbox{\hyperlink{kern__tc_8c_ad1f583c39d0019f4a95092ce94a4c677}{sysclock\_active}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00961}00961 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00962}00962 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00963}00963 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00964}00964 \mbox{\hyperlink{kern__tc_8c_a318fd9f982a1e77dedca21fc5d321ebb}{getbinuptime}}(\textcolor{keyword}{struct} \mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} *\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}})}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00965}00965 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00966}00966 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00967}00967         getbinuptime\_fromclock(\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, \mbox{\hyperlink{kern__tc_8c_ad1f583c39d0019f4a95092ce94a4c677}{sysclock\_active}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00968}00968 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00969}00969 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00970}00970 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00971}00971 \mbox{\hyperlink{kern__tc_8c_a72625f715f1ac2c44b7f54d2aa5771a6}{getnanouptime}}(\textcolor{keyword}{struct} timespec *tsp)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00972}00972 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00973}00973 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00974}00974         getnanouptime\_fromclock(tsp, \mbox{\hyperlink{kern__tc_8c_ad1f583c39d0019f4a95092ce94a4c677}{sysclock\_active}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00975}00975 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00976}00976 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00977}00977 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00978}00978 \mbox{\hyperlink{kern__tc_8c_abadefbffd93a8bdafb42e027ba3e79cc}{getmicrouptime}}(\textcolor{keyword}{struct} timeval *tvp)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00979}00979 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00980}00980 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00981}00981         getmicrouptime\_fromclock(tvp, \mbox{\hyperlink{kern__tc_8c_ad1f583c39d0019f4a95092ce94a4c677}{sysclock\_active}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00982}00982 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00983}00983 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00984}00984 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00985}00985 \mbox{\hyperlink{kern__tc_8c_ac6bc418452e03039f3b2d959d9100519}{getbintime}}(\textcolor{keyword}{struct} \mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} *\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}})}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00986}00986 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00987}00987 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00988}00988         getbintime\_fromclock(\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, \mbox{\hyperlink{kern__tc_8c_ad1f583c39d0019f4a95092ce94a4c677}{sysclock\_active}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00989}00989 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00990}00990 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00991}00991 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00992}00992 \mbox{\hyperlink{kern__tc_8c_acf14beeb98d876bad86da88a91370dea}{getnanotime}}(\textcolor{keyword}{struct} timespec *tsp)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00993}00993 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00994}00994 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00995}00995         getnanotime\_fromclock(tsp, \mbox{\hyperlink{kern__tc_8c_ad1f583c39d0019f4a95092ce94a4c677}{sysclock\_active}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00996}00996 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00997}00997 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00998}00998 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l00999}00999 \mbox{\hyperlink{kern__tc_8c_afa0a7beb7cab706ffb16c48c8694e3c6}{getmicrotime}}(\textcolor{keyword}{struct} timeval *tvp)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01000}01000 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01001}01001 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01002}01002         getmicrouptime\_fromclock(tvp, \mbox{\hyperlink{kern__tc_8c_ad1f583c39d0019f4a95092ce94a4c677}{sysclock\_active}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01003}01003 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01004}01004 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01005}01005 \textcolor{preprocessor}{\#endif }\textcolor{comment}{/* FFCLOCK */}\textcolor{preprocessor}{}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01006}01006 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01007}01007 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01008}01008 \textcolor{comment}{ * This is a clone of getnanotime and used for walltimestamps.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01009}01009 \textcolor{comment}{ * The dtrace\_ prefix prevents fbt from creating probes for}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01010}01010 \textcolor{comment}{ * it so walltimestamp can be safely used in all fbt probes.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01011}01011 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01012}01012 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01013}\mbox{\hyperlink{kern__tc_8c_a35753be524f85e82e9358662261b98c1}{01013}} \mbox{\hyperlink{kern__tc_8c_a35753be524f85e82e9358662261b98c1}{dtrace\_getnanotime}}(\textcolor{keyword}{struct} timespec *tsp)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01014}01014 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01015}01015 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01016}01016         \mbox{\hyperlink{kern__tc_8c_a4a19274b449ffcd79400ff5b3980a2b2}{GETTHMEMBER}}(tsp, th\_nanotime);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01017}01017 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01018}01018 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01019}01019 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01020}01020 \textcolor{comment}{ * This is a clone of getnanouptime used for time since boot.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01021}01021 \textcolor{comment}{ * The dtrace\_ prefix prevents fbt from creating probes for}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01022}01022 \textcolor{comment}{ * it so an uptime that can be safely used in all fbt probes.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01023}01023 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01024}01024 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01025}\mbox{\hyperlink{kern__tc_8c_a635a7118ebe20b1e6ef057a9b2fb472d}{01025}} \mbox{\hyperlink{kern__tc_8c_a635a7118ebe20b1e6ef057a9b2fb472d}{dtrace\_getnanouptime}}(\textcolor{keyword}{struct} timespec *tsp)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01026}01026 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01027}01027         \textcolor{keyword}{struct }\mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} \mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01028}01028 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01029}01029         \mbox{\hyperlink{kern__tc_8c_a4a19274b449ffcd79400ff5b3980a2b2}{GETTHMEMBER}}(\&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, th\_offset);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01030}01030         bintime2timespec(\&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, tsp);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01031}01031 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01032}01032 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01033}01033 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01034}01034 \textcolor{comment}{ * System clock currently providing time to the system. Modifiable via sysctl}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01035}01035 \textcolor{comment}{ * when the FFCLOCK option is defined.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01036}01036 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01037}\mbox{\hyperlink{kern__tc_8c_ad1f583c39d0019f4a95092ce94a4c677}{01037}} \textcolor{keywordtype}{int} \mbox{\hyperlink{kern__tc_8c_ad1f583c39d0019f4a95092ce94a4c677}{sysclock\_active}} = SYSCLOCK\_FBCK;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01038}01038 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01039}01039 \textcolor{comment}{/* Internal NTP status and error estimates. */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01040}01040 \textcolor{keyword}{extern} \textcolor{keywordtype}{int} \mbox{\hyperlink{kern__tc_8c_a1387c2cbd88d9b1b5e7fe377a0e0fda3}{time\_status}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01041}01041 \textcolor{keyword}{extern} \textcolor{keywordtype}{long} \mbox{\hyperlink{kern__tc_8c_a4167e6b6f205ac2d14ba323c4cf67fc3}{time\_esterror}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01042}01042 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01043}01043 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01044}01044 \textcolor{comment}{ * Take a snapshot of sysclock data which can be used to compare system clocks}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01045}01045 \textcolor{comment}{ * and generate timestamps after the fact.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01046}01046 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01047}01047 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01048}\mbox{\hyperlink{kern__tc_8c_a62713303622efb518253bdaa35e63ec3}{01048}} \mbox{\hyperlink{kern__tc_8c_a62713303622efb518253bdaa35e63ec3}{sysclock\_getsnapshot}}(\textcolor{keyword}{struct} sysclock\_snap *clock\_snap, \textcolor{keywordtype}{int} fast)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01049}01049 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01050}01050         \textcolor{keyword}{struct }fbclock\_info *fbi;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01051}01051         \textcolor{keyword}{struct }\mbox{\hyperlink{structtimehands}{timehands}} *th;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01052}01052         \textcolor{keyword}{struct }\mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} \mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01053}01053         \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} delta, gen;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01054}01054 \textcolor{preprocessor}{\#ifdef FFCLOCK}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01055}01055         ffcounter ffcount;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01056}01056         \textcolor{keyword}{struct }fftimehands *ffth;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01057}01057         \textcolor{keyword}{struct }ffclock\_info *ffi;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01058}01058         \textcolor{keyword}{struct }ffclock\_estimate cest;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01059}01059 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01060}01060         ffi = \&clock\_snap-\/>ff\_info;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01061}01061 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01062}01062 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01063}01063         fbi = \&clock\_snap-\/>fb\_info;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01064}01064         delta = 0;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01065}01065 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01066}01066         \textcolor{keywordflow}{do} \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01067}01067                 th = \mbox{\hyperlink{kern__tc_8c_a90f582e4036774428020fe41210fd9cd}{timehands}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01068}01068                 gen = atomic\_load\_acq\_int(\&th-\/>\mbox{\hyperlink{structtimehands_a759f4ac823300fac1fb4b8f8108459d8}{th\_generation}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01069}01069                 fbi-\/>th\_scale = th-\/>\mbox{\hyperlink{structtimehands_a4b079bb7849db9a6ea3abf069ad8905a}{th\_scale}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01070}01070                 fbi-\/>tick\_time = th-\/>\mbox{\hyperlink{structtimehands_a8343df3d16d957ac6054336b6304d494}{th\_offset}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01071}01071 \textcolor{preprocessor}{\#ifdef FFCLOCK}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01072}01072                 ffth = fftimehands;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01073}01073                 ffi-\/>tick\_time = ffth-\/>tick\_time\_lerp;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01074}01074                 ffi-\/>tick\_time\_lerp = ffth-\/>tick\_time\_lerp;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01075}01075                 ffi-\/>period = ffth-\/>cest.period;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01076}01076                 ffi-\/>period\_lerp = ffth-\/>period\_lerp;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01077}01077                 clock\_snap-\/>ffcount = ffth-\/>tick\_ffcount;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01078}01078                 cest = ffth-\/>cest;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01079}01079 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01080}01080                 \textcolor{keywordflow}{if} (!fast)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01081}01081                         delta = \mbox{\hyperlink{kern__tc_8c_a9f364f93dac9a6972f68cd9e6449d971}{tc\_delta}}(th);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01082}01082                 atomic\_thread\_fence\_acq();}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01083}01083         \} \textcolor{keywordflow}{while} (gen == 0 || gen != th-\/>\mbox{\hyperlink{structtimehands_a759f4ac823300fac1fb4b8f8108459d8}{th\_generation}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01084}01084 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01085}01085         clock\_snap-\/>delta = delta;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01086}01086         clock\_snap-\/>sysclock\_active = \mbox{\hyperlink{kern__tc_8c_ad1f583c39d0019f4a95092ce94a4c677}{sysclock\_active}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01087}01087 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01088}01088         \textcolor{comment}{/* Record feedback clock status and error. */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01089}01089         clock\_snap-\/>fb\_info.status = \mbox{\hyperlink{kern__tc_8c_a1387c2cbd88d9b1b5e7fe377a0e0fda3}{time\_status}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01090}01090         \textcolor{comment}{/* XXX: Very crude estimate of feedback clock error. */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01091}01091         \mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}.sec = \mbox{\hyperlink{kern__tc_8c_a4167e6b6f205ac2d14ba323c4cf67fc3}{time\_esterror}} / 1000000;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01092}01092         \mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}.frac = ((\mbox{\hyperlink{kern__tc_8c_a4167e6b6f205ac2d14ba323c4cf67fc3}{time\_esterror}} -\/ \mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}.sec) * 1000000) *}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01093}01093             (uint64\_t)18446744073709ULL;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01094}01094         clock\_snap-\/>fb\_info.error = \mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01095}01095 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01096}01096 \textcolor{preprocessor}{\#ifdef FFCLOCK}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01097}01097         \textcolor{keywordflow}{if} (!fast)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01098}01098                 clock\_snap-\/>ffcount += delta;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01099}01099 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01100}01100         \textcolor{comment}{/* Record feed-\/forward clock leap second adjustment. */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01101}01101         ffi-\/>leapsec\_adjustment = cest.leapsec\_total;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01102}01102         \textcolor{keywordflow}{if} (clock\_snap-\/>ffcount > cest.leapsec\_next)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01103}01103                 ffi-\/>leapsec\_adjustment -\/= cest.leapsec;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01104}01104 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01105}01105         \textcolor{comment}{/* Record feed-\/forward clock status and error. */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01106}01106         clock\_snap-\/>ff\_info.status = cest.status;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01107}01107         ffcount = clock\_snap-\/>ffcount -\/ cest.update\_ffcount;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01108}01108         ffclock\_convert\_delta(ffcount, cest.period, \&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01109}01109         \textcolor{comment}{/* 18446744073709 = int(2\string^64/1e12), err\_bound\_rate in [ps/s]. */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01110}01110         bintime\_mul(\&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, cest.errb\_rate * (uint64\_t)18446744073709ULL);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01111}01111         \textcolor{comment}{/* 18446744073 = int(2\string^64 / 1e9), since err\_abs in [ns]. */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01112}01112         bintime\_addx(\&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, cest.errb\_abs * (uint64\_t)18446744073ULL);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01113}01113         clock\_snap-\/>ff\_info.error = \mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01114}01114 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01115}01115 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01116}01116 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01117}01117 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01118}01118 \textcolor{comment}{ * Convert a sysclock snapshot into a struct bintime based on the specified}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01119}01119 \textcolor{comment}{ * clock source and flags.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01120}01120 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01121}01121 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01122}\mbox{\hyperlink{kern__tc_8c_a29150aa5df37099629d9abb621077dbc}{01122}} \mbox{\hyperlink{kern__tc_8c_a29150aa5df37099629d9abb621077dbc}{sysclock\_snap2bintime}}(\textcolor{keyword}{struct} sysclock\_snap *cs, \textcolor{keyword}{struct} \mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} *\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}},}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01123}01123     \textcolor{keywordtype}{int} whichclock, uint32\_t \mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}})}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01124}01124 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01125}01125         \textcolor{keyword}{struct }\mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} boottimebin;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01126}01126 \textcolor{preprocessor}{\#ifdef FFCLOCK}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01127}01127         \textcolor{keyword}{struct }\mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} bt2;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01128}01128         uint64\_t period;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01129}01129 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01130}01130 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01131}01131         \textcolor{keywordflow}{switch} (whichclock) \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01132}01132         \textcolor{keywordflow}{case} SYSCLOCK\_FBCK:}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01133}01133                 *\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}} = cs-\/>fb\_info.tick\_time;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01134}01134 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01135}01135                 \textcolor{comment}{/* If snapshot was created with !fast, delta will be >0. */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01136}01136                 \textcolor{keywordflow}{if} (cs-\/>delta > 0)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01137}01137                         bintime\_addx(\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, cs-\/>fb\_info.th\_scale * cs-\/>delta);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01138}01138 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01139}01139                 \textcolor{keywordflow}{if} ((\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& FBCLOCK\_UPTIME) == 0) \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01140}01140                         \mbox{\hyperlink{kern__tc_8c_a405c56b4e142038fb3d2c072a964ee50}{getboottimebin}}(\&boottimebin);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01141}01141                         bintime\_add(\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, \&boottimebin);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01142}01142                 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01143}01143                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01144}01144 \textcolor{preprocessor}{\#ifdef FFCLOCK}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01145}01145         \textcolor{keywordflow}{case} SYSCLOCK\_FFWD:}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01146}01146                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& FFCLOCK\_LERP) \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01147}01147                         *\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}} = cs-\/>ff\_info.tick\_time\_lerp;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01148}01148                         period = cs-\/>ff\_info.period\_lerp;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01149}01149                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01150}01150                         *\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}} = cs-\/>ff\_info.tick\_time;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01151}01151                         period = cs-\/>ff\_info.period;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01152}01152                 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01153}01153 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01154}01154                 \textcolor{comment}{/* If snapshot was created with !fast, delta will be >0. */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01155}01155                 \textcolor{keywordflow}{if} (cs-\/>delta > 0) \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01156}01156                         ffclock\_convert\_delta(cs-\/>delta, period, \&bt2);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01157}01157                         bintime\_add(\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, \&bt2);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01158}01158                 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01159}01159 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01160}01160                 \textcolor{comment}{/* Leap second adjustment. */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01161}01161                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& FFCLOCK\_LEAPSEC)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01162}01162                         \mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}-\/>sec -\/= cs-\/>ff\_info.leapsec\_adjustment;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01163}01163 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01164}01164                 \textcolor{comment}{/* Boot time adjustment, for uptime/monotonic clocks. */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01165}01165                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{subr__stats_8c_a1e87af3c18a2fd36c61faf89949bdc3f}{flags}} \& FFCLOCK\_UPTIME)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01166}01166                         bintime\_sub(\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, \&ffclock\_boottime);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01167}01167                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01168}01168 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01169}01169         \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01170}01170                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01171}01171                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01172}01172         \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01173}01173 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01174}01174         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01175}01175 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01176}01176 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01177}01177 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01178}01178 \textcolor{comment}{ * Initialize a new timecounter and possibly use it.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01179}01179 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01180}01180 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01181}\mbox{\hyperlink{kern__tc_8c_a9a9ae9eb30778131c1bd07f005c416b5}{01181}} \mbox{\hyperlink{kern__tc_8c_a9a9ae9eb30778131c1bd07f005c416b5}{tc\_init}}(\textcolor{keyword}{struct} \mbox{\hyperlink{kern__tc_8c_a35098fc91b751950a191213b1c2e5853}{timecounter}} *tc)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01182}01182 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01183}01183         u\_int u;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01184}01184         \textcolor{keyword}{struct }sysctl\_oid *tc\_root;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01185}01185 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01186}01186         u = tc-\/>tc\_frequency / tc-\/>tc\_counter\_mask;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01187}01187         \textcolor{comment}{/* XXX: We need some margin here, 10\% is a guess */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01188}01188         u *= 11;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01189}01189         u /= 10;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01190}01190         \textcolor{keywordflow}{if} (u > \mbox{\hyperlink{subr__param_8c_a873124c5659edc141c67aab7999e314a}{hz}} \&\& tc-\/>tc\_quality >= 0) \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01191}01191                 tc-\/>tc\_quality = -\/2000;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01192}01192                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{init__main_8c_a9e276f53af35e37a6b19419e8155f3cc}{bootverbose}}) \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01193}01193                         \mbox{\hyperlink{subr__prf_8c_a55f3d956bb2ba20b5059e9e25484a47f}{printf}}(\textcolor{stringliteral}{"{}Timecounter \(\backslash\)"{}\%s\(\backslash\)"{} frequency \%ju Hz"{}},}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01194}01194                             tc-\/>tc\_name, (uintmax\_t)tc-\/>tc\_frequency);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01195}01195                         \mbox{\hyperlink{subr__prf_8c_a55f3d956bb2ba20b5059e9e25484a47f}{printf}}(\textcolor{stringliteral}{"{} -\/-\/ Insufficient hz, needs at least \%u\(\backslash\)n"{}}, u);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01196}01196                 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01197}01197         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (tc-\/>tc\_quality >= 0 || \mbox{\hyperlink{init__main_8c_a9e276f53af35e37a6b19419e8155f3cc}{bootverbose}}) \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01198}01198                 \mbox{\hyperlink{subr__prf_8c_a55f3d956bb2ba20b5059e9e25484a47f}{printf}}(\textcolor{stringliteral}{"{}Timecounter \(\backslash\)"{}\%s\(\backslash\)"{} frequency \%ju Hz quality \%d\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01199}01199                     tc-\/>tc\_name, (uintmax\_t)tc-\/>tc\_frequency,}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01200}01200                     tc-\/>tc\_quality);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01201}01201         \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01202}01202 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01203}01203         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01204}01204 \textcolor{comment}{         * Set up sysctl tree for this counter.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01205}01205 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01206}01206         tc\_root = SYSCTL\_ADD\_NODE\_WITH\_LABEL(NULL,}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01207}01207             SYSCTL\_STATIC\_CHILDREN(\_kern\_timecounter\_tc), OID\_AUTO, tc-\/>tc\_name,}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01208}01208             CTLFLAG\_RW | CTLFLAG\_MPSAFE, 0,}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01209}01209             \textcolor{stringliteral}{"{}timecounter description"{}}, \textcolor{stringliteral}{"{}timecounter"{}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01210}01210         SYSCTL\_ADD\_UINT(NULL, SYSCTL\_CHILDREN(tc\_root), OID\_AUTO,}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01211}01211             \textcolor{stringliteral}{"{}mask"{}}, CTLFLAG\_RD, \&(tc-\/>tc\_counter\_mask), 0,}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01212}01212             \textcolor{stringliteral}{"{}mask for implemented bits"{}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01213}01213         SYSCTL\_ADD\_PROC(NULL, SYSCTL\_CHILDREN(tc\_root), OID\_AUTO,}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01214}01214             \textcolor{stringliteral}{"{}counter"{}}, CTLTYPE\_UINT | CTLFLAG\_RD | CTLFLAG\_MPSAFE, tc,}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01215}01215             \textcolor{keyword}{sizeof}(*tc), \mbox{\hyperlink{kern__tc_8c_adaac76ad284c642dc1bf829a5fa1237f}{sysctl\_kern\_timecounter\_get}}, \textcolor{stringliteral}{"{}IU"{}},}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01216}01216             \textcolor{stringliteral}{"{}current timecounter value"{}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01217}01217         SYSCTL\_ADD\_PROC(NULL, SYSCTL\_CHILDREN(tc\_root), OID\_AUTO,}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01218}01218             \textcolor{stringliteral}{"{}frequency"{}}, CTLTYPE\_U64 | CTLFLAG\_RD | CTLFLAG\_MPSAFE, tc,}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01219}01219             \textcolor{keyword}{sizeof}(*tc), \mbox{\hyperlink{kern__tc_8c_ab22a1fb3cbd3d9d528a905ae50ffe9a2}{sysctl\_kern\_timecounter\_freq}}, \textcolor{stringliteral}{"{}QU"{}},}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01220}01220             \textcolor{stringliteral}{"{}timecounter frequency"{}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01221}01221         SYSCTL\_ADD\_INT(NULL, SYSCTL\_CHILDREN(tc\_root), OID\_AUTO,}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01222}01222             \textcolor{stringliteral}{"{}quality"{}}, CTLFLAG\_RD, \&(tc-\/>tc\_quality), 0,}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01223}01223             \textcolor{stringliteral}{"{}goodness of time counter"{}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01224}01224 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01225}01225         mtx\_lock(\&\mbox{\hyperlink{kern__tc_8c_a72c9ec426d6d3cd3f45c5d1e9f5088c1}{tc\_lock}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01226}01226         tc-\/>tc\_next = \mbox{\hyperlink{kern__tc_8c_a8301e9eb233bf401378bf306f43fd446}{timecounters}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01227}01227         \mbox{\hyperlink{kern__tc_8c_a8301e9eb233bf401378bf306f43fd446}{timecounters}} = tc;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01228}01228 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01229}01229         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01230}01230 \textcolor{comment}{         * Do not automatically switch if the current tc was specifically}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01231}01231 \textcolor{comment}{         * chosen.  Never automatically use a timecounter with negative quality.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01232}01232 \textcolor{comment}{         * Even though we run on the dummy counter, switching here may be}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01233}01233 \textcolor{comment}{         * worse since this timecounter may not be monotonic.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01234}01234 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01235}01235         \textcolor{keywordflow}{if} (\mbox{\hyperlink{kern__tc_8c_a4c24893bb4edabd1ba114b9a942f23fd}{tc\_chosen}})}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01236}01236                 \textcolor{keywordflow}{goto} unlock;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01237}01237         \textcolor{keywordflow}{if} (tc-\/>tc\_quality < 0)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01238}01238                 \textcolor{keywordflow}{goto} unlock;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01239}01239         \textcolor{keywordflow}{if} (\mbox{\hyperlink{kern__tc_8c_a908d1ad161fecd877fe78a3ce4174e73}{tc\_from\_tunable}}[0] != \textcolor{charliteral}{'\(\backslash\)0'} \&\&}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01240}01240             strcmp(tc-\/>tc\_name, \mbox{\hyperlink{kern__tc_8c_a908d1ad161fecd877fe78a3ce4174e73}{tc\_from\_tunable}}) == 0) \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01241}01241                 \mbox{\hyperlink{kern__tc_8c_a4c24893bb4edabd1ba114b9a942f23fd}{tc\_chosen}} = 1;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01242}01242                 \mbox{\hyperlink{kern__tc_8c_a908d1ad161fecd877fe78a3ce4174e73}{tc\_from\_tunable}}[0] = \textcolor{charliteral}{'\(\backslash\)0'};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01243}01243         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01244}01244                 \textcolor{keywordflow}{if} (tc-\/>tc\_quality < \mbox{\hyperlink{kern__tc_8c_a35098fc91b751950a191213b1c2e5853}{timecounter}}-\/>tc\_quality)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01245}01245                         \textcolor{keywordflow}{goto} unlock;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01246}01246                 \textcolor{keywordflow}{if} (tc-\/>tc\_quality == \mbox{\hyperlink{kern__tc_8c_a35098fc91b751950a191213b1c2e5853}{timecounter}}-\/>tc\_quality \&\&}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01247}01247                     tc-\/>tc\_frequency < \mbox{\hyperlink{kern__tc_8c_a35098fc91b751950a191213b1c2e5853}{timecounter}}-\/>tc\_frequency)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01248}01248                         \textcolor{keywordflow}{goto} unlock;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01249}01249         \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01250}01250         (void)tc-\/>tc\_get\_timecount(tc);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01251}01251         \mbox{\hyperlink{kern__tc_8c_a35098fc91b751950a191213b1c2e5853}{timecounter}} = tc;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01252}01252 unlock:}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01253}01253         mtx\_unlock(\&\mbox{\hyperlink{kern__tc_8c_a72c9ec426d6d3cd3f45c5d1e9f5088c1}{tc\_lock}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01254}01254 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01255}01255 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01256}01256 \textcolor{comment}{/* Report the frequency of the current timecounter. */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01257}01257 uint64\_t}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01258}\mbox{\hyperlink{kern__tc_8c_a55963d38e1886fac24437a71e8a4d7ea}{01258}} \mbox{\hyperlink{kern__tc_8c_a55963d38e1886fac24437a71e8a4d7ea}{tc\_getfrequency}}(\textcolor{keywordtype}{void})}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01259}01259 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01260}01260 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01261}01261         \textcolor{keywordflow}{return} (\mbox{\hyperlink{structtimehands}{timehands}}-\/>\mbox{\hyperlink{structtimehands_a6e873b4aa6fa46eaad2c2b7199ed7555}{th\_counter}}-\/>tc\_frequency);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01262}01262 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01263}01263 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01264}01264 \textcolor{keyword}{static} \textcolor{keywordtype}{bool}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01265}\mbox{\hyperlink{kern__tc_8c_a8861ccb5cde07ebdf07af0d56208db10}{01265}} \mbox{\hyperlink{kern__tc_8c_a8861ccb5cde07ebdf07af0d56208db10}{sleeping\_on\_old\_rtc}}(\textcolor{keyword}{struct} thread *td)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01266}01266 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01267}01267 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01268}01268         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01269}01269 \textcolor{comment}{         * td\_rtcgen is modified by curthread when it is running,}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01270}01270 \textcolor{comment}{         * and by other threads in this function.  By finding the thread}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01271}01271 \textcolor{comment}{         * on a sleepqueue and holding the lock on the sleepqueue}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01272}01272 \textcolor{comment}{         * chain, we guarantee that the thread is not running and that}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01273}01273 \textcolor{comment}{         * modifying td\_rtcgen is safe.  Setting td\_rtcgen to zero informs}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01274}01274 \textcolor{comment}{         * the thread that it was woken due to a real-\/time clock adjustment.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01275}01275 \textcolor{comment}{         * (The declaration of td\_rtcgen refers to this comment.)}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01276}01276 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01277}01277         \textcolor{keywordflow}{if} (td-\/>td\_rtcgen != 0 \&\& td-\/>td\_rtcgen != \mbox{\hyperlink{kern__tc_8c_a28a361b4119bc0fda1ede69d075aa621}{rtc\_generation}}) \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01278}01278                 td-\/>td\_rtcgen = 0;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01279}01279                 \textcolor{keywordflow}{return} (\textcolor{keyword}{true});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01280}01280         \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01281}01281         \textcolor{keywordflow}{return} (\textcolor{keyword}{false});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01282}01282 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01283}01283 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01284}\mbox{\hyperlink{kern__tc_8c_a5f453642f0b8c19f9307eec532719616}{01284}} \textcolor{keyword}{static} \textcolor{keyword}{struct }\mbox{\hyperlink{uipc__ktls_8c_a7b5de10a04be6deb16c42cef5da02110}{mtx}} \mbox{\hyperlink{kern__tc_8c_a5f453642f0b8c19f9307eec532719616}{tc\_setclock\_mtx}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01285}\mbox{\hyperlink{kern__tc_8c_a325ccf15891e27a33118bec5cfce2c27}{01285}} \mbox{\hyperlink{kern__tc_8c_a325ccf15891e27a33118bec5cfce2c27}{MTX\_SYSINIT}}(tc\_setclock\_init, \&\mbox{\hyperlink{kern__tc_8c_a5f453642f0b8c19f9307eec532719616}{tc\_setclock\_mtx}}, \textcolor{stringliteral}{"{}tcsetc"{}}, MTX\_SPIN);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01286}01286 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01287}01287 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01288}01288 \textcolor{comment}{ * Step our concept of UTC.  This is done by modifying our estimate of}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01289}01289 \textcolor{comment}{ * when we booted.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01290}01290 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01291}01291 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01292}\mbox{\hyperlink{kern__tc_8c_a82f5b6d98c6056a29c85c4bb4f0e8cd4}{01292}} \mbox{\hyperlink{kern__tc_8c_a82f5b6d98c6056a29c85c4bb4f0e8cd4}{tc\_setclock}}(\textcolor{keyword}{struct} timespec *\mbox{\hyperlink{clock__if_8m_a919cc4bfd342c5574101ab9d56c4092a}{ts}})}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01293}01293 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01294}01294         \textcolor{keyword}{struct }timespec tbef, taft;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01295}01295         \textcolor{keyword}{struct }\mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} \mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, bt2;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01296}01296 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01297}01297         timespec2bintime(\mbox{\hyperlink{clock__if_8m_a919cc4bfd342c5574101ab9d56c4092a}{ts}}, \&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01298}01298         \mbox{\hyperlink{kern__tc_8c_af53cad09abe604da7bf227343569b0e4}{nanotime}}(\&tbef);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01299}01299         mtx\_lock\_spin(\&\mbox{\hyperlink{kern__tc_8c_a5f453642f0b8c19f9307eec532719616}{tc\_setclock\_mtx}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01300}01300         \mbox{\hyperlink{kern__tc_8c_a4c41c76d31bf0a9205130acc4cf3d8b6}{cpu\_tick\_calibrate}}(1);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01301}01301         \mbox{\hyperlink{kern__tc_8c_a8ec04a6cda605cfc3cebfbd49e5ece3e}{binuptime}}(\&bt2);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01302}01302         bintime\_sub(\&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, \&bt2);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01303}01303 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01304}01304         \textcolor{comment}{/* XXX fiddle all the little crinkly bits around the fiords... */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01305}01305         \mbox{\hyperlink{kern__tc_8c_a1c0ca4641e0c89396367d12d1ddfc9e8}{tc\_windup}}(\&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01306}01306         mtx\_unlock\_spin(\&\mbox{\hyperlink{kern__tc_8c_a5f453642f0b8c19f9307eec532719616}{tc\_setclock\_mtx}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01307}01307 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01308}01308         \textcolor{comment}{/* Avoid rtc\_generation == 0, since td\_rtcgen == 0 is special. */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01309}01309         atomic\_add\_rel\_int(\&\mbox{\hyperlink{kern__tc_8c_a28a361b4119bc0fda1ede69d075aa621}{rtc\_generation}}, 2);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01310}01310         \mbox{\hyperlink{subr__sleepqueue_8c_a881b4ca63bf22269c910c8fa0e11f335}{sleepq\_chains\_remove\_matching}}(\mbox{\hyperlink{kern__tc_8c_a8861ccb5cde07ebdf07af0d56208db10}{sleeping\_on\_old\_rtc}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01311}01311         \textcolor{keywordflow}{if} (\mbox{\hyperlink{kern__tc_8c_a3f4cbce7a7a305c06a4ecfaca44c2546}{timestepwarnings}}) \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01312}01312                 \mbox{\hyperlink{kern__tc_8c_af53cad09abe604da7bf227343569b0e4}{nanotime}}(\&taft);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01313}01313                 \mbox{\hyperlink{subr__prf_8c_af8bf48b681a0471cae1be861c2102d5f}{log}}(LOG\_INFO,}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01314}01314                     \textcolor{stringliteral}{"{}Time stepped from \%jd.\%09ld to \%jd.\%09ld (\%jd.\%09ld)\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01315}01315                     (intmax\_t)tbef.tv\_sec, tbef.tv\_nsec,}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01316}01316                     (intmax\_t)taft.tv\_sec, taft.tv\_nsec,}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01317}01317                     (intmax\_t)\mbox{\hyperlink{clock__if_8m_a919cc4bfd342c5574101ab9d56c4092a}{ts}}-\/>tv\_sec, \mbox{\hyperlink{clock__if_8m_a919cc4bfd342c5574101ab9d56c4092a}{ts}}-\/>tv\_nsec);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01318}01318         \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01319}01319 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01320}01320 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01321}01321 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01322}01322 \textcolor{comment}{ * Recalculate the scaling factor.  We want the number of 1/2\string^64}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01323}01323 \textcolor{comment}{ * fractions of a second per period of the hardware counter, taking}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01324}01324 \textcolor{comment}{ * into account the th\_adjustment factor which the NTP PLL/adjtime(2)}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01325}01325 \textcolor{comment}{ * processing provides us with.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01326}01326 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01327}01327 \textcolor{comment}{ * The th\_adjustment is nanoseconds per second with 32 bit binary}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01328}01328 \textcolor{comment}{ * fraction and we want 64 bit binary fraction of second:}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01329}01329 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01330}01330 \textcolor{comment}{ *       x = a * 2\string^32 / 10\string^9 = a * 4.294967296}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01331}01331 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01332}01332 \textcolor{comment}{ * The range of th\_adjustment is +/-\/ 5000PPM so inside a 64bit int}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01333}01333 \textcolor{comment}{ * we can only multiply by about 850 without overflowing, that}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01334}01334 \textcolor{comment}{ * leaves no suitably precise fractions for multiply before divide.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01335}01335 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01336}01336 \textcolor{comment}{ * Divide before multiply with a fraction of 2199/512 results in a}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01337}01337 \textcolor{comment}{ * systematic undercompensation of 10PPM of th\_adjustment.  On a}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01338}01338 \textcolor{comment}{ * 5000PPM adjustment this is a 0.05PPM error.  This is acceptable.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01339}01339 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01340}01340 \textcolor{comment}{ * We happily sacrifice the lowest of the 64 bits of our result}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01341}01341 \textcolor{comment}{ * to the goddess of code clarity.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01342}01342 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01343}01343 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01344}\mbox{\hyperlink{kern__tc_8c_af6f4b4e42ebccb6ed5e0888f1af71c44}{01344}} \mbox{\hyperlink{kern__tc_8c_af6f4b4e42ebccb6ed5e0888f1af71c44}{recalculate\_scaling\_factor\_and\_large\_delta}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structtimehands}{timehands}} *th)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01345}01345 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01346}01346         uint64\_t scale;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01347}01347 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01348}01348         scale = (uint64\_t)1 << 63;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01349}01349         scale += (th-\/>\mbox{\hyperlink{structtimehands_a8b85c0a8aa3f90feba9d4bc9cbe741b6}{th\_adjustment}} / 1024) * 2199;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01350}01350         scale /= th-\/>\mbox{\hyperlink{structtimehands_a6e873b4aa6fa46eaad2c2b7199ed7555}{th\_counter}}-\/>tc\_frequency;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01351}01351         th-\/>\mbox{\hyperlink{structtimehands_a4b079bb7849db9a6ea3abf069ad8905a}{th\_scale}} = scale * 2;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01352}01352         th-\/>\mbox{\hyperlink{structtimehands_adbe021df320b1201345510bccee7bde5}{th\_large\_delta}} = MIN(((uint64\_t)1 << 63) / scale, UINT\_MAX);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01353}01353 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01354}01354 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01355}01355 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01356}01356 \textcolor{comment}{ * Initialize the next struct timehands in the ring and make}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01357}01357 \textcolor{comment}{ * it the active timehands.  Along the way we might switch to a different}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01358}01358 \textcolor{comment}{ * timecounter and/or do seconds processing in NTP.  Slightly magic.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01359}01359 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01360}01360 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01361}\mbox{\hyperlink{kern__tc_8c_a1c0ca4641e0c89396367d12d1ddfc9e8}{01361}} \mbox{\hyperlink{kern__tc_8c_a1c0ca4641e0c89396367d12d1ddfc9e8}{tc\_windup}}(\textcolor{keyword}{struct} \mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} *new\_boottimebin)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01362}01362 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01363}01363         \textcolor{keyword}{struct }\mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} \mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01364}01364         \textcolor{keyword}{struct }\mbox{\hyperlink{kern__tc_8c_a35098fc91b751950a191213b1c2e5853}{timecounter}} *tc;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01365}01365         \textcolor{keyword}{struct }\mbox{\hyperlink{structtimehands}{timehands}} *th, *tho;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01366}01366         u\_int delta, ncount, ogen;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01367}01367         \textcolor{keywordtype}{int} i;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01368}01368         time\_t t;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01369}01369 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01370}01370         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01371}01371 \textcolor{comment}{         * Make the next timehands a copy of the current one, but do}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01372}01372 \textcolor{comment}{         * not overwrite the generation or next pointer.  While we}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01373}01373 \textcolor{comment}{         * update the contents, the generation must be zero.  We need}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01374}01374 \textcolor{comment}{         * to ensure that the zero generation is visible before the}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01375}01375 \textcolor{comment}{         * data updates become visible, which requires release fence.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01376}01376 \textcolor{comment}{         * For similar reasons, re-\/reading of the generation after the}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01377}01377 \textcolor{comment}{         * data is read should use acquire fence.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01378}01378 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01379}01379         tho = \mbox{\hyperlink{kern__tc_8c_a90f582e4036774428020fe41210fd9cd}{timehands}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01380}01380         th = tho-\/>\mbox{\hyperlink{structtimehands_aacc6032d0d797b8a67a36df3ca117021}{th\_next}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01381}01381         ogen = th-\/>\mbox{\hyperlink{structtimehands_a759f4ac823300fac1fb4b8f8108459d8}{th\_generation}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01382}01382         th-\/>\mbox{\hyperlink{structtimehands_a759f4ac823300fac1fb4b8f8108459d8}{th\_generation}} = 0;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01383}01383         atomic\_thread\_fence\_rel();}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01384}01384         memcpy(th, tho, offsetof(\textcolor{keyword}{struct} \mbox{\hyperlink{structtimehands}{timehands}}, \mbox{\hyperlink{structtimehands_a759f4ac823300fac1fb4b8f8108459d8}{th\_generation}}));}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01385}01385         \textcolor{keywordflow}{if} (new\_boottimebin != NULL)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01386}01386                 th-\/>\mbox{\hyperlink{structtimehands_af3aa7f25829422014014889ad4ad9d5d}{th\_boottime}} = *new\_boottimebin;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01387}01387 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01388}01388         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01389}01389 \textcolor{comment}{         * Capture a timecounter delta on the current timecounter and if}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01390}01390 \textcolor{comment}{         * changing timecounters, a counter value from the new timecounter.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01391}01391 \textcolor{comment}{         * Update the offset fields accordingly.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01392}01392 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01393}01393         tc = atomic\_load\_ptr(\&\mbox{\hyperlink{kern__tc_8c_a35098fc91b751950a191213b1c2e5853}{timecounter}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01394}01394         delta = \mbox{\hyperlink{kern__tc_8c_a9f364f93dac9a6972f68cd9e6449d971}{tc\_delta}}(th);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01395}01395         \textcolor{keywordflow}{if} (th-\/>\mbox{\hyperlink{structtimehands_a6e873b4aa6fa46eaad2c2b7199ed7555}{th\_counter}} != tc)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01396}01396                 ncount = tc-\/>tc\_get\_timecount(tc);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01397}01397         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01398}01398                 ncount = 0;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01399}01399 \textcolor{preprocessor}{\#ifdef FFCLOCK}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01400}01400         ffclock\_windup(delta);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01401}01401 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01402}01402         th-\/>\mbox{\hyperlink{structtimehands_a6ef254e39c5e63cae43e7952a423064d}{th\_offset\_count}} += delta;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01403}01403         th-\/>\mbox{\hyperlink{structtimehands_a6ef254e39c5e63cae43e7952a423064d}{th\_offset\_count}} \&= th-\/>\mbox{\hyperlink{structtimehands_a6e873b4aa6fa46eaad2c2b7199ed7555}{th\_counter}}-\/>tc\_counter\_mask;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01404}01404         \mbox{\hyperlink{kern__tc_8c_a337fff48624c756075b8a9e220045212}{bintime\_add\_tc\_delta}}(\&th-\/>\mbox{\hyperlink{structtimehands_a8343df3d16d957ac6054336b6304d494}{th\_offset}}, th-\/>\mbox{\hyperlink{structtimehands_a4b079bb7849db9a6ea3abf069ad8905a}{th\_scale}},}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01405}01405             th-\/>\mbox{\hyperlink{structtimehands_adbe021df320b1201345510bccee7bde5}{th\_large\_delta}}, delta);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01406}01406 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01407}01407         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01408}01408 \textcolor{comment}{         * Hardware latching timecounters may not generate interrupts on}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01409}01409 \textcolor{comment}{         * PPS events, so instead we poll them.  There is a finite risk that}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01410}01410 \textcolor{comment}{         * the hardware might capture a count which is later than the one we}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01411}01411 \textcolor{comment}{         * got above, and therefore possibly in the next NTP second which might}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01412}01412 \textcolor{comment}{         * have a different rate than the current NTP second.  It doesn't}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01413}01413 \textcolor{comment}{         * matter in practice.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01414}01414 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01415}01415         \textcolor{keywordflow}{if} (tho-\/>\mbox{\hyperlink{structtimehands_a6e873b4aa6fa46eaad2c2b7199ed7555}{th\_counter}}-\/>tc\_poll\_pps)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01416}01416                 tho-\/>\mbox{\hyperlink{structtimehands_a6e873b4aa6fa46eaad2c2b7199ed7555}{th\_counter}}-\/>tc\_poll\_pps(tho-\/>\mbox{\hyperlink{structtimehands_a6e873b4aa6fa46eaad2c2b7199ed7555}{th\_counter}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01417}01417 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01418}01418         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01419}01419 \textcolor{comment}{         * Deal with NTP second processing.  The loop normally}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01420}01420 \textcolor{comment}{         * iterates at most once, but in extreme situations it might}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01421}01421 \textcolor{comment}{         * keep NTP sane if timeouts are not run for several seconds.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01422}01422 \textcolor{comment}{         * At boot, the time step can be large when the TOD hardware}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01423}01423 \textcolor{comment}{         * has been read, so on really large steps, we call}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01424}01424 \textcolor{comment}{         * ntp\_update\_second only twice.  We need to call it twice in}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01425}01425 \textcolor{comment}{         * case we missed a leap second.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01426}01426 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01427}01427         \mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}} = th-\/>\mbox{\hyperlink{structtimehands_a8343df3d16d957ac6054336b6304d494}{th\_offset}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01428}01428         bintime\_add(\&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, \&th-\/>\mbox{\hyperlink{structtimehands_af3aa7f25829422014014889ad4ad9d5d}{th\_boottime}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01429}01429         i = \mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}.sec -\/ tho-\/>\mbox{\hyperlink{structtimehands_a903e7fb963b8feed7a67c05a15cf9bfc}{th\_microtime}}.tv\_sec;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01430}01430         \textcolor{keywordflow}{if} (i > 0) \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01431}01431                 \textcolor{keywordflow}{if} (i > \mbox{\hyperlink{kern__tc_8c_aeb15779f518ed87371f3a0aed6ca2f55}{LARGE\_STEP}})}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01432}01432                         i = 2;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01433}01433 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01434}01434                 \textcolor{keywordflow}{do} \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01435}01435                         t = \mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}.sec;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01436}01436                         \mbox{\hyperlink{kern__ntptime_8c_acfed1a738d998977b5060497bdb5641a}{ntp\_update\_second}}(\&th-\/>\mbox{\hyperlink{structtimehands_a8b85c0a8aa3f90feba9d4bc9cbe741b6}{th\_adjustment}}, \&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}.sec);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01437}01437                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}.sec != t)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01438}01438                                 th-\/>\mbox{\hyperlink{structtimehands_af3aa7f25829422014014889ad4ad9d5d}{th\_boottime}}.sec += \mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}.sec -\/ t;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01439}01439                         -\/-\/i;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01440}01440                 \} \textcolor{keywordflow}{while} (i > 0);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01441}01441 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01442}01442                 \mbox{\hyperlink{kern__tc_8c_af6f4b4e42ebccb6ed5e0888f1af71c44}{recalculate\_scaling\_factor\_and\_large\_delta}}(th);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01443}01443         \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01444}01444 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01445}01445         \textcolor{comment}{/* Update the UTC timestamps used by the get*() functions. */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01446}01446         th-\/>\mbox{\hyperlink{structtimehands_a3bc3499b05913be14bf2968e7fe6ce21}{th\_bintime}} = \mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01447}01447         bintime2timeval(\&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, \&th-\/>\mbox{\hyperlink{structtimehands_a903e7fb963b8feed7a67c05a15cf9bfc}{th\_microtime}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01448}01448         bintime2timespec(\&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, \&th-\/>\mbox{\hyperlink{structtimehands_a194617542b2cba6072b118b6168cff6e}{th\_nanotime}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01449}01449 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01450}01450         \textcolor{comment}{/* Now is a good time to change timecounters. */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01451}01451         \textcolor{keywordflow}{if} (th-\/>\mbox{\hyperlink{structtimehands_a6e873b4aa6fa46eaad2c2b7199ed7555}{th\_counter}} != tc) \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01452}01452 \textcolor{preprocessor}{\#ifndef \_\_arm\_\_}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01453}01453                 \textcolor{keywordflow}{if} ((tc-\/>tc\_flags \& TC\_FLAGS\_C2STOP) != 0)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01454}01454                         \mbox{\hyperlink{kern__clocksource_8c_ae19c93aaa68791c26948673003247f9b}{cpu\_disable\_c2\_sleep}}++;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01455}01455                 \textcolor{keywordflow}{if} ((th-\/>\mbox{\hyperlink{structtimehands_a6e873b4aa6fa46eaad2c2b7199ed7555}{th\_counter}}-\/>tc\_flags \& TC\_FLAGS\_C2STOP) != 0)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01456}01456                         \mbox{\hyperlink{kern__clocksource_8c_ae19c93aaa68791c26948673003247f9b}{cpu\_disable\_c2\_sleep}}-\/-\/;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01457}01457 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01458}01458                 th-\/>\mbox{\hyperlink{structtimehands_a6e873b4aa6fa46eaad2c2b7199ed7555}{th\_counter}} = tc;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01459}01459                 th-\/>\mbox{\hyperlink{structtimehands_a6ef254e39c5e63cae43e7952a423064d}{th\_offset\_count}} = ncount;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01460}01460                 \mbox{\hyperlink{kern__tc_8c_a6cb013aa29d680e529bd566e9a580f99}{tc\_min\_ticktock\_freq}} = max(1, tc-\/>tc\_frequency /}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01461}01461                     (((uint64\_t)tc-\/>tc\_counter\_mask + 1) / 3));}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01462}01462                 \mbox{\hyperlink{kern__tc_8c_af6f4b4e42ebccb6ed5e0888f1af71c44}{recalculate\_scaling\_factor\_and\_large\_delta}}(th);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01463}01463 \textcolor{preprocessor}{\#ifdef FFCLOCK}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01464}01464                 ffclock\_change\_tc(th);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01465}01465 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01466}01466         \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01467}01467 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01468}01468         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01469}01469 \textcolor{comment}{         * Now that the struct timehands is again consistent, set the new}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01470}01470 \textcolor{comment}{         * generation number, making sure to not make it zero.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01471}01471 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01472}01472         \textcolor{keywordflow}{if} (++ogen == 0)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01473}01473                 ogen = 1;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01474}01474         atomic\_store\_rel\_int(\&th-\/>\mbox{\hyperlink{structtimehands_a759f4ac823300fac1fb4b8f8108459d8}{th\_generation}}, ogen);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01475}01475 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01476}01476         \textcolor{comment}{/* Go live with the new struct timehands. */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01477}01477 \textcolor{preprocessor}{\#ifdef FFCLOCK}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01478}01478         \textcolor{keywordflow}{switch} (\mbox{\hyperlink{kern__tc_8c_ad1f583c39d0019f4a95092ce94a4c677}{sysclock\_active}}) \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01479}01479         \textcolor{keywordflow}{case} SYSCLOCK\_FBCK:}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01480}01480 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01481}01481                 \mbox{\hyperlink{kern__tc_8c_aa065968c4fbe4bcc3cd941cbb10619ef}{time\_second}} = th-\/>\mbox{\hyperlink{structtimehands_a903e7fb963b8feed7a67c05a15cf9bfc}{th\_microtime}}.tv\_sec;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01482}01482                 \mbox{\hyperlink{kern__tc_8c_a6dd117214f5c023a10c9b887218545d5}{time\_uptime}} = th-\/>\mbox{\hyperlink{structtimehands_a8343df3d16d957ac6054336b6304d494}{th\_offset}}.sec;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01483}01483 \textcolor{preprocessor}{\#ifdef FFCLOCK}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01484}01484                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01485}01485         \textcolor{keywordflow}{case} SYSCLOCK\_FFWD:}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01486}01486                 \mbox{\hyperlink{kern__tc_8c_aa065968c4fbe4bcc3cd941cbb10619ef}{time\_second}} = fftimehands-\/>tick\_time\_lerp.sec;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01487}01487                 \mbox{\hyperlink{kern__tc_8c_a6dd117214f5c023a10c9b887218545d5}{time\_uptime}} = fftimehands-\/>tick\_time\_lerp.sec -\/ ffclock\_boottime.sec;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01488}01488                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01489}01489         \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01490}01490 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01491}01491 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01492}01492         \mbox{\hyperlink{structtimehands}{timehands}} = th;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01493}01493         \mbox{\hyperlink{kern__sharedpage_8c_abb582e269f52edfd1419067827766270}{timekeep\_push\_vdso}}();}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01494}01494 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01495}01495 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01496}01496 \textcolor{comment}{/* Report or change the active timecounter hardware. */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01497}01497 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01498}\mbox{\hyperlink{kern__tc_8c_a33fb0979bbddc40ae6c0dab5d53efa18}{01498}} \mbox{\hyperlink{kern__tc_8c_a33fb0979bbddc40ae6c0dab5d53efa18}{sysctl\_kern\_timecounter\_hardware}}(SYSCTL\_HANDLER\_ARGS)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01499}01499 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01500}01500         \textcolor{keywordtype}{char} newname[32];}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01501}01501         \textcolor{keyword}{struct }\mbox{\hyperlink{kern__tc_8c_a35098fc91b751950a191213b1c2e5853}{timecounter}} *newtc, *tc;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01502}01502         \textcolor{keywordtype}{int} error;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01503}01503 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01504}01504         mtx\_lock(\&\mbox{\hyperlink{kern__tc_8c_a72c9ec426d6d3cd3f45c5d1e9f5088c1}{tc\_lock}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01505}01505         tc = \mbox{\hyperlink{kern__tc_8c_a35098fc91b751950a191213b1c2e5853}{timecounter}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01506}01506         strlcpy(newname, tc-\/>tc\_name, \textcolor{keyword}{sizeof}(newname));}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01507}01507         mtx\_unlock(\&\mbox{\hyperlink{kern__tc_8c_a72c9ec426d6d3cd3f45c5d1e9f5088c1}{tc\_lock}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01508}01508 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01509}01509         error = \mbox{\hyperlink{kern__sysctl_8c_ab092ad9a77759c4fa3040f74b7970318}{sysctl\_handle\_string}}(oidp, \&newname[0], \textcolor{keyword}{sizeof}(newname), req);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01510}01510         \textcolor{keywordflow}{if} (error != 0 || req-\/>newptr == NULL)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01511}01511                 \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01512}01512 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01513}01513         mtx\_lock(\&\mbox{\hyperlink{kern__tc_8c_a72c9ec426d6d3cd3f45c5d1e9f5088c1}{tc\_lock}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01514}01514         \textcolor{comment}{/* Record that the tc in use now was specifically chosen. */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01515}01515         \mbox{\hyperlink{kern__tc_8c_a4c24893bb4edabd1ba114b9a942f23fd}{tc\_chosen}} = 1;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01516}01516         \textcolor{keywordflow}{if} (strcmp(newname, tc-\/>tc\_name) == 0) \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01517}01517                 mtx\_unlock(\&\mbox{\hyperlink{kern__tc_8c_a72c9ec426d6d3cd3f45c5d1e9f5088c1}{tc\_lock}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01518}01518                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01519}01519         \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01520}01520         \textcolor{keywordflow}{for} (newtc = \mbox{\hyperlink{kern__tc_8c_a8301e9eb233bf401378bf306f43fd446}{timecounters}}; newtc != NULL; newtc = newtc-\/>tc\_next) \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01521}01521                 \textcolor{keywordflow}{if} (strcmp(newname, newtc-\/>tc\_name) != 0)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01522}01522                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01523}01523 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01524}01524                 \textcolor{comment}{/* Warm up new timecounter. */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01525}01525                 (void)newtc-\/>tc\_get\_timecount(newtc);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01526}01526 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01527}01527                 \mbox{\hyperlink{kern__tc_8c_a35098fc91b751950a191213b1c2e5853}{timecounter}} = newtc;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01528}01528 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01529}01529                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01530}01530 \textcolor{comment}{                 * The vdso timehands update is deferred until the next}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01531}01531 \textcolor{comment}{                 * 'tc\_windup()'.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01532}01532 \textcolor{comment}{                 *}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01533}01533 \textcolor{comment}{                 * This is prudent given that 'timekeep\_push\_vdso()' does not}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01534}01534 \textcolor{comment}{                 * use any locking and that it can be called in hard interrupt}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01535}01535 \textcolor{comment}{                 * context via 'tc\_windup()'.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01536}01536 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01537}01537                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01538}01538         \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01539}01539         mtx\_unlock(\&\mbox{\hyperlink{kern__tc_8c_a72c9ec426d6d3cd3f45c5d1e9f5088c1}{tc\_lock}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01540}01540         \textcolor{keywordflow}{return} (newtc != NULL ? 0 : EINVAL);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01541}01541 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01542}\mbox{\hyperlink{kern__tc_8c_af7c93bac2ecb87729af842bddbe376c2}{01542}} \mbox{\hyperlink{kern__tc_8c_a471ba6ecd69584c29ffe77bab6c7fe7d}{SYSCTL\_PROC}}(\_kern\_timecounter, OID\_AUTO, hardware,}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01543}01543     CTLTYPE\_STRING | CTLFLAG\_RWTUN | CTLFLAG\_NOFETCH | CTLFLAG\_MPSAFE, 0, 0,}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01544}01544     \mbox{\hyperlink{kern__tc_8c_a33fb0979bbddc40ae6c0dab5d53efa18}{sysctl\_kern\_timecounter\_hardware}}, \textcolor{stringliteral}{"{}A"{}},}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01545}01545     \textcolor{stringliteral}{"{}Timecounter hardware selected"{}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01546}01546 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01547}01547 \textcolor{comment}{/* Report the available timecounter hardware. */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01548}01548 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01549}\mbox{\hyperlink{kern__tc_8c_a5777bf70224b88d34ba13e402f3dd8be}{01549}} \mbox{\hyperlink{kern__tc_8c_a5777bf70224b88d34ba13e402f3dd8be}{sysctl\_kern\_timecounter\_choice}}(SYSCTL\_HANDLER\_ARGS)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01550}01550 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01551}01551         \textcolor{keyword}{struct }sbuf sb;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01552}01552         \textcolor{keyword}{struct }\mbox{\hyperlink{kern__tc_8c_a35098fc91b751950a191213b1c2e5853}{timecounter}} *tc;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01553}01553         \textcolor{keywordtype}{int} error;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01554}01554 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01555}01555         error = \mbox{\hyperlink{kern__sysctl_8c_a591f82d54efedffb48467e9519bd4eba}{sysctl\_wire\_old\_buffer}}(req, 0);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01556}01556         \textcolor{keywordflow}{if} (error != 0)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01557}01557                 \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01558}01558         \mbox{\hyperlink{kern__sysctl_8c_af7691ec0fcb72946d348acb4222ce572}{sbuf\_new\_for\_sysctl}}(\&sb, NULL, 0, req);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01559}01559         mtx\_lock(\&\mbox{\hyperlink{kern__tc_8c_a72c9ec426d6d3cd3f45c5d1e9f5088c1}{tc\_lock}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01560}01560         \textcolor{keywordflow}{for} (tc = \mbox{\hyperlink{kern__tc_8c_a8301e9eb233bf401378bf306f43fd446}{timecounters}}; tc != NULL; tc = tc-\/>tc\_next) \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01561}01561                 \textcolor{keywordflow}{if} (tc != \mbox{\hyperlink{kern__tc_8c_a8301e9eb233bf401378bf306f43fd446}{timecounters}})}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01562}01562                         \mbox{\hyperlink{subr__sbuf_8c_a32f370dd75671ca25f4626ea6f414543}{sbuf\_putc}}(\&sb, \textcolor{charliteral}{' '});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01563}01563                 \mbox{\hyperlink{subr__sbuf_8c_a6c6abdb7c0c9a19d892b1d07757dd056}{sbuf\_printf}}(\&sb, \textcolor{stringliteral}{"{}\%s(\%d)"{}}, tc-\/>tc\_name, tc-\/>tc\_quality);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01564}01564         \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01565}01565         mtx\_unlock(\&\mbox{\hyperlink{kern__tc_8c_a72c9ec426d6d3cd3f45c5d1e9f5088c1}{tc\_lock}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01566}01566         error = \mbox{\hyperlink{subr__sbuf_8c_a29e35276bb1dcf4342f5a49ec3d0068a}{sbuf\_finish}}(\&sb);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01567}01567         \mbox{\hyperlink{subr__sbuf_8c_a60934581249642aa5f426992ace71542}{sbuf\_delete}}(\&sb);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01568}01568         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01569}01569 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01570}01570 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01571}\mbox{\hyperlink{kern__tc_8c_ae9fd8357ed943227ba4aba745b4f9d6b}{01571}} \mbox{\hyperlink{kern__tc_8c_a471ba6ecd69584c29ffe77bab6c7fe7d}{SYSCTL\_PROC}}(\_kern\_timecounter, OID\_AUTO, choice,}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01572}01572     CTLTYPE\_STRING | CTLFLAG\_RD | CTLFLAG\_MPSAFE, 0, 0,}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01573}01573     \mbox{\hyperlink{kern__tc_8c_a5777bf70224b88d34ba13e402f3dd8be}{sysctl\_kern\_timecounter\_choice}}, \textcolor{stringliteral}{"{}A"{}},}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01574}01574     \textcolor{stringliteral}{"{}Timecounter hardware detected"{}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01575}01575 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01576}01576 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01577}01577 \textcolor{comment}{ * RFC 2783 PPS-\/API implementation.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01578}01578 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01579}01579 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01580}01580 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01581}01581 \textcolor{comment}{ *  Return true if the driver is aware of the abi version extensions in the}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01582}01582 \textcolor{comment}{ *  pps\_state structure, and it supports at least the given abi version number.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01583}01583 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01584}01584 \textcolor{keyword}{static} \textcolor{keyword}{inline} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01585}\mbox{\hyperlink{kern__tc_8c_aad1b0017ba34f7e6adbdffac5c56795d}{01585}} \mbox{\hyperlink{kern__tc_8c_aad1b0017ba34f7e6adbdffac5c56795d}{abi\_aware}}(\textcolor{keyword}{struct} pps\_state *pps, \textcolor{keywordtype}{int} vers)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01586}01586 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01587}01587 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01588}01588         \textcolor{keywordflow}{return} ((pps-\/>kcmode \& KCMODE\_ABIFLAG) \&\& pps-\/>driver\_abi >= vers);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01589}01589 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01590}01590 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01591}01591 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01592}\mbox{\hyperlink{kern__tc_8c_a193557529295159bd5b32f019ac4e7f3}{01592}} \mbox{\hyperlink{kern__tc_8c_a193557529295159bd5b32f019ac4e7f3}{pps\_fetch}}(\textcolor{keyword}{struct} pps\_fetch\_args *fapi, \textcolor{keyword}{struct} pps\_state *pps)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01593}01593 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01594}01594         \textcolor{keywordtype}{int} err, timo;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01595}01595         pps\_seq\_t aseq, cseq;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01596}01596         \textcolor{keyword}{struct }timeval tv;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01597}01597 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01598}01598         \textcolor{keywordflow}{if} (fapi-\/>tsformat \&\& fapi-\/>tsformat != PPS\_TSFMT\_TSPEC)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01599}01599                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01600}01600 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01601}01601         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01602}01602 \textcolor{comment}{         * If no timeout is requested, immediately return whatever values were}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01603}01603 \textcolor{comment}{         * most recently captured.  If timeout seconds is -\/1, that's a request}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01604}01604 \textcolor{comment}{         * to block without a timeout.  WITNESS won't let us sleep forever}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01605}01605 \textcolor{comment}{         * without a lock (we really don't need a lock), so just repeatedly}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01606}01606 \textcolor{comment}{         * sleep a long time.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01607}01607 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01608}01608         \textcolor{keywordflow}{if} (fapi-\/>timeout.tv\_sec || fapi-\/>timeout.tv\_nsec) \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01609}01609                 \textcolor{keywordflow}{if} (fapi-\/>timeout.tv\_sec == -\/1)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01610}01610                         timo = 0x7fffffff;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01611}01611                 \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01612}01612                         tv.tv\_sec = fapi-\/>timeout.tv\_sec;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01613}01613                         tv.tv\_usec = fapi-\/>timeout.tv\_nsec / 1000;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01614}01614                         timo = \mbox{\hyperlink{kern__clock_8c_a36f0a1e6ff31dc9a9eb0a08ea129ec1c}{tvtohz}}(\&tv);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01615}01615                 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01616}01616                 aseq = atomic\_load\_int(\&pps-\/>ppsinfo.assert\_sequence);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01617}01617                 cseq = atomic\_load\_int(\&pps-\/>ppsinfo.clear\_sequence);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01618}01618                 \textcolor{keywordflow}{while} (aseq == atomic\_load\_int(\&pps-\/>ppsinfo.assert\_sequence) \&\&}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01619}01619                     cseq == atomic\_load\_int(\&pps-\/>ppsinfo.clear\_sequence)) \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01620}01620                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{kern__tc_8c_aad1b0017ba34f7e6adbdffac5c56795d}{abi\_aware}}(pps, 1) \&\& pps-\/>driver\_mtx != NULL) \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01621}01621                                 \textcolor{keywordflow}{if} (pps-\/>flags \& PPSFLAG\_MTX\_SPIN) \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01622}01622                                         err = msleep\_spin(pps, pps-\/>driver\_mtx,}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01623}01623                                             \textcolor{stringliteral}{"{}ppsfch"{}}, timo);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01624}01624                                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01625}01625                                         err = msleep(pps, pps-\/>driver\_mtx, PCATCH,}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01626}01626                                             \textcolor{stringliteral}{"{}ppsfch"{}}, timo);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01627}01627                                 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01628}01628                         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01629}01629                                 err = tsleep(pps, PCATCH, \textcolor{stringliteral}{"{}ppsfch"{}}, timo);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01630}01630                         \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01631}01631                         \textcolor{keywordflow}{if} (err == EWOULDBLOCK) \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01632}01632                                 \textcolor{keywordflow}{if} (fapi-\/>timeout.tv\_sec == -\/1) \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01633}01633                                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01634}01634                                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01635}01635                                         \textcolor{keywordflow}{return} (ETIMEDOUT);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01636}01636                                 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01637}01637                         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (err != 0) \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01638}01638                                 \textcolor{keywordflow}{return} (err);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01639}01639                         \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01640}01640                 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01641}01641         \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01642}01642 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01643}01643         pps-\/>ppsinfo.current\_mode = pps-\/>ppsparam.mode;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01644}01644         fapi-\/>pps\_info\_buf = pps-\/>ppsinfo;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01645}01645 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01646}01646         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01647}01647 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01648}01648 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01649}01649 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01650}\mbox{\hyperlink{kern__tc_8c_a7cd3357e12c79f3e3b21de9fbefcbdd9}{01650}} \mbox{\hyperlink{kern__tc_8c_a7cd3357e12c79f3e3b21de9fbefcbdd9}{pps\_ioctl}}(u\_long cmd, caddr\_t \mbox{\hyperlink{msi__if_8m_a67f97bb317cd4853ec5319a7da661c1f}{data}}, \textcolor{keyword}{struct} pps\_state *pps)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01651}01651 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01652}01652         pps\_params\_t *app;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01653}01653         \textcolor{keyword}{struct }pps\_fetch\_args *fapi;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01654}01654 \textcolor{preprocessor}{\#ifdef FFCLOCK}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01655}01655         \textcolor{keyword}{struct }pps\_fetch\_ffc\_args *fapi\_ffc;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01656}01656 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01657}01657 \textcolor{preprocessor}{\#ifdef PPS\_SYNC}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01658}01658         \textcolor{keyword}{struct }pps\_kcbind\_args *kapi;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01659}01659 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01660}01660 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01661}01661         KASSERT(pps != NULL, (\textcolor{stringliteral}{"{}NULL pps pointer in pps\_ioctl"{}}));}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01662}01662         \textcolor{keywordflow}{switch} (cmd) \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01663}01663         \textcolor{keywordflow}{case} PPS\_IOC\_CREATE:}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01664}01664                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01665}01665         \textcolor{keywordflow}{case} PPS\_IOC\_DESTROY:}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01666}01666                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01667}01667         \textcolor{keywordflow}{case} PPS\_IOC\_SETPARAMS:}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01668}01668                 app = (pps\_params\_t *)\mbox{\hyperlink{msi__if_8m_a67f97bb317cd4853ec5319a7da661c1f}{data}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01669}01669                 \textcolor{keywordflow}{if} (app-\/>mode \& \string~pps-\/>ppscap)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01670}01670                         \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01671}01671 \textcolor{preprocessor}{\#ifdef FFCLOCK}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01672}01672                 \textcolor{comment}{/* Ensure only a single clock is selected for ffc timestamp. */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01673}01673                 \textcolor{keywordflow}{if} ((app-\/>mode \& PPS\_TSCLK\_MASK) == PPS\_TSCLK\_MASK)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01674}01674                         \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01675}01675 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01676}01676                 pps-\/>ppsparam = *app;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01677}01677                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01678}01678         \textcolor{keywordflow}{case} PPS\_IOC\_GETPARAMS:}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01679}01679                 app = (pps\_params\_t *)\mbox{\hyperlink{msi__if_8m_a67f97bb317cd4853ec5319a7da661c1f}{data}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01680}01680                 *app = pps-\/>ppsparam;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01681}01681                 app-\/>api\_version = PPS\_API\_VERS\_1;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01682}01682                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01683}01683         \textcolor{keywordflow}{case} PPS\_IOC\_GETCAP:}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01684}01684                 *(\textcolor{keywordtype}{int}*)\mbox{\hyperlink{msi__if_8m_a67f97bb317cd4853ec5319a7da661c1f}{data}} = pps-\/>ppscap;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01685}01685                 return (0);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01686}01686         \textcolor{keywordflow}{case} PPS\_IOC\_FETCH:}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01687}01687                 fapi = (\textcolor{keyword}{struct }pps\_fetch\_args *)\mbox{\hyperlink{msi__if_8m_a67f97bb317cd4853ec5319a7da661c1f}{data}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01688}01688                 \textcolor{keywordflow}{return} (\mbox{\hyperlink{kern__tc_8c_a193557529295159bd5b32f019ac4e7f3}{pps\_fetch}}(fapi, pps));}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01689}01689 \textcolor{preprocessor}{\#ifdef FFCLOCK}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01690}01690         \textcolor{keywordflow}{case} PPS\_IOC\_FETCH\_FFCOUNTER:}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01691}01691                 fapi\_ffc = (\textcolor{keyword}{struct }pps\_fetch\_ffc\_args *)\mbox{\hyperlink{msi__if_8m_a67f97bb317cd4853ec5319a7da661c1f}{data}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01692}01692                 \textcolor{keywordflow}{if} (fapi\_ffc-\/>tsformat \&\& fapi\_ffc-\/>tsformat !=}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01693}01693                     PPS\_TSFMT\_TSPEC)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01694}01694                         \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01695}01695                 \textcolor{keywordflow}{if} (fapi\_ffc-\/>timeout.tv\_sec || fapi\_ffc-\/>timeout.tv\_nsec)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01696}01696                         \textcolor{keywordflow}{return} (EOPNOTSUPP);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01697}01697                 pps-\/>ppsinfo\_ffc.current\_mode = pps-\/>ppsparam.mode;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01698}01698                 fapi\_ffc-\/>pps\_info\_buf\_ffc = pps-\/>ppsinfo\_ffc;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01699}01699                 \textcolor{comment}{/* Overwrite timestamps if feedback clock selected. */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01700}01700                 \textcolor{keywordflow}{switch} (pps-\/>ppsparam.mode \& PPS\_TSCLK\_MASK) \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01701}01701                 \textcolor{keywordflow}{case} PPS\_TSCLK\_FBCK:}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01702}01702                         fapi\_ffc-\/>pps\_info\_buf\_ffc.assert\_timestamp =}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01703}01703                             pps-\/>ppsinfo.assert\_timestamp;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01704}01704                         fapi\_ffc-\/>pps\_info\_buf\_ffc.clear\_timestamp =}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01705}01705                             pps-\/>ppsinfo.clear\_timestamp;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01706}01706                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01707}01707                 \textcolor{keywordflow}{case} PPS\_TSCLK\_FFWD:}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01708}01708                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01709}01709                 \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01710}01710                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01711}01711                 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01712}01712                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01713}01713 \textcolor{preprocessor}{\#endif }\textcolor{comment}{/* FFCLOCK */}\textcolor{preprocessor}{}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01714}01714         \textcolor{keywordflow}{case} PPS\_IOC\_KCBIND:}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01715}01715 \textcolor{preprocessor}{\#ifdef PPS\_SYNC}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01716}01716                 kapi = (\textcolor{keyword}{struct }pps\_kcbind\_args *)\mbox{\hyperlink{msi__if_8m_a67f97bb317cd4853ec5319a7da661c1f}{data}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01717}01717                 \textcolor{comment}{/* XXX Only root should be able to do this */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01718}01718                 \textcolor{keywordflow}{if} (kapi-\/>tsformat \&\& kapi-\/>tsformat != PPS\_TSFMT\_TSPEC)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01719}01719                         \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01720}01720                 \textcolor{keywordflow}{if} (kapi-\/>kernel\_consumer != PPS\_KC\_HARDPPS)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01721}01721                         \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01722}01722                 \textcolor{keywordflow}{if} (kapi-\/>edge \& \string~pps-\/>ppscap)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01723}01723                         \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01724}01724                 pps-\/>kcmode = (kapi-\/>edge \& KCMODE\_EDGEMASK) |}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01725}01725                     (pps-\/>kcmode \& KCMODE\_ABIFLAG);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01726}01726                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01727}01727 \textcolor{preprocessor}{\#else}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01728}01728                 \textcolor{keywordflow}{return} (EOPNOTSUPP);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01729}01729 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01730}01730         \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01731}01731                 \textcolor{keywordflow}{return} (ENOIOCTL);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01732}01732         \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01733}01733 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01734}01734 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01735}01735 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01736}\mbox{\hyperlink{kern__tc_8c_af44147520613ab644ae494779aa43d5f}{01736}} \mbox{\hyperlink{kern__tc_8c_af44147520613ab644ae494779aa43d5f}{pps\_init}}(\textcolor{keyword}{struct} pps\_state *pps)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01737}01737 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01738}01738         pps-\/>ppscap |= PPS\_TSFMT\_TSPEC | PPS\_CANWAIT;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01739}01739         \textcolor{keywordflow}{if} (pps-\/>ppscap \& PPS\_CAPTUREASSERT)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01740}01740                 pps-\/>ppscap |= PPS\_OFFSETASSERT;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01741}01741         \textcolor{keywordflow}{if} (pps-\/>ppscap \& PPS\_CAPTURECLEAR)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01742}01742                 pps-\/>ppscap |= PPS\_OFFSETCLEAR;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01743}01743 \textcolor{preprocessor}{\#ifdef FFCLOCK}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01744}01744         pps-\/>ppscap |= PPS\_TSCLK\_MASK;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01745}01745 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01746}01746         pps-\/>kcmode \&= \string~KCMODE\_ABIFLAG;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01747}01747 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01748}01748 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01749}01749 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01750}\mbox{\hyperlink{kern__tc_8c_afad4984be4de28c7851ec4cdd736f01c}{01750}} \mbox{\hyperlink{kern__tc_8c_afad4984be4de28c7851ec4cdd736f01c}{pps\_init\_abi}}(\textcolor{keyword}{struct} pps\_state *pps)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01751}01751 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01752}01752 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01753}01753         \mbox{\hyperlink{kern__tc_8c_af44147520613ab644ae494779aa43d5f}{pps\_init}}(pps);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01754}01754         \textcolor{keywordflow}{if} (pps-\/>driver\_abi > 0) \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01755}01755                 pps-\/>kcmode |= KCMODE\_ABIFLAG;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01756}01756                 pps-\/>kernel\_abi = PPS\_ABI\_VERSION;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01757}01757         \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01758}01758 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01759}01759 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01760}01760 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01761}\mbox{\hyperlink{kern__tc_8c_aa759be90c9cffa6f779af8221f738d0f}{01761}} \mbox{\hyperlink{kern__tc_8c_aa759be90c9cffa6f779af8221f738d0f}{pps\_capture}}(\textcolor{keyword}{struct} pps\_state *pps)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01762}01762 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01763}01763         \textcolor{keyword}{struct }\mbox{\hyperlink{structtimehands}{timehands}} *th;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01764}01764 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01765}01765         KASSERT(pps != NULL, (\textcolor{stringliteral}{"{}NULL pps pointer in pps\_capture"{}}));}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01766}01766         th = \mbox{\hyperlink{kern__tc_8c_a90f582e4036774428020fe41210fd9cd}{timehands}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01767}01767         pps-\/>capgen = atomic\_load\_acq\_int(\&th-\/>\mbox{\hyperlink{structtimehands_a759f4ac823300fac1fb4b8f8108459d8}{th\_generation}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01768}01768         pps-\/>capth = th;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01769}01769 \textcolor{preprocessor}{\#ifdef FFCLOCK}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01770}01770         pps-\/>capffth = fftimehands;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01771}01771 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01772}01772         pps-\/>capcount = th-\/>\mbox{\hyperlink{structtimehands_a6e873b4aa6fa46eaad2c2b7199ed7555}{th\_counter}}-\/>tc\_get\_timecount(th-\/>\mbox{\hyperlink{structtimehands_a6e873b4aa6fa46eaad2c2b7199ed7555}{th\_counter}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01773}01773         atomic\_thread\_fence\_acq();}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01774}01774         \textcolor{keywordflow}{if} (pps-\/>capgen != th-\/>\mbox{\hyperlink{structtimehands_a759f4ac823300fac1fb4b8f8108459d8}{th\_generation}})}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01775}01775                 pps-\/>capgen = 0;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01776}01776 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01777}01777 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01778}01778 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01779}\mbox{\hyperlink{kern__tc_8c_a153f716412ebbb73a7d352b9e212b43e}{01779}} \mbox{\hyperlink{kern__tc_8c_a153f716412ebbb73a7d352b9e212b43e}{pps\_event}}(\textcolor{keyword}{struct} pps\_state *pps, \textcolor{keywordtype}{int} event)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01780}01780 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01781}01781         \textcolor{keyword}{struct }\mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} \mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01782}01782         \textcolor{keyword}{struct }timespec \mbox{\hyperlink{clock__if_8m_a919cc4bfd342c5574101ab9d56c4092a}{ts}}, *tsp, *osp;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01783}01783         u\_int tcount, *pcount;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01784}01784         \textcolor{keywordtype}{int} foff;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01785}01785         pps\_seq\_t *pseq;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01786}01786 \textcolor{preprocessor}{\#ifdef FFCLOCK}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01787}01787         \textcolor{keyword}{struct }timespec *tsp\_ffc;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01788}01788         pps\_seq\_t *pseq\_ffc;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01789}01789         ffcounter *ffcount;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01790}01790 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01791}01791 \textcolor{preprocessor}{\#ifdef PPS\_SYNC}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01792}01792         \textcolor{keywordtype}{int} fhard;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01793}01793 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01794}01794 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01795}01795         KASSERT(pps != NULL, (\textcolor{stringliteral}{"{}NULL pps pointer in pps\_event"{}}));}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01796}01796         \textcolor{comment}{/* Nothing to do if not currently set to capture this event type. */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01797}01797         \textcolor{keywordflow}{if} ((event \& pps-\/>ppsparam.mode) == 0)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01798}01798                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01799}01799         \textcolor{comment}{/* If the timecounter was wound up underneath us, bail out. */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01800}01800         \textcolor{keywordflow}{if} (pps-\/>capgen == 0 || pps-\/>capgen !=}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01801}01801             atomic\_load\_acq\_int(\&pps-\/>capth-\/>th\_generation))}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01802}01802                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01803}01803 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01804}01804         \textcolor{comment}{/* Things would be easier with arrays. */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01805}01805         \textcolor{keywordflow}{if} (event == PPS\_CAPTUREASSERT) \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01806}01806                 tsp = \&pps-\/>ppsinfo.assert\_timestamp;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01807}01807                 osp = \&pps-\/>ppsparam.assert\_offset;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01808}01808                 foff = pps-\/>ppsparam.mode \& PPS\_OFFSETASSERT;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01809}01809 \textcolor{preprocessor}{\#ifdef PPS\_SYNC}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01810}01810                 fhard = pps-\/>kcmode \& PPS\_CAPTUREASSERT;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01811}01811 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01812}01812                 pcount = \&pps-\/>ppscount[0];}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01813}01813                 pseq = \&pps-\/>ppsinfo.assert\_sequence;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01814}01814 \textcolor{preprocessor}{\#ifdef FFCLOCK}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01815}01815                 ffcount = \&pps-\/>ppsinfo\_ffc.assert\_ffcount;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01816}01816                 tsp\_ffc = \&pps-\/>ppsinfo\_ffc.assert\_timestamp;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01817}01817                 pseq\_ffc = \&pps-\/>ppsinfo\_ffc.assert\_sequence;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01818}01818 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01819}01819         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01820}01820                 tsp = \&pps-\/>ppsinfo.clear\_timestamp;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01821}01821                 osp = \&pps-\/>ppsparam.clear\_offset;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01822}01822                 foff = pps-\/>ppsparam.mode \& PPS\_OFFSETCLEAR;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01823}01823 \textcolor{preprocessor}{\#ifdef PPS\_SYNC}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01824}01824                 fhard = pps-\/>kcmode \& PPS\_CAPTURECLEAR;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01825}01825 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01826}01826                 pcount = \&pps-\/>ppscount[1];}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01827}01827                 pseq = \&pps-\/>ppsinfo.clear\_sequence;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01828}01828 \textcolor{preprocessor}{\#ifdef FFCLOCK}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01829}01829                 ffcount = \&pps-\/>ppsinfo\_ffc.clear\_ffcount;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01830}01830                 tsp\_ffc = \&pps-\/>ppsinfo\_ffc.clear\_timestamp;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01831}01831                 pseq\_ffc = \&pps-\/>ppsinfo\_ffc.clear\_sequence;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01832}01832 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01833}01833         \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01834}01834 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01835}01835         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01836}01836 \textcolor{comment}{         * If the timecounter changed, we cannot compare the count values, so}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01837}01837 \textcolor{comment}{         * we have to drop the rest of the PPS-\/stuff until the next event.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01838}01838 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01839}01839         \textcolor{keywordflow}{if} (pps-\/>ppstc != pps-\/>capth-\/>th\_counter) \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01840}01840                 pps-\/>ppstc = pps-\/>capth-\/>th\_counter;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01841}01841                 *pcount = pps-\/>capcount;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01842}01842                 pps-\/>ppscount[2] = pps-\/>capcount;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01843}01843                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01844}01844         \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01845}01845 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01846}01846         \textcolor{comment}{/* Convert the count to a timespec. */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01847}01847         tcount = pps-\/>capcount -\/ pps-\/>capth-\/>th\_offset\_count;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01848}01848         tcount \&= pps-\/>capth-\/>th\_counter-\/>tc\_counter\_mask;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01849}01849         \mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}} = pps-\/>capth-\/>th\_bintime;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01850}01850         bintime\_addx(\&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, pps-\/>capth-\/>th\_scale * tcount);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01851}01851         bintime2timespec(\&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, \&\mbox{\hyperlink{clock__if_8m_a919cc4bfd342c5574101ab9d56c4092a}{ts}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01852}01852 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01853}01853         \textcolor{comment}{/* If the timecounter was wound up underneath us, bail out. */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01854}01854         atomic\_thread\_fence\_acq();}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01855}01855         \textcolor{keywordflow}{if} (pps-\/>capgen != pps-\/>capth-\/>th\_generation)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01856}01856                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01857}01857 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01858}01858         *pcount = pps-\/>capcount;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01859}01859         (*pseq)++;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01860}01860         *tsp = \mbox{\hyperlink{clock__if_8m_a919cc4bfd342c5574101ab9d56c4092a}{ts}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01861}01861 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01862}01862         \textcolor{keywordflow}{if} (foff) \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01863}01863                 timespecadd(tsp, osp, tsp);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01864}01864                 \textcolor{keywordflow}{if} (tsp-\/>tv\_nsec < 0) \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01865}01865                         tsp-\/>tv\_nsec += 1000000000;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01866}01866                         tsp-\/>tv\_sec -\/= 1;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01867}01867                 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01868}01868         \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01869}01869 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01870}01870 \textcolor{preprocessor}{\#ifdef FFCLOCK}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01871}01871         *ffcount = pps-\/>capffth-\/>tick\_ffcount + tcount;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01872}01872         \mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}} = pps-\/>capffth-\/>tick\_time;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01873}01873         ffclock\_convert\_delta(tcount, pps-\/>capffth-\/>cest.period, \&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01874}01874         bintime\_add(\&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, \&pps-\/>capffth-\/>tick\_time);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01875}01875         bintime2timespec(\&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, \&\mbox{\hyperlink{clock__if_8m_a919cc4bfd342c5574101ab9d56c4092a}{ts}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01876}01876         (*pseq\_ffc)++;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01877}01877         *tsp\_ffc = \mbox{\hyperlink{clock__if_8m_a919cc4bfd342c5574101ab9d56c4092a}{ts}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01878}01878 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01879}01879 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01880}01880 \textcolor{preprocessor}{\#ifdef PPS\_SYNC}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01881}01881         \textcolor{keywordflow}{if} (fhard) \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01882}01882                 uint64\_t scale;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01883}01883 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01884}01884                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01885}01885 \textcolor{comment}{                 * Feed the NTP PLL/FLL.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01886}01886 \textcolor{comment}{                 * The FLL wants to know how many (hardware) nanoseconds}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01887}01887 \textcolor{comment}{                 * elapsed since the previous event.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01888}01888 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01889}01889                 tcount = pps-\/>capcount -\/ pps-\/>ppscount[2];}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01890}01890                 pps-\/>ppscount[2] = pps-\/>capcount;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01891}01891                 tcount \&= pps-\/>capth-\/>th\_counter-\/>tc\_counter\_mask;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01892}01892                 scale = (uint64\_t)1 << 63;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01893}01893                 scale /= pps-\/>capth-\/>th\_counter-\/>tc\_frequency;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01894}01894                 scale *= 2;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01895}01895                 \mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}.sec = 0;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01896}01896                 \mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}.frac = 0;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01897}01897                 bintime\_addx(\&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, scale * tcount);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01898}01898                 bintime2timespec(\&\mbox{\hyperlink{kern__boottrace_8c_a596ddb522df5190ae49e6a11a7075565}{bt}}, \&\mbox{\hyperlink{clock__if_8m_a919cc4bfd342c5574101ab9d56c4092a}{ts}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01899}01899                 hardpps(tsp, \mbox{\hyperlink{clock__if_8m_a919cc4bfd342c5574101ab9d56c4092a}{ts}}.tv\_nsec + 1000000000 * \mbox{\hyperlink{clock__if_8m_a919cc4bfd342c5574101ab9d56c4092a}{ts}}.tv\_sec);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01900}01900         \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01901}01901 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01902}01902 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01903}01903         \textcolor{comment}{/* Wakeup anyone sleeping in pps\_fetch().  */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01904}01904         \mbox{\hyperlink{kern__synch_8c_ab5e31e48f559b1015c09a61a83c59f19}{wakeup}}(pps);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01905}01905 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01906}01906 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01907}01907 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01908}01908 \textcolor{comment}{ * Timecounters need to be updated every so often to prevent the hardware}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01909}01909 \textcolor{comment}{ * counter from overflowing.  Updating also recalculates the cached values}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01910}01910 \textcolor{comment}{ * used by the get*() family of functions, so their precision depends on}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01911}01911 \textcolor{comment}{ * the update frequency.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01912}01912 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01913}01913 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01914}\mbox{\hyperlink{kern__tc_8c_a3ac7a4a47cc9cfdefac26b614dfa954f}{01914}} \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{kern__tc_8c_a3ac7a4a47cc9cfdefac26b614dfa954f}{tc\_tick}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01915}\mbox{\hyperlink{kern__tc_8c_a6b71bee54ca7dc43591119c153c27475}{01915}} \mbox{\hyperlink{kern__tc_8c_a5bf4904ccdc09180ec4cd7788bc1d1d1}{SYSCTL\_INT}}(\_kern\_timecounter, OID\_AUTO, \mbox{\hyperlink{subr__param_8c_ad4e0bbc0cc0ffb91120206fb4de60261}{tick}}, CTLFLAG\_RD, \&\mbox{\hyperlink{kern__tc_8c_a3ac7a4a47cc9cfdefac26b614dfa954f}{tc\_tick}}, 0,}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01916}01916     \textcolor{stringliteral}{"{}Approximate number of hardclock ticks in a millisecond"{}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01917}01917 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01918}01918 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01919}\mbox{\hyperlink{kern__tc_8c_a012745037eea31e68a0ca7f80af356e7}{01919}} \mbox{\hyperlink{kern__tc_8c_a012745037eea31e68a0ca7f80af356e7}{tc\_ticktock}}(\textcolor{keywordtype}{int} cnt)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01920}01920 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01921}01921         \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{cpufreq__if_8m_ad43c3812e6d13e0518d9f8b8f463ffcf}{count}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01922}01922 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01923}01923         \textcolor{keywordflow}{if} (mtx\_trylock\_spin(\&\mbox{\hyperlink{kern__tc_8c_a5f453642f0b8c19f9307eec532719616}{tc\_setclock\_mtx}})) \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01924}01924                 \mbox{\hyperlink{cpufreq__if_8m_ad43c3812e6d13e0518d9f8b8f463ffcf}{count}} += cnt;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01925}01925                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{cpufreq__if_8m_ad43c3812e6d13e0518d9f8b8f463ffcf}{count}} >= \mbox{\hyperlink{kern__tc_8c_a3ac7a4a47cc9cfdefac26b614dfa954f}{tc\_tick}}) \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01926}01926                         \mbox{\hyperlink{cpufreq__if_8m_ad43c3812e6d13e0518d9f8b8f463ffcf}{count}} = 0;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01927}01927                         \mbox{\hyperlink{kern__tc_8c_a1c0ca4641e0c89396367d12d1ddfc9e8}{tc\_windup}}(NULL);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01928}01928                 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01929}01929                 mtx\_unlock\_spin(\&\mbox{\hyperlink{kern__tc_8c_a5f453642f0b8c19f9307eec532719616}{tc\_setclock\_mtx}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01930}01930         \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01931}01931 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01932}01932 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01933}01933 \textcolor{keyword}{static} \textcolor{keywordtype}{void} \_\_inline}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01934}\mbox{\hyperlink{kern__tc_8c_a34f59e29e1f514e12681bd82fcf399e5}{01934}} \mbox{\hyperlink{kern__tc_8c_a34f59e29e1f514e12681bd82fcf399e5}{tc\_adjprecision}}(\textcolor{keywordtype}{void})}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01935}01935 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01936}01936         \textcolor{keywordtype}{int} t;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01937}01937 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01938}01938         \textcolor{keywordflow}{if} (\mbox{\hyperlink{kern__tc_8c_a3f0e2905019433f357de2eac13da43c9}{tc\_timepercentage}} > 0) \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01939}01939                 t = (99 + \mbox{\hyperlink{kern__tc_8c_a3f0e2905019433f357de2eac13da43c9}{tc\_timepercentage}}) / \mbox{\hyperlink{kern__tc_8c_a3f0e2905019433f357de2eac13da43c9}{tc\_timepercentage}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01940}01940                 \mbox{\hyperlink{kern__tc_8c_a78dc54706cfbd50692ea2c3dcdb32786}{tc\_precexp}} = fls(t + (t >> 1)) -\/ 1;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01941}01941                 FREQ2BT(\mbox{\hyperlink{subr__param_8c_a873124c5659edc141c67aab7999e314a}{hz}} / \mbox{\hyperlink{kern__tc_8c_a3ac7a4a47cc9cfdefac26b614dfa954f}{tc\_tick}}, \&\mbox{\hyperlink{kern__tc_8c_aec1113073735ccd4c87914009bc35f9b}{bt\_timethreshold}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01942}01942                 FREQ2BT(\mbox{\hyperlink{subr__param_8c_a873124c5659edc141c67aab7999e314a}{hz}}, \&\mbox{\hyperlink{kern__tc_8c_a6e0462d2805ca97c64bbeaf7973e453b}{bt\_tickthreshold}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01943}01943                 bintime\_shift(\&\mbox{\hyperlink{kern__tc_8c_aec1113073735ccd4c87914009bc35f9b}{bt\_timethreshold}}, \mbox{\hyperlink{kern__tc_8c_a78dc54706cfbd50692ea2c3dcdb32786}{tc\_precexp}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01944}01944                 bintime\_shift(\&\mbox{\hyperlink{kern__tc_8c_a6e0462d2805ca97c64bbeaf7973e453b}{bt\_tickthreshold}}, \mbox{\hyperlink{kern__tc_8c_a78dc54706cfbd50692ea2c3dcdb32786}{tc\_precexp}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01945}01945         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01946}01946                 \mbox{\hyperlink{kern__tc_8c_a78dc54706cfbd50692ea2c3dcdb32786}{tc\_precexp}} = 31;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01947}01947                 \mbox{\hyperlink{kern__tc_8c_aec1113073735ccd4c87914009bc35f9b}{bt\_timethreshold}}.sec = INT\_MAX;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01948}01948                 \mbox{\hyperlink{kern__tc_8c_aec1113073735ccd4c87914009bc35f9b}{bt\_timethreshold}}.frac = \string~(uint64\_t)0;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01949}01949                 \mbox{\hyperlink{kern__tc_8c_a6e0462d2805ca97c64bbeaf7973e453b}{bt\_tickthreshold}} = \mbox{\hyperlink{kern__tc_8c_aec1113073735ccd4c87914009bc35f9b}{bt\_timethreshold}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01950}01950         \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01951}01951         \mbox{\hyperlink{kern__tc_8c_a71ae670efe8fdafc9addefffba192257}{sbt\_timethreshold}} = bttosbt(\mbox{\hyperlink{kern__tc_8c_aec1113073735ccd4c87914009bc35f9b}{bt\_timethreshold}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01952}01952         \mbox{\hyperlink{kern__tc_8c_aa009b701b79efa61d623d434ca926398}{sbt\_tickthreshold}} = bttosbt(\mbox{\hyperlink{kern__tc_8c_a6e0462d2805ca97c64bbeaf7973e453b}{bt\_tickthreshold}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01953}01953 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01954}01954 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01955}01955 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01956}\mbox{\hyperlink{kern__tc_8c_a8504d0a71d51f3e9a2650a6a968309de}{01956}} \mbox{\hyperlink{kern__tc_8c_a8504d0a71d51f3e9a2650a6a968309de}{sysctl\_kern\_timecounter\_adjprecision}}(SYSCTL\_HANDLER\_ARGS)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01957}01957 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01958}01958         \textcolor{keywordtype}{int} error, val;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01959}01959 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01960}01960         val = \mbox{\hyperlink{kern__tc_8c_a3f0e2905019433f357de2eac13da43c9}{tc\_timepercentage}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01961}01961         error = \mbox{\hyperlink{kern__sysctl_8c_aab82ede27ea5d6975c4e91eb6c6111b7}{sysctl\_handle\_int}}(oidp, \&val, 0, req);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01962}01962         \textcolor{keywordflow}{if} (error != 0 || req-\/>newptr == NULL)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01963}01963                 \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01964}01964         \mbox{\hyperlink{kern__tc_8c_a3f0e2905019433f357de2eac13da43c9}{tc\_timepercentage}} = val;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01965}01965         \textcolor{keywordflow}{if} (cold)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01966}01966                 \textcolor{keywordflow}{goto} done;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01967}01967         \mbox{\hyperlink{kern__tc_8c_a34f59e29e1f514e12681bd82fcf399e5}{tc\_adjprecision}}();}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01968}01968 done:}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01969}01969         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01970}01970 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01971}01971 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01972}01972 \textcolor{comment}{/* Set up the requested number of timehands. */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01973}01973 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01974}\mbox{\hyperlink{kern__tc_8c_a150f52840af4d5ffc6514bff12d6ca1c}{01974}} \mbox{\hyperlink{kern__tc_8c_a150f52840af4d5ffc6514bff12d6ca1c}{inittimehands}}(\textcolor{keywordtype}{void} *\mbox{\hyperlink{uipc__sockbuf_8c_a7c1d654b7b6114d7a0abc8d351dd1bcd}{dummy}})}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01975}01975 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01976}01976         \textcolor{keyword}{struct }\mbox{\hyperlink{structtimehands}{timehands}} *thp;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01977}01977         \textcolor{keywordtype}{int} i;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01978}01978 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01979}01979         TUNABLE\_INT\_FETCH(\textcolor{stringliteral}{"{}kern.timecounter.timehands\_count"{}},}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01980}01980             \&\mbox{\hyperlink{kern__tc_8c_aeb6284732160c7e55ebb1824db8c3462}{timehands\_count}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01981}01981         \textcolor{keywordflow}{if} (\mbox{\hyperlink{kern__tc_8c_aeb6284732160c7e55ebb1824db8c3462}{timehands\_count}} < 1)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01982}01982                 \mbox{\hyperlink{kern__tc_8c_aeb6284732160c7e55ebb1824db8c3462}{timehands\_count}} = 1;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01983}01983         \textcolor{keywordflow}{if} (\mbox{\hyperlink{kern__tc_8c_aeb6284732160c7e55ebb1824db8c3462}{timehands\_count}} > nitems(\mbox{\hyperlink{kern__tc_8c_a96f1a609fd665fa80e75908e37e2d6a7}{ths}}))}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01984}01984                 \mbox{\hyperlink{kern__tc_8c_aeb6284732160c7e55ebb1824db8c3462}{timehands\_count}} = nitems(\mbox{\hyperlink{kern__tc_8c_a96f1a609fd665fa80e75908e37e2d6a7}{ths}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01985}01985         \textcolor{keywordflow}{for} (i = 1, thp = \&\mbox{\hyperlink{kern__tc_8c_a96f1a609fd665fa80e75908e37e2d6a7}{ths}}[0]; i < \mbox{\hyperlink{kern__tc_8c_aeb6284732160c7e55ebb1824db8c3462}{timehands\_count}};  thp = \&\mbox{\hyperlink{kern__tc_8c_a96f1a609fd665fa80e75908e37e2d6a7}{ths}}[i++])}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01986}01986                 thp-\/>\mbox{\hyperlink{structtimehands_aacc6032d0d797b8a67a36df3ca117021}{th\_next}} = \&\mbox{\hyperlink{kern__tc_8c_a96f1a609fd665fa80e75908e37e2d6a7}{ths}}[i];}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01987}01987         thp-\/>\mbox{\hyperlink{structtimehands_aacc6032d0d797b8a67a36df3ca117021}{th\_next}} = \&\mbox{\hyperlink{kern__tc_8c_a96f1a609fd665fa80e75908e37e2d6a7}{ths}}[0];}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01988}01988 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01989}01989         TUNABLE\_STR\_FETCH(\textcolor{stringliteral}{"{}kern.timecounter.hardware"{}}, \mbox{\hyperlink{kern__tc_8c_a908d1ad161fecd877fe78a3ce4174e73}{tc\_from\_tunable}},}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01990}01990             \textcolor{keyword}{sizeof}(\mbox{\hyperlink{kern__tc_8c_a908d1ad161fecd877fe78a3ce4174e73}{tc\_from\_tunable}}));}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01991}01991 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01992}01992         mtx\_init(\&\mbox{\hyperlink{kern__tc_8c_a72c9ec426d6d3cd3f45c5d1e9f5088c1}{tc\_lock}}, \textcolor{stringliteral}{"{}tc"{}}, NULL, MTX\_DEF);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01993}01993 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01994}\mbox{\hyperlink{kern__tc_8c_a6a691d45d148127f18f59d6008783183}{01994}} \mbox{\hyperlink{kern__tc_8c_a6a691d45d148127f18f59d6008783183}{SYSINIT}}(\mbox{\hyperlink{structtimehands}{timehands}}, SI\_SUB\_TUNABLES, SI\_ORDER\_ANY, \mbox{\hyperlink{kern__tc_8c_a150f52840af4d5ffc6514bff12d6ca1c}{inittimehands}}, NULL);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01995}01995 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01996}01996 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01997}\mbox{\hyperlink{kern__tc_8c_afa400bc6f19d53b43ff1fc5019273cf8}{01997}} \mbox{\hyperlink{kern__tc_8c_afa400bc6f19d53b43ff1fc5019273cf8}{inittimecounter}}(\textcolor{keywordtype}{void} *\mbox{\hyperlink{uipc__sockbuf_8c_a7c1d654b7b6114d7a0abc8d351dd1bcd}{dummy}})}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01998}01998 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l01999}01999         u\_int p;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02000}02000         \textcolor{keywordtype}{int} tick\_rate;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02001}02001 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02002}02002         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02003}02003 \textcolor{comment}{         * Set the initial timeout to}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02004}02004 \textcolor{comment}{         * max(1, <approx. number of hardclock ticks in a millisecond>).}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02005}02005 \textcolor{comment}{         * People should probably not use the sysctl to set the timeout}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02006}02006 \textcolor{comment}{         * to smaller than its initial value, since that value is the}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02007}02007 \textcolor{comment}{         * smallest reasonable one.  If they want better timestamps they}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02008}02008 \textcolor{comment}{         * should use the non-\/"{}get"{}* functions.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02009}02009 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02010}02010         \textcolor{keywordflow}{if} (\mbox{\hyperlink{subr__param_8c_a873124c5659edc141c67aab7999e314a}{hz}} > 1000)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02011}02011                 \mbox{\hyperlink{kern__tc_8c_a3ac7a4a47cc9cfdefac26b614dfa954f}{tc\_tick}} = (\mbox{\hyperlink{subr__param_8c_a873124c5659edc141c67aab7999e314a}{hz}} + 500) / 1000;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02012}02012         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02013}02013                 \mbox{\hyperlink{kern__tc_8c_a3ac7a4a47cc9cfdefac26b614dfa954f}{tc\_tick}} = 1;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02014}02014         \mbox{\hyperlink{kern__tc_8c_a34f59e29e1f514e12681bd82fcf399e5}{tc\_adjprecision}}();}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02015}02015         FREQ2BT(\mbox{\hyperlink{subr__param_8c_a873124c5659edc141c67aab7999e314a}{hz}}, \&\mbox{\hyperlink{subr__param_8c_a45f3ffd8d59f43f40a75e35aa58029d9}{tick\_bt}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02016}02016         \mbox{\hyperlink{subr__param_8c_ac2dd3f5b3c38e4ad54591fe0044c685e}{tick\_sbt}} = bttosbt(\mbox{\hyperlink{subr__param_8c_a45f3ffd8d59f43f40a75e35aa58029d9}{tick\_bt}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02017}02017         tick\_rate = \mbox{\hyperlink{subr__param_8c_a873124c5659edc141c67aab7999e314a}{hz}} / \mbox{\hyperlink{kern__tc_8c_a3ac7a4a47cc9cfdefac26b614dfa954f}{tc\_tick}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02018}02018         FREQ2BT(tick\_rate, \&\mbox{\hyperlink{kern__tc_8c_a7d29c90041e517f5b69372d52805cece}{tc\_tick\_bt}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02019}02019         \mbox{\hyperlink{kern__tc_8c_a1a43259235d891d84345bcf2140ada43}{tc\_tick\_sbt}} = bttosbt(\mbox{\hyperlink{kern__tc_8c_a7d29c90041e517f5b69372d52805cece}{tc\_tick\_bt}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02020}02020         p = (\mbox{\hyperlink{kern__tc_8c_a3ac7a4a47cc9cfdefac26b614dfa954f}{tc\_tick}} * 1000000) / \mbox{\hyperlink{subr__param_8c_a873124c5659edc141c67aab7999e314a}{hz}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02021}02021         \mbox{\hyperlink{subr__prf_8c_a55f3d956bb2ba20b5059e9e25484a47f}{printf}}(\textcolor{stringliteral}{"{}Timecounters tick every \%d.\%03u msec\(\backslash\)n"{}}, p / 1000, p \% 1000);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02022}02022 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02023}02023 \textcolor{preprocessor}{\#ifdef FFCLOCK}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02024}02024         ffclock\_init();}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02025}02025 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02026}02026 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02027}02027         \textcolor{comment}{/* warm up new timecounter (again) and get rolling. */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02028}02028         (void)\mbox{\hyperlink{kern__tc_8c_a35098fc91b751950a191213b1c2e5853}{timecounter}}-\/>tc\_get\_timecount(\mbox{\hyperlink{kern__tc_8c_a35098fc91b751950a191213b1c2e5853}{timecounter}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02029}02029         mtx\_lock\_spin(\&\mbox{\hyperlink{kern__tc_8c_a5f453642f0b8c19f9307eec532719616}{tc\_setclock\_mtx}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02030}02030         \mbox{\hyperlink{kern__tc_8c_a1c0ca4641e0c89396367d12d1ddfc9e8}{tc\_windup}}(NULL);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02031}02031         mtx\_unlock\_spin(\&\mbox{\hyperlink{kern__tc_8c_a5f453642f0b8c19f9307eec532719616}{tc\_setclock\_mtx}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02032}02032 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02033}02033 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02034}\mbox{\hyperlink{kern__tc_8c_ada290ddcbf6b369e9305e3a13593a515}{02034}} \mbox{\hyperlink{kern__tc_8c_a6a691d45d148127f18f59d6008783183}{SYSINIT}}(\mbox{\hyperlink{kern__tc_8c_a35098fc91b751950a191213b1c2e5853}{timecounter}}, SI\_SUB\_CLOCKS, SI\_ORDER\_SECOND, \mbox{\hyperlink{kern__tc_8c_afa400bc6f19d53b43ff1fc5019273cf8}{inittimecounter}}, NULL);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02035}02035 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02036}02036 \textcolor{comment}{/* Cpu tick handling -\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/*/}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02037}02037 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02038}\mbox{\hyperlink{kern__tc_8c_a134f43671eaefe10a95593658ecfd901}{02038}} \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{kern__tc_8c_a134f43671eaefe10a95593658ecfd901}{cpu\_tick\_variable}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02039}\mbox{\hyperlink{kern__tc_8c_a2a71001aa4a7447c92eccd59c945c526}{02039}} \textcolor{keyword}{static} uint64\_t \mbox{\hyperlink{kern__tc_8c_a2a71001aa4a7447c92eccd59c945c526}{cpu\_tick\_frequency}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02040}02040 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02041}\mbox{\hyperlink{kern__tc_8c_a332eb7aba13e67c69d1c45b5ca078189}{02041}} \mbox{\hyperlink{kern__tc_8c_a332eb7aba13e67c69d1c45b5ca078189}{DPCPU\_DEFINE\_STATIC}}(uint64\_t, tc\_cpu\_ticks\_base);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02042}\mbox{\hyperlink{kern__tc_8c_a2b274e2e17b61d92174c32e0578d3607}{02042}} \mbox{\hyperlink{kern__tc_8c_a332eb7aba13e67c69d1c45b5ca078189}{DPCPU\_DEFINE\_STATIC}}(\textcolor{keywordtype}{unsigned}, tc\_cpu\_ticks\_last);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02043}02043 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02044}02044 \textcolor{keyword}{static} uint64\_t}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02045}\mbox{\hyperlink{kern__tc_8c_ada36d2e0de4833bc770e5652cf07f861}{02045}} \mbox{\hyperlink{kern__tc_8c_ada36d2e0de4833bc770e5652cf07f861}{tc\_cpu\_ticks}}(\textcolor{keywordtype}{void})}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02046}02046 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02047}02047         \textcolor{keyword}{struct }\mbox{\hyperlink{kern__tc_8c_a35098fc91b751950a191213b1c2e5853}{timecounter}} *tc;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02048}02048         uint64\_t \mbox{\hyperlink{pic__if_8m_a3cbc3b98ed07988f5e3be53a0eebbb92}{res}}, *base;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02049}02049         \textcolor{keywordtype}{unsigned} u, *last;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02050}02050 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02051}02051         critical\_enter();}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02052}02052         base = DPCPU\_PTR(tc\_cpu\_ticks\_base);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02053}02053         last = DPCPU\_PTR(tc\_cpu\_ticks\_last);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02054}02054         tc = \mbox{\hyperlink{structtimehands}{timehands}}-\/>\mbox{\hyperlink{structtimehands_a6e873b4aa6fa46eaad2c2b7199ed7555}{th\_counter}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02055}02055         u = tc-\/>tc\_get\_timecount(tc) \& tc-\/>tc\_counter\_mask;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02056}02056         \textcolor{keywordflow}{if} (u < *last)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02057}02057                 *base += (uint64\_t)tc-\/>tc\_counter\_mask + 1;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02058}02058         *last = u;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02059}02059         \mbox{\hyperlink{pic__if_8m_a3cbc3b98ed07988f5e3be53a0eebbb92}{res}} = u + *base;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02060}02060         critical\_exit();}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02061}02061         \textcolor{keywordflow}{return} (\mbox{\hyperlink{pic__if_8m_a3cbc3b98ed07988f5e3be53a0eebbb92}{res}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02062}02062 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02063}02063 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02064}02064 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02065}\mbox{\hyperlink{kern__tc_8c_a96f6413b506d5e166f6bfebf5a20b927}{02065}} \mbox{\hyperlink{kern__tc_8c_a96f6413b506d5e166f6bfebf5a20b927}{cpu\_tick\_calibration}}(\textcolor{keywordtype}{void})}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02066}02066 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02067}02067         \textcolor{keyword}{static} time\_t last\_calib;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02068}02068 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02069}02069         \textcolor{keywordflow}{if} (\mbox{\hyperlink{kern__tc_8c_a6dd117214f5c023a10c9b887218545d5}{time\_uptime}} != last\_calib \&\& !(\mbox{\hyperlink{kern__tc_8c_a6dd117214f5c023a10c9b887218545d5}{time\_uptime}} \& 0xf)) \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02070}02070                 \mbox{\hyperlink{kern__tc_8c_a4c41c76d31bf0a9205130acc4cf3d8b6}{cpu\_tick\_calibrate}}(0);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02071}02071                 last\_calib = \mbox{\hyperlink{kern__tc_8c_a6dd117214f5c023a10c9b887218545d5}{time\_uptime}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02072}02072         \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02073}02073 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02074}02074 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02075}02075 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02076}02076 \textcolor{comment}{ * This function gets called every 16 seconds on only one designated}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02077}02077 \textcolor{comment}{ * CPU in the system from hardclock() via cpu\_tick\_calibration()().}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02078}02078 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02079}02079 \textcolor{comment}{ * Whenever the real time clock is stepped we get called with reset=1}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02080}02080 \textcolor{comment}{ * to make sure we handle suspend/resume and similar events correctly.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02081}02081 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02082}02082 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02083}02083 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02084}\mbox{\hyperlink{kern__tc_8c_a4c41c76d31bf0a9205130acc4cf3d8b6}{02084}} \mbox{\hyperlink{kern__tc_8c_a4c41c76d31bf0a9205130acc4cf3d8b6}{cpu\_tick\_calibrate}}(\textcolor{keywordtype}{int} reset)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02085}02085 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02086}02086         \textcolor{keyword}{static} uint64\_t c\_last;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02087}02087         uint64\_t c\_this, c\_delta;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02088}02088         \textcolor{keyword}{static} \textcolor{keyword}{struct }\mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}}  t\_last;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02089}02089         \textcolor{keyword}{struct }\mbox{\hyperlink{kern__tc_8c_aac927490bc0ff04f59f665964132ed21}{bintime}} t\_this, t\_delta;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02090}02090         uint32\_t divi;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02091}02091 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02092}02092         \textcolor{keywordflow}{if} (reset) \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02093}02093                 \textcolor{comment}{/* The clock was stepped, abort \& reset */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02094}02094                 t\_last.sec = 0;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02095}02095                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02096}02096         \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02097}02097 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02098}02098         \textcolor{comment}{/* we don't calibrate fixed rate cputicks */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02099}02099         \textcolor{keywordflow}{if} (!\mbox{\hyperlink{kern__tc_8c_a134f43671eaefe10a95593658ecfd901}{cpu\_tick\_variable}})}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02100}02100                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02101}02101 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02102}02102         \mbox{\hyperlink{kern__tc_8c_a318fd9f982a1e77dedca21fc5d321ebb}{getbinuptime}}(\&t\_this);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02103}02103         c\_this = \mbox{\hyperlink{kern__tc_8c_a5030464066317b215144a28a7e529fac}{cpu\_ticks}}();}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02104}02104         \textcolor{keywordflow}{if} (t\_last.sec != 0) \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02105}02105                 c\_delta = c\_this -\/ c\_last;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02106}02106                 t\_delta = t\_this;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02107}02107                 bintime\_sub(\&t\_delta, \&t\_last);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02108}02108                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02109}02109 \textcolor{comment}{                 * Headroom:}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02110}02110 \textcolor{comment}{                 *      2\string^(64-\/20) / 16[s] =}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02111}02111 \textcolor{comment}{                 *      2\string^(44) / 16[s] =}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02112}02112 \textcolor{comment}{                 *      17.592.186.044.416 / 16 =}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02113}02113 \textcolor{comment}{                 *      1.099.511.627.776 [Hz]}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02114}02114 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02115}02115                 divi = t\_delta.sec << 20;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02116}02116                 divi |= t\_delta.frac >> (64 -\/ 20);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02117}02117                 c\_delta <<= 20;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02118}02118                 c\_delta /= divi;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02119}02119                 \textcolor{keywordflow}{if} (c\_delta > \mbox{\hyperlink{kern__tc_8c_a2a71001aa4a7447c92eccd59c945c526}{cpu\_tick\_frequency}}) \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02120}02120                         \textcolor{keywordflow}{if} (0 \&\& \mbox{\hyperlink{init__main_8c_a9e276f53af35e37a6b19419e8155f3cc}{bootverbose}})}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02121}02121                                 \mbox{\hyperlink{subr__prf_8c_a55f3d956bb2ba20b5059e9e25484a47f}{printf}}(\textcolor{stringliteral}{"{}cpu\_tick increased to \%ju Hz\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02122}02122                                     c\_delta);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02123}02123                         \mbox{\hyperlink{kern__tc_8c_a2a71001aa4a7447c92eccd59c945c526}{cpu\_tick\_frequency}} = c\_delta;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02124}02124                 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02125}02125         \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02126}02126         c\_last = c\_this;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02127}02127         t\_last = t\_this;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02128}02128 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02129}02129 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02130}02130 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02131}\mbox{\hyperlink{kern__tc_8c_a1fc55de6f580c12e9bf799780c624d77}{02131}} \mbox{\hyperlink{kern__tc_8c_a1fc55de6f580c12e9bf799780c624d77}{set\_cputicker}}(cpu\_tick\_f *func, uint64\_t freq, \textcolor{keywordtype}{unsigned} var)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02132}02132 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02133}02133 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02134}02134         \textcolor{keywordflow}{if} (func == NULL) \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02135}02135                 \mbox{\hyperlink{kern__tc_8c_a5030464066317b215144a28a7e529fac}{cpu\_ticks}} = \mbox{\hyperlink{kern__tc_8c_ada36d2e0de4833bc770e5652cf07f861}{tc\_cpu\_ticks}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02136}02136         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02137}02137                 \mbox{\hyperlink{kern__tc_8c_a2a71001aa4a7447c92eccd59c945c526}{cpu\_tick\_frequency}} = freq;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02138}02138                 \mbox{\hyperlink{kern__tc_8c_a134f43671eaefe10a95593658ecfd901}{cpu\_tick\_variable}} = var;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02139}02139                 \mbox{\hyperlink{kern__tc_8c_a5030464066317b215144a28a7e529fac}{cpu\_ticks}} = func;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02140}02140         \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02141}02141 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02142}02142 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02143}02143 uint64\_t}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02144}\mbox{\hyperlink{kern__tc_8c_af148b53f7fb7d591c49b6c3a965ca635}{02144}} \mbox{\hyperlink{kern__tc_8c_af148b53f7fb7d591c49b6c3a965ca635}{cpu\_tickrate}}(\textcolor{keywordtype}{void})}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02145}02145 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02146}02146 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02147}02147         \textcolor{keywordflow}{if} (\mbox{\hyperlink{kern__tc_8c_a5030464066317b215144a28a7e529fac}{cpu\_ticks}} == \mbox{\hyperlink{kern__tc_8c_ada36d2e0de4833bc770e5652cf07f861}{tc\_cpu\_ticks}}) }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02148}02148                 \textcolor{keywordflow}{return} (\mbox{\hyperlink{kern__tc_8c_a55963d38e1886fac24437a71e8a4d7ea}{tc\_getfrequency}}());}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02149}02149         \textcolor{keywordflow}{return} (\mbox{\hyperlink{kern__tc_8c_a2a71001aa4a7447c92eccd59c945c526}{cpu\_tick\_frequency}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02150}02150 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02151}02151 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02152}02152 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02153}02153 \textcolor{comment}{ * We need to be slightly careful converting cputicks to microseconds.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02154}02154 \textcolor{comment}{ * There is plenty of margin in 64 bits of microseconds (half a million}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02155}02155 \textcolor{comment}{ * years) and in 64 bits at 4 GHz (146 years), but if we do a multiply}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02156}02156 \textcolor{comment}{ * before divide conversion (to retain precision) we find that the}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02157}02157 \textcolor{comment}{ * margin shrinks to 1.5 hours (one millionth of 146y).}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02158}02158 \textcolor{comment}{ * With a three prong approach we never lose significant bits, no}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02159}02159 \textcolor{comment}{ * matter what the cputick rate and length of timeinterval is.}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02160}02160 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02161}02161 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02162}02162 uint64\_t}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02163}\mbox{\hyperlink{kern__tc_8c_af710d850b194089c84c35bbc5483bdfd}{02163}} \mbox{\hyperlink{kern__tc_8c_af710d850b194089c84c35bbc5483bdfd}{cputick2usec}}(uint64\_t \mbox{\hyperlink{subr__param_8c_ad4e0bbc0cc0ffb91120206fb4de60261}{tick}})}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02164}02164 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02165}02165 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02166}02166         \textcolor{keywordflow}{if} (\mbox{\hyperlink{subr__param_8c_ad4e0bbc0cc0ffb91120206fb4de60261}{tick}} > 18446744073709551LL)             \textcolor{comment}{/* floor(2\string^64 / 1000) */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02167}02167                 \textcolor{keywordflow}{return} (\mbox{\hyperlink{subr__param_8c_ad4e0bbc0cc0ffb91120206fb4de60261}{tick}} / (\mbox{\hyperlink{kern__tc_8c_af148b53f7fb7d591c49b6c3a965ca635}{cpu\_tickrate}}() / 1000000LL));}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02168}02168         \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (\mbox{\hyperlink{subr__param_8c_ad4e0bbc0cc0ffb91120206fb4de60261}{tick}} > 18446744073709LL)   \textcolor{comment}{/* floor(2\string^64 / 1000000) */}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02169}02169                 \textcolor{keywordflow}{return} ((\mbox{\hyperlink{subr__param_8c_ad4e0bbc0cc0ffb91120206fb4de60261}{tick}} * 1000LL) / (\mbox{\hyperlink{kern__tc_8c_af148b53f7fb7d591c49b6c3a965ca635}{cpu\_tickrate}}() / 1000LL));}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02170}02170         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02171}02171                 \textcolor{keywordflow}{return} ((\mbox{\hyperlink{subr__param_8c_ad4e0bbc0cc0ffb91120206fb4de60261}{tick}} * 1000000LL) / \mbox{\hyperlink{kern__tc_8c_af148b53f7fb7d591c49b6c3a965ca635}{cpu\_tickrate}}());}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02172}02172 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02173}02173 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02174}\mbox{\hyperlink{kern__tc_8c_a5030464066317b215144a28a7e529fac}{02174}} cpu\_tick\_f      *\mbox{\hyperlink{kern__tc_8c_a5030464066317b215144a28a7e529fac}{cpu\_ticks}} = \mbox{\hyperlink{kern__tc_8c_ada36d2e0de4833bc770e5652cf07f861}{tc\_cpu\_ticks}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02175}02175 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02176}\mbox{\hyperlink{kern__tc_8c_aeacd1e5a2d79231cc0d85a7f325961b3}{02176}} \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{kern__tc_8c_aeacd1e5a2d79231cc0d85a7f325961b3}{vdso\_th\_enable}} = 1;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02177}02177 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02178}\mbox{\hyperlink{kern__tc_8c_acbd415df901aa87cdabc1798fae6a450}{02178}} \mbox{\hyperlink{kern__tc_8c_acbd415df901aa87cdabc1798fae6a450}{sysctl\_fast\_gettime}}(SYSCTL\_HANDLER\_ARGS)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02179}02179 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02180}02180         \textcolor{keywordtype}{int} old\_vdso\_th\_enable, error;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02181}02181 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02182}02182         old\_vdso\_th\_enable = \mbox{\hyperlink{kern__tc_8c_aeacd1e5a2d79231cc0d85a7f325961b3}{vdso\_th\_enable}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02183}02183         error = \mbox{\hyperlink{kern__sysctl_8c_aab82ede27ea5d6975c4e91eb6c6111b7}{sysctl\_handle\_int}}(oidp, \&old\_vdso\_th\_enable, 0, req);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02184}02184         \textcolor{keywordflow}{if} (error != 0)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02185}02185                 \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02186}02186         \mbox{\hyperlink{kern__tc_8c_aeacd1e5a2d79231cc0d85a7f325961b3}{vdso\_th\_enable}} = old\_vdso\_th\_enable;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02187}02187         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02188}02188 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02189}\mbox{\hyperlink{kern__tc_8c_abaf4ace8e7218e9fcb6efc631ea9e22f}{02189}} \mbox{\hyperlink{kern__tc_8c_a471ba6ecd69584c29ffe77bab6c7fe7d}{SYSCTL\_PROC}}(\_kern\_timecounter, OID\_AUTO, fast\_gettime,}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02190}02190     CTLTYPE\_INT | CTLFLAG\_RW | CTLFLAG\_MPSAFE,}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02191}02191     NULL, 0, \mbox{\hyperlink{kern__tc_8c_acbd415df901aa87cdabc1798fae6a450}{sysctl\_fast\_gettime}}, \textcolor{stringliteral}{"{}I"{}}, \textcolor{stringliteral}{"{}Enable fast time of day"{}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02192}02192 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02193}02193 uint32\_t}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02194}\mbox{\hyperlink{kern__tc_8c_a2549609549149b8ac6c2cbe2a474a754}{02194}} \mbox{\hyperlink{kern__tc_8c_a2549609549149b8ac6c2cbe2a474a754}{tc\_fill\_vdso\_timehands}}(\textcolor{keyword}{struct} vdso\_timehands *vdso\_th)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02195}02195 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02196}02196         \textcolor{keyword}{struct }\mbox{\hyperlink{structtimehands}{timehands}} *th;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02197}02197         uint32\_t enabled;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02198}02198 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02199}02199         th = \mbox{\hyperlink{kern__tc_8c_a90f582e4036774428020fe41210fd9cd}{timehands}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02200}02200         vdso\_th-\/>\mbox{\hyperlink{structtimehands_a4b079bb7849db9a6ea3abf069ad8905a}{th\_scale}} = th-\/>\mbox{\hyperlink{structtimehands_a4b079bb7849db9a6ea3abf069ad8905a}{th\_scale}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02201}02201         vdso\_th-\/>th\_offset\_count = th-\/>\mbox{\hyperlink{structtimehands_a6ef254e39c5e63cae43e7952a423064d}{th\_offset\_count}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02202}02202         vdso\_th-\/>th\_counter\_mask = th-\/>\mbox{\hyperlink{structtimehands_a6e873b4aa6fa46eaad2c2b7199ed7555}{th\_counter}}-\/>tc\_counter\_mask;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02203}02203         vdso\_th-\/>th\_offset = th-\/>\mbox{\hyperlink{structtimehands_a8343df3d16d957ac6054336b6304d494}{th\_offset}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02204}02204         vdso\_th-\/>th\_boottime = th-\/>\mbox{\hyperlink{structtimehands_af3aa7f25829422014014889ad4ad9d5d}{th\_boottime}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02205}02205         \textcolor{keywordflow}{if} (th-\/>\mbox{\hyperlink{structtimehands_a6e873b4aa6fa46eaad2c2b7199ed7555}{th\_counter}}-\/>tc\_fill\_vdso\_timehands != NULL) \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02206}02206                 enabled = th-\/>\mbox{\hyperlink{structtimehands_a6e873b4aa6fa46eaad2c2b7199ed7555}{th\_counter}}-\/>tc\_fill\_vdso\_timehands(vdso\_th,}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02207}02207                     th-\/>\mbox{\hyperlink{structtimehands_a6e873b4aa6fa46eaad2c2b7199ed7555}{th\_counter}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02208}02208         \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02209}02209                 enabled = 0;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02210}02210         \textcolor{keywordflow}{if} (!\mbox{\hyperlink{kern__tc_8c_aeacd1e5a2d79231cc0d85a7f325961b3}{vdso\_th\_enable}})}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02211}02211                 enabled = 0;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02212}02212         \textcolor{keywordflow}{return} (enabled);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02213}02213 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02214}02214 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02215}02215 \textcolor{preprocessor}{\#ifdef COMPAT\_FREEBSD32}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02216}02216 uint32\_t}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02217}02217 tc\_fill\_vdso\_timehands32(\textcolor{keyword}{struct} vdso\_timehands32 *vdso\_th32)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02218}02218 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02219}02219         \textcolor{keyword}{struct }\mbox{\hyperlink{structtimehands}{timehands}} *th;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02220}02220         uint32\_t enabled;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02221}02221 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02222}02222         th = \mbox{\hyperlink{kern__tc_8c_a90f582e4036774428020fe41210fd9cd}{timehands}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02223}02223         *(uint64\_t *)\&vdso\_th32-\/>\mbox{\hyperlink{structtimehands_a4b079bb7849db9a6ea3abf069ad8905a}{th\_scale}}[0] = th-\/>\mbox{\hyperlink{structtimehands_a4b079bb7849db9a6ea3abf069ad8905a}{th\_scale}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02224}02224         vdso\_th32-\/>th\_offset\_count = th-\/>\mbox{\hyperlink{structtimehands_a6ef254e39c5e63cae43e7952a423064d}{th\_offset\_count}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02225}02225         vdso\_th32-\/>th\_counter\_mask = th-\/>\mbox{\hyperlink{structtimehands_a6e873b4aa6fa46eaad2c2b7199ed7555}{th\_counter}}-\/>tc\_counter\_mask;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02226}02226         vdso\_th32-\/>th\_offset.sec = th-\/>\mbox{\hyperlink{structtimehands_a8343df3d16d957ac6054336b6304d494}{th\_offset}}.sec;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02227}02227         *(uint64\_t *)\&vdso\_th32-\/>th\_offset.frac[0] = th-\/>\mbox{\hyperlink{structtimehands_a8343df3d16d957ac6054336b6304d494}{th\_offset}}.frac;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02228}02228         vdso\_th32-\/>th\_boottime.sec = th-\/>\mbox{\hyperlink{structtimehands_af3aa7f25829422014014889ad4ad9d5d}{th\_boottime}}.sec;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02229}02229         *(uint64\_t *)\&vdso\_th32-\/>th\_boottime.frac[0] = th-\/>\mbox{\hyperlink{structtimehands_af3aa7f25829422014014889ad4ad9d5d}{th\_boottime}}.frac;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02230}02230         if (th-\/>\mbox{\hyperlink{structtimehands_a6e873b4aa6fa46eaad2c2b7199ed7555}{th\_counter}}-\/>tc\_fill\_vdso\_timehands32 != NULL) \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02231}02231                 enabled = th-\/>\mbox{\hyperlink{structtimehands_a6e873b4aa6fa46eaad2c2b7199ed7555}{th\_counter}}-\/>tc\_fill\_vdso\_timehands32(vdso\_th32,}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02232}02232                     th-\/>\mbox{\hyperlink{structtimehands_a6e873b4aa6fa46eaad2c2b7199ed7555}{th\_counter}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02233}02233         \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02234}02234                 enabled = 0;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02235}02235         \textcolor{keywordflow}{if} (!\mbox{\hyperlink{kern__tc_8c_aeacd1e5a2d79231cc0d85a7f325961b3}{vdso\_th\_enable}})}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02236}02236                 enabled = 0;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02237}02237         \textcolor{keywordflow}{return} (enabled);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02238}02238 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02239}02239 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02240}02240 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02241}02241 \textcolor{preprocessor}{\#include "{}opt\_ddb.h"{}}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02242}02242 \textcolor{preprocessor}{\#ifdef DDB}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02243}02243 \textcolor{preprocessor}{\#include <ddb/ddb.h>}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02244}02244 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02245}02245 DB\_SHOW\_COMMAND(\mbox{\hyperlink{kern__tc_8c_a35098fc91b751950a191213b1c2e5853}{timecounter}}, db\_show\_timecounter)}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02246}02246 \{}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02247}02247         \textcolor{keyword}{struct }\mbox{\hyperlink{structtimehands}{timehands}} *th;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02248}02248         \textcolor{keyword}{struct }\mbox{\hyperlink{kern__tc_8c_a35098fc91b751950a191213b1c2e5853}{timecounter}} *tc;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02249}02249         u\_int val1, val2;}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02250}02250 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02251}02251         th = \mbox{\hyperlink{kern__tc_8c_a90f582e4036774428020fe41210fd9cd}{timehands}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02252}02252         tc = th-\/>\mbox{\hyperlink{structtimehands_a6e873b4aa6fa46eaad2c2b7199ed7555}{th\_counter}};}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02253}02253         val1 = tc-\/>tc\_get\_timecount(tc);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02254}02254         \_\_compiler\_membar();}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02255}02255         val2 = tc-\/>tc\_get\_timecount(tc);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02256}02256 }
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02257}02257         db\_printf(\textcolor{stringliteral}{"{}timecounter \%p \%s\(\backslash\)n"{}}, tc, tc-\/>tc\_name);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02258}02258         db\_printf(\textcolor{stringliteral}{"{}  mask \%\#x freq \%ju qual \%d flags \%\#x priv \%p\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02259}02259             tc-\/>tc\_counter\_mask, (uintmax\_t)tc-\/>tc\_frequency, tc-\/>tc\_quality,}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02260}02260             tc-\/>tc\_flags, tc-\/>tc\_priv);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02261}02261         db\_printf(\textcolor{stringliteral}{"{}  val \%\#x \%\#x\(\backslash\)n"{}}, val1, val2);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02262}02262         db\_printf(\textcolor{stringliteral}{"{}timehands adj \%\#jx scale \%\#jx ldelta \%d off\_cnt \%d gen \%d\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02263}02263             (uintmax\_t)th-\/>\mbox{\hyperlink{structtimehands_a8b85c0a8aa3f90feba9d4bc9cbe741b6}{th\_adjustment}}, (uintmax\_t)th-\/>\mbox{\hyperlink{structtimehands_a4b079bb7849db9a6ea3abf069ad8905a}{th\_scale}},}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02264}02264             th-\/>\mbox{\hyperlink{structtimehands_adbe021df320b1201345510bccee7bde5}{th\_large\_delta}}, th-\/>\mbox{\hyperlink{structtimehands_a6ef254e39c5e63cae43e7952a423064d}{th\_offset\_count}}, th-\/>\mbox{\hyperlink{structtimehands_a759f4ac823300fac1fb4b8f8108459d8}{th\_generation}});}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02265}02265         db\_printf(\textcolor{stringliteral}{"{}  offset \%jd \%jd boottime \%jd \%jd\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02266}02266             (intmax\_t)th-\/>\mbox{\hyperlink{structtimehands_a8343df3d16d957ac6054336b6304d494}{th\_offset}}.sec, (uintmax\_t)th-\/>\mbox{\hyperlink{structtimehands_a8343df3d16d957ac6054336b6304d494}{th\_offset}}.frac,}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02267}02267             (intmax\_t)th-\/>\mbox{\hyperlink{structtimehands_af3aa7f25829422014014889ad4ad9d5d}{th\_boottime}}.sec, (uintmax\_t)th-\/>\mbox{\hyperlink{structtimehands_af3aa7f25829422014014889ad4ad9d5d}{th\_boottime}}.frac);}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02268}02268 \}}
\DoxyCodeLine{\Hypertarget{kern__tc_8c_source_l02269}02269 \textcolor{preprocessor}{\#endif}}

\end{DoxyCode}
