@@ -77,11 +77,6 @@ static inline uint64_t host_time_ns()
7777}
7878
7979/* for testing */
80- static inline void semu_timer_clocksource_enter (void )
81- {
82- local_start = host_time_ns ();
83- }
84-
8580static inline void semu_timer_clocksource_exit (void )
8681{
8782 uint64_t end = host_time_ns ();
@@ -176,7 +171,6 @@ static uint64_t semu_timer_clocksource(semu_timer_t *timer)
176171 static bool start_count = false;
177172 static FILE * time_log_file = NULL ;
178173
179- semu_timer_clocksource_enter ();
180174 count ++ ;
181175 cnt ++ ;
182176
@@ -191,6 +185,7 @@ static uint64_t semu_timer_clocksource(semu_timer_t *timer)
191185
192186#if defined(HAVE_POSIX_TIMER ) || defined(HAVE_MACH_TIMER )
193187 uint64_t now_ns = host_time_ns ();
188+ local_start = now_ns ;
194189 if (!start_count ) {
195190 start_count = true;
196191 time_1 = now_ns ;
@@ -243,23 +238,18 @@ static uint64_t semu_timer_clocksource(semu_timer_t *timer)
243238 TEST_ns_per_call , TEST_predict_sec , scale_factor );
244239
245240 printf (
246- "\033[1;31m[SEMU LOG]: test_total_clocksource_ns = %lu, "
247- "real_total_clocksource_ns = %.0f, percentage = "
248- "%.5f\033[0m\n" ,
241+ "\033[1;31m[SEMU LOG]: total_clocksource_ns = %lu, "
242+ "percentage = %.5f\033[0m\n" ,
249243 total_clocksource_ns ,
250- ((double ) total_clocksource_ns - TEST_ns_per_call * 2 * count ),
251- ((double ) total_clocksource_ns - TEST_ns_per_call * 2 * count ) /
244+ ((double ) total_clocksource_ns ) /
252245 ((boot_end .tv_sec - boot_begin .tv_sec ) * 1e9 +
253246 boot_end .tv_nsec - boot_begin .tv_nsec ));
254247
255248 printf (
256249 "\033[1;31m[SEMU LOG]: real_ns_per_call = %.5f, diff_ns_per_call = "
257250 "%.5f\033[0m\n" ,
258- ((double ) total_clocksource_ns - TEST_ns_per_call * 2 * count ) /
259- count ,
260- (((double ) total_clocksource_ns - TEST_ns_per_call * 2 * count ) /
261- count ) -
262- TEST_ns_per_call );
251+ ((double ) total_clocksource_ns / 2 ) / count ,
252+ (((double ) total_clocksource_ns / 2 ) / count ) - TEST_ns_per_call );
263253
264254 exit (0 );
265255 }
0 commit comments