[Tarantool-patches] [PATCH 1/2] fiber: reset clock stats on fiber.top_enable()

Serge Petrenko sergepetrenko at tarantool.org
Wed Nov 13 21:04:00 MSK 2019


Follow-up #2694
---
 src/lib/core/fiber.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/lib/core/fiber.c b/src/lib/core/fiber.c
index aebaba7f0..cad1e21b0 100644
--- a/src/lib/core/fiber.c
+++ b/src/lib/core/fiber.c
@@ -1206,12 +1206,15 @@ fiber_top_enable()
 		cord()->clock_acc = 0;
 		cord()->cpu_miss_count_last = 0;
 		cord()->clock_delta_last = 0;
+		cord()->clock_delta = 0;
 		struct timespec ts;
 		if (clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts) != 0) {
 			say_debug("clock_gettime(): failed to get this"
 				  "thread's cpu time.");
 			return;
 		}
+		cord()->clock_last = __rdtscp(&cord()->cpu_id_last);
+		cord()->cpu_miss_count = 0;
 		cord()->cputime_last = (uint64_t) ts.tv_sec * FIBER_TIME_RES +
 						  ts.tv_nsec;
 	}
-- 
2.21.0 (Apple Git-122)



More information about the Tarantool-patches mailing list