Tarantool development patches archive
 help / color / mirror / Atom feed
From: Serge Petrenko <sergepetrenko@tarantool.org>
To: v.shpilevoy@tarantool.org
Cc: tarantool-patches@dev.tarantool.org
Subject: [Tarantool-patches] [PATCH 1/2] fiber: reset clock stats on fiber.top_enable()
Date: Wed, 13 Nov 2019 21:04:00 +0300	[thread overview]
Message-ID: <d66f924caa50b6cea6914e548906997fcf945027.1573667840.git.sergepetrenko@tarantool.org> (raw)
In-Reply-To: <cover.1573667840.git.sergepetrenko@tarantool.org>

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)

  reply	other threads:[~2019-11-13 18:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-13 18:03 [Tarantool-patches] [PATCH 0/2] fiber.top(): minor fixup Serge Petrenko
2019-11-13 18:04 ` Serge Petrenko [this message]
2019-11-13 18:04 ` [Tarantool-patches] [PATCH 2/2] app/fiber: wait till a full event loop iteration ends Serge Petrenko
2019-11-13 22:52   ` Vladislav Shpilevoy
2019-11-14 14:21     ` Sergey Petrenko
2019-11-14 21:44       ` Vladislav Shpilevoy
2019-11-15 14:59         ` Serge Petrenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d66f924caa50b6cea6914e548906997fcf945027.1573667840.git.sergepetrenko@tarantool.org \
    --to=sergepetrenko@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH 1/2] fiber: reset clock stats on fiber.top_enable()' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox