From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59925) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YAeL8-0005RG-Nw for qemu-devel@nongnu.org; Mon, 12 Jan 2015 07:43:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YAeL3-0006Pc-Sx for qemu-devel@nongnu.org; Mon, 12 Jan 2015 07:43:26 -0500 Received: from mail.ispras.ru ([83.149.199.45]:48991) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YAeL3-0006OQ-M4 for qemu-devel@nongnu.org; Mon, 12 Jan 2015 07:43:21 -0500 From: "Pavel Dovgaluk" References: <20150112115944.3504.66763.stgit@PASHA-ISP> <20150112120054.3504.35220.stgit@PASHA-ISP> <54B3BA89.6080705@redhat.com> In-Reply-To: <54B3BA89.6080705@redhat.com> Date: Mon, 12 Jan 2015 15:43:21 +0300 Message-ID: <001401d02e65$5929f180$0b7dd480$@Dovgaluk@ispras.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Language: ru Subject: Re: [Qemu-devel] [RFC PATCH v7 12/21] replay: recording and replaying clock ticks List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: 'Paolo Bonzini' , qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, peter.crosthwaite@xilinx.com, alex.bennee@linaro.org, mark.burton@greensocs.com, real@ispras.ru, batuzovk@ispras.ru, maria.klimushenkova@ispras.ru, afaerber@suse.de, fred.konrad@greensocs.com > From: Paolo Bonzini [mailto:pbonzini@redhat.com] > On 12/01/2015 13:00, Pavel Dovgalyuk wrote: > > diff --git a/replay/replay.h b/replay/replay.h > > index 90a949b..1c18c0e 100755 > > --- a/replay/replay.h > > +++ b/replay/replay.h > > @@ -16,6 +16,16 @@ > > #include > > #include "qapi-types.h" > > > > +/* replay clock kinds */ > > +/* rdtsc */ > > +#define REPLAY_CLOCK_REAL_TICKS 0 > > +/* host_clock */ > > +#define REPLAY_CLOCK_HOST 1 > > +/* virtual_rt_clock */ > > +#define REPLAY_CLOCK_VIRTUAL_RT 2 > > + > > +#define REPLAY_CLOCK_COUNT 3 > > + > > extern ReplayMode replay_mode; > > extern char *replay_image_suffix; > > > > @@ -47,6 +57,19 @@ bool replay_interrupt(void); > > Returns true, when interrupt request is pending */ > > bool replay_has_interrupt(void); > > > > +/* Processing clocks and other time sources */ > > + > > +/*! Save the specified clock */ > > +int64_t replay_save_clock(unsigned int kind, int64_t clock); > > +/*! Read the specified clock from the log or return cached data */ > > +int64_t replay_read_clock(unsigned int kind); > > +/*! Saves or reads the clock depending on the current replay mode. */ > > +#define REPLAY_CLOCK(clock, value) \ > > + (replay_mode == REPLAY_MODE_PLAY ? replay_read_clock((clock)) \ > > + : replay_mode == REPLAY_MODE_RECORD \ > > + ? replay_save_clock((clock), (value)) \ > > + : (value)) > > + > > Inline functions please, not macros. Macro is required here, because I do not want the "value" to be computed in replay mode at all. Pavel Dovgalyuk