qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] struct TimerState
@ 2011-06-19 17:28 Nilay
  2011-06-20 14:51 ` Lluís
  0 siblings, 1 reply; 8+ messages in thread
From: Nilay @ 2011-06-19 17:28 UTC (permalink / raw)
  To: qemu-devel

Hi

I am trying to understand the structures that QEMU saves when do_savevm()
is invoked. Can anyone explain to me the fields that are part of the
TimerState structure in qemu-timer.c?

Thanks
Nilay

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] struct TimerState
  2011-06-19 17:28 [Qemu-devel] struct TimerState Nilay
@ 2011-06-20 14:51 ` Lluís
  2011-06-21 10:24   ` Nilay Vaish
  0 siblings, 1 reply; 8+ messages in thread
From: Lluís @ 2011-06-20 14:51 UTC (permalink / raw)
  To: nilay; +Cc: qemu-devel

Nilay  writes:

> I am trying to understand the structures that QEMU saves when do_savevm()
> is invoked. Can anyone explain to me the fields that are part of the
> TimerState structure in qemu-timer.c?

If my meory does not fail me, its main task is to capture what is the
time in the host whenever the VM is started and stopped.

This is later used to adapt the VM time when using icount in adaptive
mode (-icount=auto). I remember seeing it used somewhere else, but right
now I cannot recall exactly what for.

This reminds me that I've been navigating through all the time-related
code in QEMU and, in order to make it more easy to follow, I've started
separating the routines in qemu-timer into different files (e.g.,
qemu-htime and qemu-vtime for routines accessing time sources in the
host and in the VM). I will send the patches as soon as I finish the
rewrite.


Lluis

-- 
 "And it's much the same thing with knowledge, for whenever you learn
 something new, the whole world becomes that much richer."
 -- The Princess of Pure Reason, as told by Norton Juster in The Phantom
 Tollbooth

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] struct TimerState
  2011-06-20 14:51 ` Lluís
@ 2011-06-21 10:24   ` Nilay Vaish
  2011-06-21 12:32     ` Lluís
  2011-06-22 21:48     ` Andreas Färber
  0 siblings, 2 replies; 8+ messages in thread
From: Nilay Vaish @ 2011-06-21 10:24 UTC (permalink / raw)
  To: Lluís; +Cc: qemu-devel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: TEXT/PLAIN; CHARSET=X-UNKNOWN; format=flowed, Size: 1363 bytes --]

On Mon, 20 Jun 2011, Lluís wrote:

> Nilay  writes:
>
>> I am trying to understand the structures that QEMU saves when do_savevm()
>> is invoked. Can anyone explain to me the fields that are part of the
>> TimerState structure in qemu-timer.c?
>
> If my meory does not fail me, its main task is to capture what is the
> time in the host whenever the VM is started and stopped.
>
> This is later used to adapt the VM time when using icount in adaptive
> mode (-icount=auto). I remember seeing it used somewhere else, but right
> now I cannot recall exactly what for.
>
> This reminds me that I've been navigating through all the time-related
> code in QEMU and, in order to make it more easy to follow, I've started
> separating the routines in qemu-timer into different files (e.g.,
> qemu-htime and qemu-vtime for routines accessing time sources in the
> host and in the VM). I will send the patches as soon as I finish the
> rewrite.
>

Let me ask a more pointed question. Is there a way to know how many cycles 
the virtual machine has been running for? A comment that appears before 
the defintion of the TimerState structure -- guest cycle counter. As per 
Lluis' reply, this structure is keeping track of the time when the VM 
started. Can you determine this from the variables that are part of this 
structure?

Thanks
Nilay

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] struct TimerState
  2011-06-21 10:24   ` Nilay Vaish
@ 2011-06-21 12:32     ` Lluís
  2011-06-21 16:50       ` Nilay Vaish
  2011-06-22 21:48     ` Andreas Färber
  1 sibling, 1 reply; 8+ messages in thread
From: Lluís @ 2011-06-21 12:32 UTC (permalink / raw)
  To: Nilay Vaish; +Cc: qemu-devel

Nilay Vaish writes:

> Let me ask a more pointed question. Is there a way to know how many
> cycles the virtual machine has been running for? A comment that
> appears before the defintion of the TimerState structure -- guest
> cycle counter.

AFAIR, the TimerState captures the amount of host nsec/cycles that the
VM has been stopped for since the last VM stop/start pair.


> As per Lluis' reply, this structure is keeping track of the time when
> the VM started. Can you determine this from the variables that are
> part of this structure?

Determine what? The amount of host nsec/cycles or the amount of guest
nsec/cycles?

The former cannot be directly obtained unless you aggregate the
intermediate values in TimerState (although you're already able to get
that information from the OS). The latter depends under which
configuration you're executing (i.e., use_icount).


Lluis

-- 
 "And it's much the same thing with knowledge, for whenever you learn
 something new, the whole world becomes that much richer."
 -- The Princess of Pure Reason, as told by Norton Juster in The Phantom
 Tollbooth

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] struct TimerState
  2011-06-21 12:32     ` Lluís
