@@ -178,58 +178,3 @@ squid_timestamp_to_buf(char *buf, unsigned int buf_size, long timestamp_sec, lon
178178
179179 return res;
180180}
181-
182- #ifdef USE_TIME_STAMP_COUNTER_HRTIME
183- uint32_t
184- init_hrtime_TCS ()
185- {
186- int freqlen = sizeof (hrtime_freq);
187- if (sysctlbyname (" machdep.tsc_freq" , &hrtime_freq, (size_t *)&freqlen, nullptr , 0 ) < 0 ) {
188- perror (" sysctl: machdep.tsc_freq" );
189- exit (1 );
190- }
191- hrtime_freq_float = (double )1000000000 / (double )hrtime_freq;
192- return hrtime_freq;
193- }
194-
195- double hrtime_freq_float = 0.5 ; // 500 Mhz
196- uint32_t hrtime_freq = init_hrtime_TCS();
197- #endif
198-
199- #ifdef NEED_HRTIME_BASIS
200- timespec timespec_basis;
201- ink_hrtime hrtime_offset;
202- ink_hrtime hrtime_basis = init_hrtime_basis();
203-
204- ink_hrtime
205- init_hrtime_basis ()
206- {
207- ink_hrtime t1, t2, b, now;
208- timespec ts;
209- #ifdef USE_TIME_STAMP_COUNTER_HRTIME
210- init_hrtime_TCS ();
211- #endif
212- do {
213- t1 = ink_get_hrtime ();
214- #if HAVE_CLOCK_GETTIME
215- ink_assert (!clock_gettime (CLOCK_REALTIME_COARSE, ×pec_basis));
216- #else
217- {
218- struct timeval tnow;
219- ink_assert (!gettimeofday (&tnow, nullptr ));
220- timespec_basis.tv_sec = tnow.tv_sec ;
221- timespec_basis.tv_nsec = tnow.tv_usec * 1000 ;
222- }
223- #endif
224- t2 = ink_get_hrtime ();
225- // accuracy must be at least 100 microseconds
226- } while (t2 - t1 > HRTIME_USECONDS (100 ));
227- b = (t2 + t1) / 2 ;
228- now = ink_hrtime_from_timespec (×pec_basis);
229- ts = ink_hrtime_to_timespec (now);
230- ink_assert (ts.tv_sec == timespec_basis.tv_sec && ts.tv_nsec == timespec_basis.tv_nsec );
231- hrtime_offset = now - b;
232- hrtime_basis = b;
233- return b;
234- }
235- #endif
0 commit comments