@ 2011-06-21 16:50       ` Nilay Vaish
  2011-06-22 12:26         ` Lluís
  0 siblings, 1 reply; 8+ messages in thread
From: Nilay Vaish @ 2011-06-21 16:50 UTC (permalink / raw)
  To: Lluís; +Cc: qemu-devel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed, Size: 1163 bytes --]

On Tue, 21 Jun 2011, Lluís wrote:

> Nilay Vaish writes:
>
>> Let me ask a more pointed question. Is there a way to know how many
>> cycles the virtual machine has been running for? A comment that
>> appears before the defintion of the TimerState structure -- guest
>> cycle counter.
>
> AFAIR, the TimerState captures the amount of host nsec/cycles that the
> VM has been stopped for since the last VM stop/start pair.
>
>
>> As per Lluis' reply, this structure is keeping track of the time when
>> the VM started. Can you determine this from the variables that are
>> part of this structure?
>
> Determine what? The amount of host nsec/cycles or the amount of guest
> nsec/cycles?
>
> The former cannot be directly obtained unless you aggregate the
> intermediate values in TimerState (although you're already able to get
> that information from the OS). The latter depends under which
> configuration you're executing (i.e., use_icount).
>

I would like to determine the later. icount will give the instruction 
count. I need the instruction count as well, but is there some way to 
determine the guest cycles as well?

--
Nilay

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] struct TimerState
  2011-06-21 16:50       ` Nilay Vaish
@ 2011-06-22 12:26         ` Lluís
  0 siblings, 0 replies; 8+ messages in thread
From: Lluís @ 2011-06-22 12:26 UTC (permalink / raw)
  To: Nilay Vaish; +Cc: qemu-devel

Nilay Vaish writes:

> I would like to determine the later. icount will give the instruction count. I
> need the instruction count as well, but is there some way to determine the guest
> cycles as well?

On the current implementation, the number of cycles is directly related
to the icount, so what you want is 'cpu_get_icount'.


Lluis

-- 
 "And it's much the same thing with knowledge, for whenever you learn
 something new, the whole world becomes that much richer."
 -- The Princess of Pure Reason, as told by Norton Juster in The Phantom
 Tollbooth

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] struct TimerState
  2011-06-21 10:24   ` Nilay Vaish
  2011-06-21 12:32     ` Lluís
@ 2011-06-22 21:48     ` Andreas Färber
  2011-06-24  4:25       ` Nilay Vaish
  1 sibling, 1 reply; 8+ messages in thread
From: Andreas Färber @ 2011-06-22 21:48 UTC (permalink / raw)
  To: Nilay Vaish; +Cc: Lluís, qemu-devel

Am 21.06.2011 um 12:24 schrieb Nilay Vaish:

> Is there a way to know how many cycles the virtual machine has been  
> running for?

No. QEMU's emulation is not cycle-accurate.

The instruction counter (icount) gives you an indication of how much  
workload the guest has processed but no indication how much time that  
would've corresponded to.

Andreas

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] struct TimerState
  2011-06-22 21:48     ` Andreas Färber
@ 2011-06-24  4:25       ` Nilay Vaish
  0 siblings, 0 replies; 8+ messages in thread
From: Nilay Vaish @ 2011-06-24  4:25 UTC (permalink / raw)
  To: Andreas Färber; +Cc: Lluís, qemu-devel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed, Size: 563 bytes --]

On Wed, 22 Jun 2011, Andreas Färber wrote:

> Am 21.06.2011 um 12:24 schrieb Nilay Vaish:
>
>> Is there a way to know how many cycles the virtual machine has been running 
>> for?
>
> No. QEMU's emulation is not cycle-accurate.
>
> The instruction counter (icount) gives you an indication of how much workload 
> the guest has processed but no indication how much time that would've 
> corresponded to.
>
> Andreas

Lluis and Andreas, thanks for answering my questions.

Can you tell me where can I find documentation about APIC?

Thanks
Nilay

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-06-24  4:25 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-19 17:28 [Qemu-devel] struct TimerState Nilay
2011-06-20 14:51 ` Lluís
2011-06-21 10:24   ` Nilay Vaish
2011-06-21 12:32     ` Lluís
2011-06-21 16:50       ` Nilay Vaish
2011-06-22 12:26         ` Lluís
2011-06-22 21:48     ` Andreas Färber
2011-06-24  4:25       ` Nilay Vaish

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).